]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
quota: Allow disabling tracking of dirty dquots in a list
authorJan Kara <jack@suse.cz>
Thu, 3 Aug 2017 09:18:23 +0000 (11:18 +0200)
committerJan Kara <jack@suse.cz>
Thu, 17 Aug 2017 20:00:45 +0000 (22:00 +0200)
Filesystems that are journalling quotas generally don't need tracking of
dirty dquots in a list since forcing a transaction commit flushes all
quotas anyway. Allow filesystem to say it doesn't want dquots to be
tracked as it reduces contention on the dq_list_lock.

Signed-off-by: Jan Kara <jack@suse.cz>
fs/quota/dquot.c
include/linux/quota.h

index 361a2a6f13e102b67b7aca3cc099ad0c7aa28a4c..b867578e62c08ae97ee766eabb675dea4bbf5000 100644 (file)
@@ -344,6 +344,9 @@ int dquot_mark_dquot_dirty(struct dquot *dquot)
        if (!test_bit(DQ_ACTIVE_B, &dquot->dq_flags))
                return 0;
 
+       if (sb_dqopt(dquot->dq_sb)->flags & DQUOT_NOLIST_DIRTY)
+               return test_and_set_bit(DQ_MOD_B, &dquot->dq_flags);
+
        /* If quota is dirty already, we don't have to acquire dq_list_lock */
        if (test_bit(DQ_MOD_B, &dquot->dq_flags))
                return 1;
@@ -385,6 +388,9 @@ static inline void dqput_all(struct dquot **dquot)
 
 static inline int clear_dquot_dirty(struct dquot *dquot)
 {
+       if (sb_dqopt(dquot->dq_sb)->flags & DQUOT_NOLIST_DIRTY)
+               return test_and_clear_bit(DQ_MOD_B, &dquot->dq_flags);
+
        spin_lock(&dq_list_lock);
        if (!test_and_clear_bit(DQ_MOD_B, &dquot->dq_flags)) {
                spin_unlock(&dq_list_lock);
index ad6809f099ac6eff72fa80cd4ed74d353cf96d76..eccc1cb6274e306e0eaf6db3de5877ea41413e22 100644 (file)
@@ -490,6 +490,9 @@ enum {
                                                 */
 #define DQUOT_NEGATIVE_USAGE   (1 << (DQUOT_STATE_LAST + 1))
                                               /* Allow negative quota usage */
+/* Do not track dirty dquots in a list */
+#define DQUOT_NOLIST_DIRTY     (1 << (DQUOT_STATE_LAST + 2))
+
 static inline unsigned int dquot_state_flag(unsigned int flags, int type)
 {
        return flags << type;