quota: Push dqio_sem down to ->get_next_id()
authorJan Kara <jack@suse.cz>
Fri, 9 Jun 2017 06:36:16 +0000 (08:36 +0200)
committerJan Kara <jack@suse.cz>
Thu, 17 Aug 2017 17:05:16 +0000 (19:05 +0200)
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>
fs/quota/dquot.c
fs/quota/quota_v2.c

index 3b3c7f094ff8eb4a348dbb60f741a878c42f81a1..332f7026edad82e97239be24cc8360b6ab40d020 100644 (file)
@@ -2067,16 +2067,12 @@ EXPORT_SYMBOL(dquot_commit_info);
 int dquot_get_next_id(struct super_block *sb, struct kqid *qid)
 {
        struct quota_info *dqopt = sb_dqopt(sb);
-       int err;
 
        if (!sb_has_quota_active(sb, qid->type))
                return -ESRCH;
        if (!dqopt->ops[qid->type]->get_next_id)
                return -ENOSYS;
-       down_read(&dqopt->dqio_sem);
-       err = dqopt->ops[qid->type]->get_next_id(sb, qid);
-       up_read(&dqopt->dqio_sem);
-       return err;
+       return dqopt->ops[qid->type]->get_next_id(sb, qid);
 }
 EXPORT_SYMBOL(dquot_get_next_id);
 
index 8f54b159e4236c1cafdfa46985161324185bb59e..f82638e43c07d20074c13ab2a70b0da59ba6b410 100644 (file)
@@ -340,7 +340,13 @@ static int v2_free_file_info(struct super_block *sb, int type)
 
 static int v2_get_next_id(struct super_block *sb, struct kqid *qid)
 {
-       return qtree_get_next_id(sb_dqinfo(sb, qid->type)->dqi_priv, qid);
+       struct quota_info *dqopt = sb_dqopt(sb);
+       int ret;
+
+       down_read(&dqopt->dqio_sem);
+       ret = qtree_get_next_id(sb_dqinfo(sb, qid->type)->dqi_priv, qid);
+       up_read(&dqopt->dqio_sem);
+       return ret;
 }
 
 static const struct quota_format_ops v2_format_ops = {