aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2017-06-09 02:36:16 -0400
committerJan Kara <jack@suse.cz>2017-08-17 13:05:16 -0400
commitf14618c6823ee0f9f92a87aad7d5ad26916ccff1 (patch)
tree6cb1b9a685046e6bd0197952f8078d31c7b5f772
parentb9a1a7f4b6b5861c6ae89a125271103ceb8c8690 (diff)
quota: Push dqio_sem down to ->get_next_id()
Push down acquisition of dqio_sem into ->get_next_id() callback. Mostly for consistency with other operations. Reviewed-by: Andreas Dilger <adilger@dilger.ca> Signed-off-by: Jan Kara <jack@suse.cz>
-rw-r--r--fs/quota/dquot.c6
-rw-r--r--fs/quota/quota_v2.c8
2 files changed, 8 insertions, 6 deletions
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 3b3c7f094ff8..332f7026edad 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -2067,16 +2067,12 @@ EXPORT_SYMBOL(dquot_commit_info);
2067int dquot_get_next_id(struct super_block *sb, struct kqid *qid) 2067int dquot_get_next_id(struct super_block *sb, struct kqid *qid)
2068{ 2068{
2069 struct quota_info *dqopt = sb_dqopt(sb); 2069 struct quota_info *dqopt = sb_dqopt(sb);
2070 int err;
2071 2070
2072 if (!sb_has_quota_active(sb, qid->type)) 2071 if (!sb_has_quota_active(sb, qid->type))
2073 return -ESRCH; 2072 return -ESRCH;
2074 if (!dqopt->ops[qid->type]->get_next_id) 2073 if (!dqopt->ops[qid->type]->get_next_id)
2075 return -ENOSYS; 2074 return -ENOSYS;
2076 down_read(&dqopt->dqio_sem); 2075 return dqopt->ops[qid->type]->get_next_id(sb, qid);
2077 err = dqopt->ops[qid->type]->get_next_id(sb, qid);
2078 up_read(&dqopt->dqio_sem);
2079 return err;
2080} 2076}
2081EXPORT_SYMBOL(dquot_get_next_id); 2077EXPORT_SYMBOL(dquot_get_next_id);
2082 2078
diff --git a/fs/quota/quota_v2.c b/fs/quota/quota_v2.c
index 8f54b159e423..f82638e43c07 100644
--- a/fs/quota/quota_v2.c
+++ b/fs/quota/quota_v2.c
@@ -340,7 +340,13 @@ static int v2_free_file_info(struct super_block *sb, int type)
340 340
341static int v2_get_next_id(struct super_block *sb, struct kqid *qid) 341static int v2_get_next_id(struct super_block *sb, struct kqid *qid)
342{ 342{
343 return qtree_get_next_id(sb_dqinfo(sb, qid->type)->dqi_priv, qid); 343 struct quota_info *dqopt = sb_dqopt(sb);
344 int ret;
345
346 down_read(&dqopt->dqio_sem);
347 ret = qtree_get_next_id(sb_dqinfo(sb, qid->type)->dqi_priv, qid);
348 up_read(&dqopt->dqio_sem);
349 return ret;
344} 350}
345 351
346static const struct quota_format_ops v2_format_ops = { 352static const struct quota_format_ops v2_format_ops = {