diff options
author | Jan Kara <jack@suse.cz> | 2014-04-03 14:46:55 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-04-03 16:20:54 -0700 |
commit | 9f985cb6c45bc3f8b7e161c9658d409d051d576f (patch) | |
tree | c9c9d1431fd3a7a002ed17b095e981bcf2cb30a3 /include/linux/quotaops.h | |
parent | bd62ad7aebd8e8895bb7649ace948040332f27d3 (diff) | |
download | blackbird-op-linux-9f985cb6c45bc3f8b7e161c9658d409d051d576f.tar.gz blackbird-op-linux-9f985cb6c45bc3f8b7e161c9658d409d051d576f.zip |
quota: provide function to grab quota structure reference
Provide dqgrab() function to get quota structure reference when we are
sure it already has at least one active reference. Make use of this
function inside quota code.
Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Mark Fasheh <mfasheh@suse.de>
Reviewed-by: Srinivas Eeda <srinivas.eeda@oracle.com>
Cc: Joel Becker <jlbec@evilplan.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/quotaops.h')
-rw-r--r-- | include/linux/quotaops.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h index 6965fe394c3b..1d3eee594cd6 100644 --- a/include/linux/quotaops.h +++ b/include/linux/quotaops.h @@ -46,6 +46,14 @@ void inode_reclaim_rsv_space(struct inode *inode, qsize_t number); void dquot_initialize(struct inode *inode); void dquot_drop(struct inode *inode); struct dquot *dqget(struct super_block *sb, struct kqid qid); +static inline struct dquot *dqgrab(struct dquot *dquot) +{ + /* Make sure someone else has active reference to dquot */ + WARN_ON_ONCE(!atomic_read(&dquot->dq_count)); + WARN_ON_ONCE(!test_bit(DQ_ACTIVE_B, &dquot->dq_flags)); + atomic_inc(&dquot->dq_count); + return dquot; +} void dqput(struct dquot *dquot); int dquot_scan_active(struct super_block *sb, int (*fn)(struct dquot *dquot, unsigned long priv), |