nvme: move sysfs code to a dedicated sysfs.c file
PATCH v2 1/1 nvme: move sysfs code to a dedicated sysfs.c file
The core.c file became long and hard to maintain. Create a dedicated file to centralize the sysfs functionality. This is a common practice to separate sysfs/configfs related logic from the main driver logic .c file. For example, in the nvmet module the configfs interface has its own dedicated file.
This patch does not include any functional changes.
---
changes from v1:
- rephrase the title from "nvme: add a dedicated .c file for sysfs interface" (Sagi)
- add Reviewed-by signature from Keith
changes from RFC:
- Removed RCF tag
- updated copyrights mistake
- fix License copy/paste bug (Sagi)
--- drivers/nvme/host/Makefile | 2 +- drivers/nvme/host/core.c | 650 +----------------------------------- drivers/nvme/host/nvme.h | 4 + drivers/nvme/host/sysfs.c | 655 +++++++++++++++++++++++++++++++++++++ 4 files changed, 662 insertions(+), 649 deletions(-) create mode 100644 drivers/nvme/host/sysfs.c
drivers/nvme/host/Makefile +1 -1
@@ -10,7 +10,7 @@ obj-$(CONFIG_NVME_FC) += nvme-fc.o obj-$(CONFIG_NVME_TCP) += nvme-tcp.o obj-$(CONFIG_NVME_APPLE) += nvme-apple.o -nvme-core-y += core.o ioctl.o +nvme-core-y += core.o ioctl.o sysfs.o nvme-core-$(CONFIG_NVME_VERBOSE_ERRORS) += constants.o nvme-core-$(CONFIG_TRACING) += trace.o nvme-core-$(CONFIG_NVME_MULTIPATH) += multipath.o
drivers/nvme/host/core.c +2 -648
674 lines not on this page · raw message
drivers/nvme/host/nvme.h +4 -0
@@ -860,7 +860,11 @@ extern const struct attribute_group *nvme_ns_id_attr_groups[];extern const struct pr_ops nvme_pr_ops;extern const struct block_device_operations nvme_ns_head_ops;extern const struct attribute_group nvme_dev_attrs_group; +extern const struct attribute_group *nvme_subsys_attrs_groups[]; +extern const struct attribute_group *nvme_dev_attr_groups[]; +extern const struct block_device_operations nvme_bdev_ops; +void nvme_delete_ctrl_sync (struct nvme_ctrl *ctrl);struct nvme_ns *nvme_find_path (struct nvme_ns_head *head);#ifdef CONFIG_NVME_MULTIPATH static inline bool nvme_ctrl_use_ana (struct nvme_ctrl *ctrl)
drivers/nvme/host/sysfs.c new file +655 -0
655 lines not on this page · raw message
Signature · 1 line
2.18.1
Quoted 7 lines · Max Gurtovoy
The
core.cfile became long and hard to maintain. Create a dedicated file to centralize the sysfs functionality. This is a common practice to separate sysfs/configfs related logic from the main driver logic .c file. For example, in the nvmet module the configfs interface has its own dedicated file.This patch does not include any functional changes.
Signature · 1 line
Jens Axboe
Hi Christoph,
Quoted 11 lines · Jens Axboe
Quoted 7 lines · Max Gurtovoy
The
core.cfile became long and hard to maintain. Create a dedicated file to centralize the sysfs functionality. This is a common practice to separate sysfs/configfs related logic from the main driver logic .c file. For example, in the nvmet module the configfs interface has its own dedicated file.This patch does not include any functional changes.
Reviewed-by Jens Axboe <[email protected]>
Is there a chance to merge this for the next round of nvme PR ? We have pretty good agreement for this patch :)
Quoted 21 lines · Max Gurtovoy
The
core.cfile became long and hard to maintain. Create a dedicated file to centralize the sysfs functionality. This is a common practice to separate sysfs/configfs related logic from the main driver logic .c file. For example, in the nvmet module the configfs interface has its own dedicated file.This patch does not include any functional changes.
Reviewed-by Keith Busch <[email protected]>Signed-off-by Max Gurtovoy <[email protected]>---
changes from v1:
- rephrase the title from "nvme: add a dedicated .c file for sysfs interface" (Sagi)
- add Reviewed-by signature from Keithchanges from RFC:
- Removed RCF tag
- updated copyrights mistake
- fix License copy/paste bug (Sagi)
Quoted 8 lines
--- drivers/nvme/host/Makefile | 2 +- drivers/nvme/host/core.c | 650 +----------------------------------- drivers/nvme/host/nvme.h | 4 + drivers/nvme/host/sysfs.c | 655 +++++++++++++++++++++++++++++++++++++ 4 files changed, 662 insertions(+), 649 deletions(-)create mode 100644
drivers/nvme/host/sysfs.c
Cheers,
Hannes
Looks good:
Keith Busch
maintainerQuoted 7 lines · Max Gurtovoy
The
core.cfile became long and hard to maintain. Create a dedicated file to centralize the sysfs functionality. This is a common practice to separate sysfs/configfs related logic from the main driver logic .c file. For example, in the nvmet module the configfs interface has its own dedicated file.This patch does not include any functional changes.
Thanks, I applied this for 6.5 with a couple minor changes:
I merged Chaitanya's dhchap memory leak fixes first, which touched some of this sysfs code, so I simply used the the result when moving the code to the new file.
I also added an 'include <linux/nvme-auth.h>' in the new sysfs.c file for when CONFIG_NVME_AUTH=y.
Hi Keith,
Quoted 9 lines · Keith Busch
Quoted 7 lines · Max Gurtovoy
The
core.cfile became long and hard to maintain. Create a dedicated file to centralize the sysfs functionality. This is a common practice to separate sysfs/configfs related logic from the main driver logic .c file. For example, in the nvmet module the configfs interface has its own dedicated file.This patch does not include any functional changes.
Quoted 8 lines
Thanks, I applied this for 6.5 with a couple minor changes:
I merged Chaitanya's dhchap memory leak fixes first, which touched some of this sysfs code, so I simply used the the result when moving the code to the new file.
I also added an 'include <
linux/nvme-auth.h>' in the newsysfs.cfile for whenCONFIG_NVME_AUTH=y.
Sound good.
Thanks.