Skip to content

Commit 02749a4

Browse files
Tahsin Erdogantytso
authored andcommitted
ext4: add ext4_is_quota_file()
IS_NOQUOTA() indicates whether quota is disabled for an inode. Ext4 also uses it to check whether an inode is for a quota file. The distinction currently doesn't matter because quota is disabled only for the quota files. When we start disabling quota for other inodes in the future, we will want to make the distinction clear. Replace IS_NOQUOTA() call with ext4_is_quota_file() at places where we are checking for quota files. Signed-off-by: Tahsin Erdogan <[email protected]> Signed-off-by: Theodore Ts'o <[email protected]>
1 parent 4738740 commit 02749a4

File tree

5 files changed

+7
-5
lines changed

5 files changed

+7
-5
lines changed

fs/ext4/ext4.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2100,6 +2100,8 @@ static inline struct ext4_inode *ext4_raw_inode(struct ext4_iloc *iloc)
21002100
return (struct ext4_inode *) (iloc->bh->b_data + iloc->offset);
21012101
}
21022102

2103+
#define ext4_is_quota_file(inode) IS_NOQUOTA(inode)
2104+
21032105
/*
21042106
* This structure is stuffed into the struct file's private_data field
21052107
* for directories. It is where we put information so that we can do

fs/ext4/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode,
739739
if (map->m_flags & EXT4_MAP_NEW &&
740740
!(map->m_flags & EXT4_MAP_UNWRITTEN) &&
741741
!(flags & EXT4_GET_BLOCKS_ZERO) &&
742-
!IS_NOQUOTA(inode) &&
742+
!ext4_is_quota_file(inode) &&
743743
ext4_should_order_data(inode)) {
744744
if (flags & EXT4_GET_BLOCKS_IO_SUBMIT)
745745
ret = ext4_jbd2_inode_add_wait(handle, inode);

fs/ext4/ioctl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ static int ext4_ioctl_setflags(struct inode *inode,
218218
unsigned int jflag;
219219

220220
/* Is it quota file? Do not allow user to mess with it */
221-
if (IS_NOQUOTA(inode))
221+
if (ext4_is_quota_file(inode))
222222
goto flags_out;
223223

224224
oldflags = ei->i_flags;
@@ -342,7 +342,7 @@ static int ext4_ioctl_setproject(struct file *filp, __u32 projid)
342342
err = -EPERM;
343343
inode_lock(inode);
344344
/* Is it quota file? Do not allow user to mess with it */
345-
if (IS_NOQUOTA(inode))
345+
if (ext4_is_quota_file(inode))
346346
goto out_unlock;
347347

348348
err = ext4_get_inode_loc(inode, &iloc);

fs/ext4/mballoc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4464,7 +4464,7 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle,
44644464
trace_ext4_request_blocks(ar);
44654465

44664466
/* Allow to use superuser reservation for quota file */
4467-
if (IS_NOQUOTA(ar->inode))
4467+
if (ext4_is_quota_file(ar->inode))
44684468
ar->flags |= EXT4_MB_USE_ROOT_BLOCKS;
44694469

44704470
if ((ar->flags & EXT4_MB_DELALLOC_RESERVED) == 0) {

fs/ext4/move_extent.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ mext_check_arguments(struct inode *orig_inode,
484484
return -EBUSY;
485485
}
486486

487-
if (IS_NOQUOTA(orig_inode) || IS_NOQUOTA(donor_inode)) {
487+
if (ext4_is_quota_file(orig_inode) && ext4_is_quota_file(donor_inode)) {
488488
ext4_debug("ext4 move extent: The argument files should "
489489
"not be quota files [ino:orig %lu, donor %lu]\n",
490490
orig_inode->i_ino, donor_inode->i_ino);

0 commit comments

Comments
 (0)