aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTahsin Erdogan <tahsin@google.com>2017-06-22 11:31:25 -0400
committerTheodore Ts'o <tytso@mit.edu>2017-06-22 11:31:25 -0400
commit02749a4c20827649859bf7e2435f1b238c24f935 (patch)
tree22d38a7118bbe3267e2900418728607d5ba38ad7
parent47387409ee2e09db6d0e79a026a02073dc56bb8c (diff)
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 <tahsin@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r--fs/ext4/ext4.h2
-rw-r--r--fs/ext4/inode.c2
-rw-r--r--fs/ext4/ioctl.c4
-rw-r--r--fs/ext4/mballoc.c2
-rw-r--r--fs/ext4/move_extent.c2
5 files changed, 7 insertions, 5 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index caf004d0d1b3..09983c774d31 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -2100,6 +2100,8 @@ static inline struct ext4_inode *ext4_raw_inode(struct ext4_iloc *iloc)
2100 return (struct ext4_inode *) (iloc->bh->b_data + iloc->offset); 2100 return (struct ext4_inode *) (iloc->bh->b_data + iloc->offset);
2101} 2101}
2102 2102
2103#define ext4_is_quota_file(inode) IS_NOQUOTA(inode)
2104
2103/* 2105/*
2104 * This structure is stuffed into the struct file's private_data field 2106 * This structure is stuffed into the struct file's private_data field
2105 * for directories. It is where we put information so that we can do 2107 * for directories. It is where we put information so that we can do
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 1b2a68c5ea42..3e9415e2e74d 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -739,7 +739,7 @@ out_sem:
739 if (map->m_flags & EXT4_MAP_NEW && 739 if (map->m_flags & EXT4_MAP_NEW &&
740 !(map->m_flags & EXT4_MAP_UNWRITTEN) && 740 !(map->m_flags & EXT4_MAP_UNWRITTEN) &&
741 !(flags & EXT4_GET_BLOCKS_ZERO) && 741 !(flags & EXT4_GET_BLOCKS_ZERO) &&
742 !IS_NOQUOTA(inode) && 742 !ext4_is_quota_file(inode) &&
743 ext4_should_order_data(inode)) { 743 ext4_should_order_data(inode)) {
744 if (flags & EXT4_GET_BLOCKS_IO_SUBMIT) 744 if (flags & EXT4_GET_BLOCKS_IO_SUBMIT)
745 ret = ext4_jbd2_inode_add_wait(handle, inode); 745 ret = ext4_jbd2_inode_add_wait(handle, inode);
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
index 0c21e22acd74..dde8deb11e59 100644
--- a/fs/ext4/ioctl.c
+++ b/fs/ext4/ioctl.c
@@ -218,7 +218,7 @@ static int ext4_ioctl_setflags(struct inode *inode,
218 unsigned int jflag; 218 unsigned int jflag;
219 219
220 /* Is it quota file? Do not allow user to mess with it */ 220 /* Is it quota file? Do not allow user to mess with it */
221 if (IS_NOQUOTA(inode)) 221 if (ext4_is_quota_file(inode))
222 goto flags_out; 222 goto flags_out;
223 223
224 oldflags = ei->i_flags; 224 oldflags = ei->i_flags;
@@ -342,7 +342,7 @@ static int ext4_ioctl_setproject(struct file *filp, __u32 projid)
342 err = -EPERM; 342 err = -EPERM;
343 inode_lock(inode); 343 inode_lock(inode);
344 /* Is it quota file? Do not allow user to mess with it */ 344 /* Is it quota file? Do not allow user to mess with it */
345 if (IS_NOQUOTA(inode)) 345 if (ext4_is_quota_file(inode))
346 goto out_unlock; 346 goto out_unlock;
347 347
348 err = ext4_get_inode_loc(inode, &iloc); 348 err = ext4_get_inode_loc(inode, &iloc);
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index b7928cddd539..d109a2a2fea0 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -4464,7 +4464,7 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle,
4464 trace_ext4_request_blocks(ar); 4464 trace_ext4_request_blocks(ar);
4465 4465
4466 /* Allow to use superuser reservation for quota file */ 4466 /* Allow to use superuser reservation for quota file */
4467 if (IS_NOQUOTA(ar->inode)) 4467 if (ext4_is_quota_file(ar->inode))
4468 ar->flags |= EXT4_MB_USE_ROOT_BLOCKS; 4468 ar->flags |= EXT4_MB_USE_ROOT_BLOCKS;
4469 4469
4470 if ((ar->flags & EXT4_MB_DELALLOC_RESERVED) == 0) { 4470 if ((ar->flags & EXT4_MB_DELALLOC_RESERVED) == 0) {
diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c
index c992ef2c2f94..9bb36909ec92 100644
--- a/fs/ext4/move_extent.c
+++ b/fs/ext4/move_extent.c
@@ -484,7 +484,7 @@ mext_check_arguments(struct inode *orig_inode,
484 return -EBUSY; 484 return -EBUSY;
485 } 485 }
486 486
487 if (IS_NOQUOTA(orig_inode) || IS_NOQUOTA(donor_inode)) { 487 if (ext4_is_quota_file(orig_inode) && ext4_is_quota_file(donor_inode)) {
488 ext4_debug("ext4 move extent: The argument files should " 488 ext4_debug("ext4 move extent: The argument files should "
489 "not be quota files [ino:orig %lu, donor %lu]\n", 489 "not be quota files [ino:orig %lu, donor %lu]\n",
490 orig_inode->i_ino, donor_inode->i_ino); 490 orig_inode->i_ino, donor_inode->i_ino);