quota: add the option to not fail with EDQUOT in block
To simplify metadata tracking for delalloc writes, ext4 will simply claim metadata blocks at allocation time, without first speculatively reserving the worst case and then freeing what was not used. To do this, we need a mechanism to track allocations in the quota subsystem, but potentially allow that allocation to actually go over quota. This patch adds a DQUOT_SPACE_NOFAIL flag and function variants for this purpose. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
This commit is contained in:

committed by
Theodore Ts'o

parent
56246f9ae4
commit
0e05842bc1
@@ -1494,6 +1494,7 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags)
|
||||
char warntype[MAXQUOTAS];
|
||||
int warn = flags & DQUOT_SPACE_WARN;
|
||||
int reserve = flags & DQUOT_SPACE_RESERVE;
|
||||
int nofail = flags & DQUOT_SPACE_NOFAIL;
|
||||
|
||||
/*
|
||||
* First test before acquiring mutex - solves deadlocks when we
|
||||
@@ -1514,7 +1515,7 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags)
|
||||
continue;
|
||||
ret = check_bdq(inode->i_dquot[cnt], number, !warn,
|
||||
warntype+cnt);
|
||||
if (ret) {
|
||||
if (ret && !nofail) {
|
||||
spin_unlock(&dq_data_lock);
|
||||
goto out_flush_warn;
|
||||
}
|
||||
|
Reference in New Issue
Block a user