diff options
Diffstat (limited to 'fs/quota')
-rw-r--r-- | 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 788b5802a7ce..05c590e10ac2 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c | |||
@@ -317,14 +317,23 @@ static inline int mark_dquot_dirty(struct dquot *dquot) | |||
317 | return dquot->dq_sb->dq_op->mark_dirty(dquot); | 317 | return dquot->dq_sb->dq_op->mark_dirty(dquot); |
318 | } | 318 | } |
319 | 319 | ||
320 | /* Mark dquot dirty in atomic manner, and return it's old dirty flag state */ | ||
320 | int dquot_mark_dquot_dirty(struct dquot *dquot) | 321 | int dquot_mark_dquot_dirty(struct dquot *dquot) |
321 | { | 322 | { |
323 | int ret = 1; | ||
324 | |||
325 | /* If quota is dirty already, we don't have to acquire dq_list_lock */ | ||
326 | if (test_bit(DQ_MOD_B, &dquot->dq_flags)) | ||
327 | return 1; | ||
328 | |||
322 | spin_lock(&dq_list_lock); | 329 | spin_lock(&dq_list_lock); |
323 | if (!test_and_set_bit(DQ_MOD_B, &dquot->dq_flags)) | 330 | if (!test_and_set_bit(DQ_MOD_B, &dquot->dq_flags)) { |
324 | list_add(&dquot->dq_dirty, &sb_dqopt(dquot->dq_sb)-> | 331 | list_add(&dquot->dq_dirty, &sb_dqopt(dquot->dq_sb)-> |
325 | info[dquot->dq_type].dqi_dirty_list); | 332 | info[dquot->dq_type].dqi_dirty_list); |
333 | ret = 0; | ||
334 | } | ||
326 | spin_unlock(&dq_list_lock); | 335 | spin_unlock(&dq_list_lock); |
327 | return 0; | 336 | return ret; |
328 | } | 337 | } |
329 | EXPORT_SYMBOL(dquot_mark_dquot_dirty); | 338 | EXPORT_SYMBOL(dquot_mark_dquot_dirty); |
330 | 339 | ||