Skip to contentSkip to conversation

nvmet: nvme_excute_get_feat() cleanup

PATCH Applied Chaitanya Kulkarni 3 participants 7 messages Mar 9, 2022 – Mar 15, 2022

Subsystems (2)
lore
Share & tools
lore
author maintainer
#2 lore raw

PATCH 2/2 nvmet: open code nvmet_get_feat_kato()

In reply to Chaitanya Kulkarni

Just like we have open coded NVME_FEAT_HOST_ID handling, open code one liner function nvmet_get_feat_kato() for NVME_FEAT_KATO.

---
 drivers/nvme/target/admin-cmd.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/nvme/target/admin-cmd.c +1 -6
index e034ced953a3..50db5dfc1929 100644
@@ -889,11 +889,6 @@ static u16 nvmet_get_feat_write_protect(struct nvmet_req *req)
 	return 0;
 }
 
-void nvmet_get_feat_kato(struct nvmet_req *req)
-{
-	nvmet_set_result(req, req->sq->ctrl->kato * 1000);
-}
-
 void nvmet_execute_get_features(struct nvmet_req *req)
 {
 	struct nvmet_subsys *subsys = nvmet_req_subsys(req);
@@ -936,7 +931,7 @@ void nvmet_execute_get_features(struct nvmet_req *req)
 			(subsys->max_qid-1) | ((subsys->max_qid-1) << 16));
 		break;
 	case NVME_FEAT_KATO:
-		nvmet_get_feat_kato(req);
+		nvmet_set_result(req, req->sq->ctrl->kato * 1000);
 		break;
 	case NVME_FEAT_HOST_ID:
 		/* need 128-bit host identifier flag */
Signature · 1 line
2.29.0

Chaitanya Kulkarni

author maintainer
#0 lore raw

cover nvmet: nvme_excute_get_feat() cleanup

Hi,

Just open code get feature functions which has only one caller and one line.

-ck

Chaitanya Kulkarni (2):
nvmet: open code nvmet_get_feat_async_event()
nvmet: open code nvmet_get_feat_kato()

 drivers/nvme/target/admin-cmd.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)
Signature · 1 line
2.29.0
author maintainer
#1 lore raw

PATCH 1/2 nvmet: open code nvmet_get_feat_async_event()

Just like we have open coded NVME_FEAT_HOST_ID handling, open code one liner function nvmet_get_feat_async_event() for NVME_FEAT_ASYNC_EVENT.

---
 drivers/nvme/target/admin-cmd.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/nvme/target/admin-cmd.c +1 -6
index 6fb24746de06..e034ced953a3 100644
@@ -894,11 +894,6 @@ void nvmet_get_feat_kato(struct nvmet_req *req)
 	nvmet_set_result(req, req->sq->ctrl->kato * 1000);
 }
 
-void nvmet_get_feat_async_event(struct nvmet_req *req)
-{
-	nvmet_set_result(req, READ_ONCE(req->sq->ctrl->aen_enabled));
-}
-
 void nvmet_execute_get_features(struct nvmet_req *req)
 {
 	struct nvmet_subsys *subsys = nvmet_req_subsys(req);
@@ -931,7 +926,7 @@ void nvmet_execute_get_features(struct nvmet_req *req)
 		break;
 #endif
 	case NVME_FEAT_ASYNC_EVENT:
-		nvmet_get_feat_async_event(req);
+		nvmet_set_result(req, READ_ONCE(req->sq->ctrl->aen_enabled));
 		break;
 	case NVME_FEAT_VOLATILE_WC:
 		nvmet_set_result(req, 1);
Signature · 1 line
2.29.0
#4 lore raw
Quoted 4 lines · Christoph Hellwig

Thanks,

applied to nvme-5.18.

When I pulled the changes today it didn't show this patch-series, git HEAD is pointing to

"nvmet: use snprintf() with PAGE_SIZE in configfs" :-

nvme (nvme-5.18) # gitpulltheirs
warning: Pulling without specifying how to reconcile divergent branches is discouraged. You can squelch this message by running one of the following commands sometime before your next pull:

   git config pull.rebase false  # merge (the default strategy)
   git config pull.rebase true   # rebase
   git config pull.ff only       # fast-forward only

You can replace "git config" with "git config --global" to set a default preference for all repositories. You can also pass --rebase, --no-rebase, or --ff-only on the command line to override the configured default per invocation.

Already up to date.
nvme (nvme-5.18) # gitlog -3
1720007a91d9 (HEAD -> nvme-5.18) Merge branch 'nvme-5.18' of
git://git.infradead.org/nvme into nvme-5.18
98152eb70fff (origin/nvme-5.18) nvmet: use snprintf() with PAGE_SIZE in configfs
73d77c53ff34 nvmet: don't fold lines
nvme (nvme-5.18) # git log -3
commit 1720007a91d9146d537da662e3ce53e656b4850a (HEAD -> nvme-5.18)
Merge: ec7daf016113 98152eb70fff
Author: Chaitanya Kulkarni <[email protected]>
Date: Mon Mar 14 15:51:27 2022 -0700

     Merge branch 'nvme-5.18' of git://git.infradead.org/nvme into nvme-5.18

commit 98152eb70fffad910ee7c511b110afe98f162fc5 (origin/nvme-5.18)

Author: Chaitanya Kulkarni <[email protected]>
Date:   Tue Mar 8 14:56:58 2022 -0800

nvmet: use snprintf() with PAGE_SIZE in configfs

Instead of using sprintf, use snprintf with buffer size limited to PAGE_SIZE just like what we have for the rest of the file.

commit 73d77c53ff342bfa23daedf4475cdd06618e447b

Author: Chaitanya Kulkarni <[email protected]>
Date:   Tue Mar 8 14:56:57 2022 -0800

nvmet: don't fold lines

Don't fold line that can fit into 80 char limit. No functional change in this patch.

nvme (nvme-5.18) #

#6 lore raw
In reply to Christoph Hellwig

Christoph,

Quoted 4 lines · Christoph Hellwig

Thanks,

applied to nvme-5.18.

Please revert this series I've made a mistake when sending this series that is breaking the build, will send out a right one later.

Sorry for the inconvenience.

-ck