Skip to content

Commit

Permalink
nvmet-fc: free queue and assoc directly
Browse files Browse the repository at this point in the history
Neither struct nvmet_fc_tgt_queue nor struct nvmet_fc_tgt_assoc are data
structure which are used in a RCU context. So there is no reason to
delay the free operation.

Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
  • Loading branch information
Daniel Wagner authored and Keith Busch committed Feb 1, 2024
1 parent 4049dc9 commit c5e27b1
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/nvme/target/fc.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ struct nvmet_fc_tgt_queue {
struct list_head avail_defer_list;
struct workqueue_struct *work_q;
struct kref ref;
struct rcu_head rcu;
/* array of fcp_iods */
struct nvmet_fc_fcp_iod fod[] __counted_by(sqsize);
} __aligned(sizeof(unsigned long long));
Expand All @@ -169,7 +168,6 @@ struct nvmet_fc_tgt_assoc {
struct nvmet_fc_tgt_queue *queues[NVMET_NR_QUEUES + 1];
struct kref ref;
struct work_struct del_work;
struct rcu_head rcu;
};


Expand Down Expand Up @@ -852,7 +850,7 @@ nvmet_fc_tgt_queue_free(struct kref *ref)

destroy_workqueue(queue->work_q);

kfree_rcu(queue, rcu);
kfree(queue);
}

static void
Expand Down Expand Up @@ -1185,8 +1183,8 @@ nvmet_fc_target_assoc_free(struct kref *ref)
dev_info(tgtport->dev,
"{%d:%d} Association freed\n",
tgtport->fc_target_port.port_num, assoc->a_id);
kfree_rcu(assoc, rcu);
nvmet_fc_tgtport_put(tgtport);
kfree(assoc);
}

static void
Expand Down

0 comments on commit c5e27b1

Please sign in to comment.