Skip to content

Commit

Permalink
quota: Push dqio_sem down to ->get_next_id()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
jankara committed Aug 17, 2017
1 parent b9a1a7f commit f14618c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 1 addition & 5 deletions fs/quota/dquot.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
8 changes: 7 additions & 1 deletion fs/quota/quota_v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit f14618c

Please sign in to comment.