Commit 0dfb992e authored by James Smart's avatar James Smart Committed by Jens Axboe
Browse files

nvmet-fc: perform small cleanups on unneeded checks



While code reviewing saw a couple of items that can be cleaned up:
- In nvmet_fc_delete_target_queue(), the routine unlocks, then checks
  and relocks.  Reorganize to avoid the unlock/relock.
- In nvmet_fc_delete_target_queue(), there's a check on the disconnect
  state that is unnecessary as the routine validates the state before
  starting any action.

Signed-off-by: default avatarJames Smart <jsmart2021@gmail.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent a5c2b4f6
Loading
Loading
Loading
Loading
+5 −8
Original line number Diff line number Diff line
@@ -677,7 +677,7 @@ nvmet_fc_delete_target_queue(struct nvmet_fc_tgt_queue *queue)
	struct nvmet_fc_fcp_iod *fod = queue->fod;
	struct nvmet_fc_defer_fcp_req *deferfcp, *tempptr;
	unsigned long flags;
	int i, writedataactive;
	int i;
	bool disconnect;

	disconnect = atomic_xchg(&queue->connected, 0);
@@ -688,20 +688,18 @@ nvmet_fc_delete_target_queue(struct nvmet_fc_tgt_queue *queue)
		if (fod->active) {
			spin_lock(&fod->flock);
			fod->abort = true;
			writedataactive = fod->writedataactive;
			spin_unlock(&fod->flock);
			/*
			 * only call lldd abort routine if waiting for
			 * writedata. other outstanding ops should finish
			 * on their own.
			 */
			if (writedataactive) {
				spin_lock(&fod->flock);
			if (fod->writedataactive) {
				fod->aborted = true;
				spin_unlock(&fod->flock);
				tgtport->ops->fcp_abort(
					&tgtport->fc_target_port, fod->fcpreq);
			}
			} else
				spin_unlock(&fod->flock);
		}
	}

@@ -741,7 +739,6 @@ nvmet_fc_delete_target_queue(struct nvmet_fc_tgt_queue *queue)

	flush_workqueue(queue->work_q);

	if (disconnect)
	nvmet_sq_destroy(&queue->nvme_sq);

	nvmet_fc_tgt_q_put(queue);