git: a9bd22814f68 - main - Remove pointless lun->be_lun checks.

Alexander Motin mav at FreeBSD.org
Fri Feb 26 00:48:07 UTC 2021


The branch main has been updated by mav:

URL: https://cgit.FreeBSD.org/src/commit/?id=a9bd22814f680ce87259d56155204f9294e684ce

commit a9bd22814f680ce87259d56155204f9294e684ce
Author:     Alexander Motin <mav at FreeBSD.org>
AuthorDate: 2021-02-26 00:45:59 +0000
Commit:     Alexander Motin <mav at FreeBSD.org>
CommitDate: 2021-02-26 00:48:03 +0000

    Remove pointless lun->be_lun checks.
    
    There is no such thing as LUN without backend, at least for years.
    
    MFC after:      1 week
---
 sys/cam/ctl/ctl.c           | 13 +++++--------
 sys/cam/ctl/ctl_tpc.c       |  6 +++---
 sys/cam/ctl/ctl_tpc_local.c |  6 +++---
 3 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c
index 9a9ae70c2173..18a82ca72d76 100644
--- a/sys/cam/ctl/ctl.c
+++ b/sys/cam/ctl/ctl.c
@@ -11022,16 +11022,15 @@ ctl_check_for_blockage(struct ctl_lun *lun, union ctl_io *pending_io,
 		return (CTL_ACTION_BLOCK);
 	case CTL_SER_EXTENT:
 		return (ctl_extent_check(ooa_io, pending_io,
-		    (lun->be_lun && lun->be_lun->serseq == CTL_LUN_SERSEQ_ON)));
+		    (lun->be_lun->serseq == CTL_LUN_SERSEQ_ON)));
 	case CTL_SER_EXTENTOPT:
 		if ((lun->MODE_CTRL.queue_flags & SCP_QUEUE_ALG_MASK) !=
 		    SCP_QUEUE_ALG_UNRESTRICTED)
 			return (ctl_extent_check(ooa_io, pending_io,
-			    (lun->be_lun &&
-			     lun->be_lun->serseq == CTL_LUN_SERSEQ_ON)));
+			    (lun->be_lun->serseq == CTL_LUN_SERSEQ_ON)));
 		return (CTL_ACTION_PASS);
 	case CTL_SER_EXTENTSEQ:
-		if (lun->be_lun && lun->be_lun->serseq != CTL_LUN_SERSEQ_OFF)
+		if (lun->be_lun->serseq != CTL_LUN_SERSEQ_OFF)
 			return (ctl_extent_check_seq(ooa_io, pending_io));
 		return (CTL_ACTION_PASS);
 	case CTL_SER_PASS:
@@ -11273,8 +11272,7 @@ ctl_scsiio_lun_check(struct ctl_lun *lun,
 	}
 
 	if (entry->pattern & CTL_LUN_PAT_WRITE) {
-		if (lun->be_lun &&
-		    lun->be_lun->flags & CTL_LUN_FLAG_READONLY) {
+		if (lun->be_lun->flags & CTL_LUN_FLAG_READONLY) {
 			ctl_set_hw_write_protected(ctsio);
 			retval = 1;
 			goto bailout;
@@ -13303,8 +13301,7 @@ ctl_serseq_done(union ctl_io *io)
 {
 	struct ctl_lun *lun = CTL_LUN(io);
 
-	if (lun->be_lun == NULL ||
-	    lun->be_lun->serseq == CTL_LUN_SERSEQ_OFF)
+	if (lun->be_lun->serseq == CTL_LUN_SERSEQ_OFF)
 		return;
 	mtx_lock(&lun->lun_lock);
 	io->io_hdr.flags |= CTL_FLAG_SERSEQ_DONE;
diff --git a/sys/cam/ctl/ctl_tpc.c b/sys/cam/ctl/ctl_tpc.c
index 5e6cb09760a7..de9e97b87a3e 100644
--- a/sys/cam/ctl/ctl_tpc.c
+++ b/sys/cam/ctl/ctl_tpc.c
@@ -759,12 +759,12 @@ tpc_resolve(struct tpc_list *list, uint16_t idx, uint32_t *ss,
 {
 
 	if (idx == 0xffff) {
-		if (ss && list->lun->be_lun)
+		if (ss)
 			*ss = list->lun->be_lun->blocksize;
-		if (pb && list->lun->be_lun)
+		if (pb)
 			*pb = list->lun->be_lun->blocksize <<
 			    list->lun->be_lun->pblockexp;
-		if (pbo && list->lun->be_lun)
+		if (pbo)
 			*pbo = list->lun->be_lun->blocksize *
 			    list->lun->be_lun->pblockoff;
 		return (list->lun->lun);
diff --git a/sys/cam/ctl/ctl_tpc_local.c b/sys/cam/ctl/ctl_tpc_local.c
index 9b2c85ac8173..ba6deada86a3 100644
--- a/sys/cam/ctl/ctl_tpc_local.c
+++ b/sys/cam/ctl/ctl_tpc_local.c
@@ -294,12 +294,12 @@ tpcl_resolve(struct ctl_softc *softc, int init_port,
 		    lun->lun_devid->len, &cscdid->codeset,
 		    cscdid->length + 4) == 0) {
 			lunid = lun->lun;
-			if (ss && lun->be_lun)
+			if (ss)
 				*ss = lun->be_lun->blocksize;
-			if (ps && lun->be_lun)
+			if (ps)
 				*ps = lun->be_lun->blocksize <<
 				    lun->be_lun->pblockexp;
-			if (pso && lun->be_lun)
+			if (pso)
 				*pso = lun->be_lun->blocksize *
 				    lun->be_lun->pblockoff;
 			break;


More information about the dev-commits-src-all mailing list