From: Tahsin Erdogan <tahsin@google.com>
To: Andreas Dilger <adilger@dilger.ca>,
"Darrick J . Wong" <darrick.wong@oracle.com>,
Jan Kara <jack@suse.cz>, Theodore Ts'o <tytso@mit.edu>,
linux-ext4@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Tahsin Erdogan <tahsin@google.com>
Subject: [PATCH 25/32] ext4: add ext4_is_quota_file()
Date: Wed, 21 Jun 2017 18:49:32 -0700 [thread overview]
Message-ID: <20170622014939.3592-2-tahsin@google.com> (raw)
In-Reply-To: <20170622014939.3592-1-tahsin@google.com>
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>
---
fs/ext4/ext4.h | 2 ++
fs/ext4/inode.c | 2 +-
fs/ext4/ioctl.c | 4 ++--
fs/ext4/mballoc.c | 2 +-
fs/ext4/move_extent.c | 2 +-
5 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index e4a75c643731..3b02bd897b61 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -2099,6 +2099,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
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 8ee20b586567..cf91532765a4 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -739,7 +739,7 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode,
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);
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,
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);
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,
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) {
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,
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);
--
2.13.1.611.g7e3b11ae1-goog
next prev parent reply other threads:[~2017-06-22 1:49 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-22 1:49 [PATCH 24/32] ext2, ext4: make mb block cache names more explicit Tahsin Erdogan
2017-06-22 1:49 ` Tahsin Erdogan [this message]
2017-06-22 15:39 ` [PATCH 25/32] ext4: add ext4_is_quota_file() Theodore Ts'o
2017-06-22 1:49 ` [PATCH 26/32] ext4: cleanup transaction restarts during inode deletion Tahsin Erdogan
2017-06-22 15:43 ` Theodore Ts'o
2017-06-22 1:49 ` [PATCH 27/32] ext4: xattr inode deduplication Tahsin Erdogan
2017-06-22 15:45 ` Theodore Ts'o
2017-06-22 1:49 ` [PATCH 28/32] quota: add get_inode_usage callback to transfer multi-inode charges Tahsin Erdogan
2017-06-22 15:47 ` Theodore Ts'o
2017-06-22 1:49 ` [PATCH 29/32] ext4: reserve space for xattr entries/names Tahsin Erdogan
2017-06-22 15:49 ` Theodore Ts'o
2017-06-22 1:49 ` [PATCH 30/32] ext4: eliminate xattr entry e_hash recalculation for removes Tahsin Erdogan
2017-06-22 15:52 ` Theodore Ts'o
2017-06-22 1:49 ` [PATCH 31/32] ext4: strong binding of xattr inode references Tahsin Erdogan
2017-06-22 15:54 ` Theodore Ts'o
2017-06-22 1:49 ` [PATCH 32/32] ext4: add nombcache mount option Tahsin Erdogan
2017-06-22 16:00 ` Theodore Ts'o
2017-06-22 15:30 ` [PATCH 24/32] ext2, ext4: make mb block cache names more explicit Theodore Ts'o
-- strict thread matches above, loose matches on Subject: below --
2017-06-21 21:21 [PATCH 01/32] ext4: xattr-in-inode support Tahsin Erdogan
2017-06-21 21:21 ` [PATCH 25/32] ext4: add ext4_is_quota_file() Tahsin Erdogan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170622014939.3592-2-tahsin@google.com \
--to=tahsin@google.com \
--cc=adilger@dilger.ca \
--cc=darrick.wong@oracle.com \
--cc=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).