Skip to content

Commit 894f5c5

Browse files
Mike SnitzerTrond Myklebust
authored andcommitted
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 <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
1 parent fb4e525 commit 894f5c5

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

fs/nfs/localio.c

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ struct nfs_local_fsync_ctx {
4242
struct nfsd_file *localio;
4343
struct nfs_commit_data *data;
4444
struct work_struct work;
45-
struct kref kref;
4645
struct completion *done;
4746
};
4847
static void nfs_local_fsync_work(struct work_struct *work);
@@ -683,30 +682,17 @@ nfs_local_fsync_ctx_alloc(struct nfs_commit_data *data,
683682
ctx->localio = localio;
684683
ctx->data = data;
685684
INIT_WORK(&ctx->work, nfs_local_fsync_work);
686-
kref_init(&ctx->kref);
687685
ctx->done = NULL;
688686
}
689687
return ctx;
690688
}
691689

692-
static void
693-
nfs_local_fsync_ctx_kref_free(struct kref *kref)
694-
{
695-
kfree(container_of(kref, struct nfs_local_fsync_ctx, kref));
696-
}
697-
698-
static void
699-
nfs_local_fsync_ctx_put(struct nfs_local_fsync_ctx *ctx)
700-
{
701-
kref_put(&ctx->kref, nfs_local_fsync_ctx_kref_free);
702-
}
703-
704690
static void
705691
nfs_local_fsync_ctx_free(struct nfs_local_fsync_ctx *ctx)
706692
{
707693
nfs_local_release_commit_data(ctx->localio, ctx->data,
708694
ctx->data->task.tk_ops);
709-
nfs_local_fsync_ctx_put(ctx);
695+
kfree(ctx);
710696
}
711697

712698
static void
@@ -739,14 +725,14 @@ int nfs_local_commit(struct nfsd_file *localio,
739725
}
740726

741727
nfs_local_init_commit(data, call_ops);
742-
kref_get(&ctx->kref);
728+
743729
if (how & FLUSH_SYNC) {
744730
DECLARE_COMPLETION_ONSTACK(done);
745731
ctx->done = &done;
746732
queue_work(nfsiod_workqueue, &ctx->work);
747733
wait_for_completion(&done);
748734
} else
749735
queue_work(nfsiod_workqueue, &ctx->work);
750-
nfs_local_fsync_ctx_put(ctx);
736+
751737
return 0;
752738
}

0 commit comments

Comments
 (0)