linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Monakhov <dmonakhov@openvz.org>
To: linux-ext4@vger.kernel.org
Cc: linux-fsdevel@vger.kernel.org, jack@suse.cz,
	Dmitry Monakhov <dmonakhov@openvz.org>
Subject: [PATCH 1/3] quota: optimize mark_dirty logic
Date: Sat, 27 Mar 2010 15:15:38 +0300	[thread overview]
Message-ID: <1269692140-5375-2-git-send-email-dmonakhov@openvz.org> (raw)
In-Reply-To: <1269692140-5375-1-git-send-email-dmonakhov@openvz.org>

- Skipp locking if quota is dirty already.
- Return old quota state to help fs-specciffic implementation to optimize
  case where quota was dirty already.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
 fs/quota/dquot.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index e0b870f..88a8ef2 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -319,14 +319,23 @@ static inline int mark_dquot_dirty(struct dquot *dquot)
 	return dquot->dq_sb->dq_op->mark_dirty(dquot);
 }
 
+/* Mark dquot dirty in atomic meaner, and return it's old dirty flag state */
 int dquot_mark_dquot_dirty(struct dquot *dquot)
 {
+	int ret = 1;
+
+	/* If quota is dirtly already we don't have to acquire dq_list_lock */
+	if (test_bit(DQ_MOD_B, &dquot->dq_flags))
+		return 1;
+
 	spin_lock(&dq_list_lock);
-	if (!test_and_set_bit(DQ_MOD_B, &dquot->dq_flags))
+	if (!test_and_set_bit(DQ_MOD_B, &dquot->dq_flags)) {
 		list_add(&dquot->dq_dirty, &sb_dqopt(dquot->dq_sb)->
 				info[dquot->dq_type].dqi_dirty_list);
+		ret = 0;
+	}
 	spin_unlock(&dq_list_lock);
-	return 0;
+	return ret;
 }
 EXPORT_SYMBOL(dquot_mark_dquot_dirty);
 
-- 
1.6.6.1


  reply	other threads:[~2010-03-27 12:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-27 12:15 [PATCH 0/3] ext4/quota: journalled quota optimizations Dmitry Monakhov
2010-03-27 12:15 ` Dmitry Monakhov [this message]
2010-03-27 12:15   ` [PATCH 2/3] ext4: journalled quota optimization Dmitry Monakhov
2010-03-27 12:15     ` [PATCH 3/3] ext4: optimize quota write locking Dmitry Monakhov
2010-04-01  9:14       ` Jan Kara
2010-04-05  3:34         ` dmonakhov
2010-04-01  9:12     ` [PATCH 2/3] ext4: journalled quota optimization Jan Kara
2010-04-05  3:30       ` dmonakhov
2010-04-06 18:06         ` Jan Kara
2010-04-07  8:12           ` Dmitry Monakhov
2010-04-07 12:06             ` Jan Kara
2010-03-31 15:06   ` [PATCH 1/3] quota: optimize mark_dirty logic Jan Kara

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=1269692140-5375-2-git-send-email-dmonakhov@openvz.org \
    --to=dmonakhov@openvz.org \
    --cc=jack@suse.cz \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    /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).