]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ext4: add ext4_is_quota_file()
authorTahsin Erdogan <tahsin@google.com>
Thu, 22 Jun 2017 15:31:25 +0000 (11:31 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 22 Jun 2017 15:31:25 +0000 (11:31 -0400)
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>
fs/ext4/ext4.h
fs/ext4/inode.c
fs/ext4/ioctl.c
fs/ext4/mballoc.c
fs/ext4/move_extent.c

index caf004d0d1b3c8d4cadb92985c24c43251b6c18f..09983c774d31433bcacb76ac40768b90c7342fed 100644 (file)
@@ -2100,6 +2100,8 @@ static inline struct ext4_inode *ext4_raw_inode(struct ext4_iloc *iloc)
        return (struct ext4_inode *) (iloc->bh->b_data + iloc->offset);
 }
 
+#define ext4_is_quota_file(inode) IS_NOQUOTA(inode)
+
 /*
  * This structure is stuffed into the struct file's private_data field
  * for directories.  It is where we put information so that we can do
index 1b2a68c5ea421e38ded07780c0ebd0367c62cec0..3e9415e2e74d285fe110e89e07ae6a70e294ff83 100644 (file)
@@ -739,7 +739,7 @@ out_sem:
                if (map->m_flags & EXT4_MAP_NEW &&
                    !(map->m_flags & EXT4_MAP_UNWRITTEN) &&
                    !(flags & EXT4_GET_BLOCKS_ZERO) &&
-                   !IS_NOQUOTA(inode) &&
+                   !ext4_is_quota_file(inode) &&
                    ext4_should_order_data(inode)) {
                        if (flags & EXT4_GET_BLOCKS_IO_SUBMIT)
                                ret = ext4_jbd2_inode_add_wait(handle, inode);
index 0c21e22acd74f37ec21f61d6d990fad33ce767db..dde8deb11e59cbdbf9952f5fe4d7042bc25c5438 100644 (file)
@@ -218,7 +218,7 @@ static int ext4_ioctl_setflags(struct inode *inode,
        unsigned int jflag;
 
        /* Is it quota file? Do not allow user to mess with it */
-       if (IS_NOQUOTA(inode))
+       if (ext4_is_quota_file(inode))
                goto flags_out;
 
        oldflags = ei->i_flags;
@@ -342,7 +342,7 @@ static int ext4_ioctl_setproject(struct file *filp, __u32 projid)
        err = -EPERM;
        inode_lock(inode);
        /* Is it quota file? Do not allow user to mess with it */
-       if (IS_NOQUOTA(inode))
+       if (ext4_is_quota_file(inode))
                goto out_unlock;
 
        err = ext4_get_inode_loc(inode, &iloc);
index b7928cddd539ee223584db33ab8cb3341faa2e86..d109a2a2fea0e705be8241403d044f7d8af40386 100644 (file)
@@ -4464,7 +4464,7 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle,
        trace_ext4_request_blocks(ar);
 
        /* Allow to use superuser reservation for quota file */
-       if (IS_NOQUOTA(ar->inode))
+       if (ext4_is_quota_file(ar->inode))
                ar->flags |= EXT4_MB_USE_ROOT_BLOCKS;
 
        if ((ar->flags & EXT4_MB_DELALLOC_RESERVED) == 0) {
index c992ef2c2f94c0865d14de67e2c5b99857edf71f..9bb36909ec92066a9b74f612b100212eaa68dddd 100644 (file)
@@ -484,7 +484,7 @@ mext_check_arguments(struct inode *orig_inode,
                return -EBUSY;
        }
 
-       if (IS_NOQUOTA(orig_inode) || IS_NOQUOTA(donor_inode)) {
+       if (ext4_is_quota_file(orig_inode) && ext4_is_quota_file(donor_inode)) {
                ext4_debug("ext4 move extent: The argument files should "
                        "not be quota files [ino:orig %lu, donor %lu]\n",
                        orig_inode->i_ino, donor_inode->i_ino);