mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-04 04:06:26 +00:00
nfs/localio: eliminate unnecessary kref in nfs_local_fsync_ctx
nfs_local_commit() doesn't need async cleanup of nfs_local_fsync_ctx, so there is no need to use a kref. Signed-off-by: Mike Snitzer <snitzer@kernel.org> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
This commit is contained in:
parent
fb4e525da1
commit
894f5c5593
@ -42,7 +42,6 @@ struct nfs_local_fsync_ctx {
|
||||
struct nfsd_file *localio;
|
||||
struct nfs_commit_data *data;
|
||||
struct work_struct work;
|
||||
struct kref kref;
|
||||
struct completion *done;
|
||||
};
|
||||
static void nfs_local_fsync_work(struct work_struct *work);
|
||||
@ -683,30 +682,17 @@ nfs_local_fsync_ctx_alloc(struct nfs_commit_data *data,
|
||||
ctx->localio = localio;
|
||||
ctx->data = data;
|
||||
INIT_WORK(&ctx->work, nfs_local_fsync_work);
|
||||
kref_init(&ctx->kref);
|
||||
ctx->done = NULL;
|
||||
}
|
||||
return ctx;
|
||||
}
|
||||
|
||||
static void
|
||||
nfs_local_fsync_ctx_kref_free(struct kref *kref)
|
||||
{
|
||||
kfree(container_of(kref, struct nfs_local_fsync_ctx, kref));
|
||||
}
|
||||
|
||||
static void
|
||||
nfs_local_fsync_ctx_put(struct nfs_local_fsync_ctx *ctx)
|
||||
{
|
||||
kref_put(&ctx->kref, nfs_local_fsync_ctx_kref_free);
|
||||
}
|
||||
|
||||
static void
|
||||
nfs_local_fsync_ctx_free(struct nfs_local_fsync_ctx *ctx)
|
||||
{
|
||||
nfs_local_release_commit_data(ctx->localio, ctx->data,
|
||||
ctx->data->task.tk_ops);
|
||||
nfs_local_fsync_ctx_put(ctx);
|
||||
kfree(ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -739,7 +725,7 @@ int nfs_local_commit(struct nfsd_file *localio,
|
||||
}
|
||||
|
||||
nfs_local_init_commit(data, call_ops);
|
||||
kref_get(&ctx->kref);
|
||||
|
||||
if (how & FLUSH_SYNC) {
|
||||
DECLARE_COMPLETION_ONSTACK(done);
|
||||
ctx->done = &done;
|
||||
@ -747,6 +733,6 @@ int nfs_local_commit(struct nfsd_file *localio,
|
||||
wait_for_completion(&done);
|
||||
} else
|
||||
queue_work(nfsiod_workqueue, &ctx->work);
|
||||
nfs_local_fsync_ctx_put(ctx);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user