smb: smbdirect: move fs/smb/common/smbdirect/ to fs/smb/smbdirect/
Subsystems (8)
Stefan Metzmacher
reviewerPATCH 1/1 smb: smbdirect: move fs/smb/common/smbdirect/ to fs/smb/smbdirect/
This also removes the smbdirect_ prefix from the files.
---
MAINTAINERS | 2 +-
fs/smb/Kconfig | 2 +-
fs/smb/Makefile | 1 +
fs/smb/client/Kconfig | 2 +-
fs/smb/client/smbdirect.c | 2 +-
fs/smb/client/smbdirect.h | 2 +-
fs/smb/common/Makefile | 1 -
fs/smb/common/smbdirect/Makefile | 18 ------------------
fs/smb/server/Kconfig | 2 +-
fs/smb/server/transport_rdma.c | 2 +-
fs/smb/server/transport_rdma.h | 2 +-
fs/smb/{common => }/smbdirect/Kconfig | 2 +-
fs/smb/smbdirect/Makefile | 18 ++++++++++++++++++
.../smbdirect_accept.c => smbdirect/accept.c} | 4 ++--
.../connect.c} | 4 ++--
.../connection.c} | 2 +-
.../smbdirect_debug.c => smbdirect/debug.c} | 2 +-
.../devices.c} | 2 +-
.../internal.h} | 6 +++---
.../smbdirect_listen.c => smbdirect/listen.c} | 2 +-
.../smbdirect_main.c => smbdirect/main.c} | 2 +-
.../smbdirect_mr.c => smbdirect/mr.c} | 2 +-
.../smbdirect_pdu.h => smbdirect/pdu.h} | 0
.../smbdirect_public.h => smbdirect/public.h} | 0
.../smbdirect_rw.c => smbdirect/rw.c} | 2 +-
fs/smb/{common => }/smbdirect/smbdirect.h | 0
.../smbdirect_socket.c => smbdirect/socket.c} | 2 +-
.../smbdirect_socket.h => smbdirect/socket.h} | 0
28 files changed, 43 insertions(+), 43 deletions(-)
delete mode 100644 fs/smb/common/smbdirect/Makefile
rename fs/smb/{common => }/smbdirect/Kconfig (86%)
create mode 100644 fs/smb/smbdirect/Makefile
rename fs/smb/{common/smbdirect/smbdirect_accept.c => smbdirect/accept.c} (99%)
rename fs/smb/{common/smbdirect/smbdirect_connect.c => smbdirect/connect.c} (99%)
rename fs/smb/{common/smbdirect/smbdirect_connection.c => smbdirect/connection.c} (99%)
rename fs/smb/{common/smbdirect/smbdirect_debug.c => smbdirect/debug.c} (98%)
rename fs/smb/{common/smbdirect/smbdirect_devices.c => smbdirect/devices.c} (99%)
rename fs/smb/{common/smbdirect/smbdirect_internal.h => smbdirect/internal.h} (98%)
rename fs/smb/{common/smbdirect/smbdirect_listen.c => smbdirect/listen.c} (99%)
rename fs/smb/{common/smbdirect/smbdirect_main.c => smbdirect/main.c} (99%)
rename fs/smb/{common/smbdirect/smbdirect_mr.c => smbdirect/mr.c} (99%)
rename fs/smb/{common/smbdirect/smbdirect_pdu.h => smbdirect/pdu.h} (100%)
rename fs/smb/{common/smbdirect/smbdirect_public.h => smbdirect/public.h} (100%)
rename fs/smb/{common/smbdirect/smbdirect_rw.c => smbdirect/rw.c} (99%)
rename fs/smb/{common => }/smbdirect/smbdirect.h (100%)
rename fs/smb/{common/smbdirect/smbdirect_socket.c => smbdirect/socket.c} (99%)
rename fs/smb/{common/smbdirect/smbdirect_socket.h => smbdirect/socket.h} (100%)MAINTAINERS +1 -1
@@ -24613,7 +24613,7 @@ L: [email protected] L: [email protected] (moderated for non-subscribers) S: Maintained F: fs/smb/client/smbdirect.* -F: fs/smb/common/smbdirect/ +F: fs/smb/smbdirect/ F: fs/smb/server/transport_rdma.* SMC91x ETHERNET DRIVER
fs/smb/Kconfig +1 -1
@@ -4,7 +4,7 @@ source "fs/smb/client/Kconfig" source "fs/smb/server/Kconfig" -source "fs/smb/common/smbdirect/Kconfig" +source "fs/smb/smbdirect/Kconfig" config SMBFS tristate
fs/smb/Makefile +1 -0
@@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_SMBFS) += common/ +obj-$(CONFIG_SMBDIRECT) += smbdirect/ obj-$(CONFIG_CIFS) += client/ obj-$(CONFIG_SMB_SERVER) += server/
fs/smb/client/Kconfig +1 -1
@@ -182,7 +182,7 @@ config CIFS_SMB_DIRECT bool "SMB Direct support" depends on CIFS && INFINIBAND && INFINIBAND_ADDR_TRANS depends on CIFS=m || INFINIBAND=y - select SMB_COMMON_SMBDIRECT + select SMBDIRECT help Enables SMB Direct support for SMB 3.0, 3.02 and 3.1.1. SMB Direct allows transferring SMB packets over RDMA. If unsure,
fs/smb/client/smbdirect.c +1 -1
@@ -9,7 +9,7 @@#include "cifs_debug.h" #include "cifsproto.h" #include "smb2proto.h" -#include "../common/smbdirect/smbdirect_public.h" +#include "../smbdirect/public.h" /* Port numbers for SMBD transport */ #define SMB_PORT 445
fs/smb/client/smbdirect.h +1 -1
@@ -12,7 +12,7 @@#include "cifsglob.h" -#include "../common/smbdirect/smbdirect.h" +#include "../smbdirect/smbdirect.h" extern int rdma_readwrite_threshold;extern int smbd_max_frmr_depth;
fs/smb/common/Makefile +0 -1
@@ -4,4 +4,3 @@ # obj-$(CONFIG_SMBFS) += cifs_md4.o -obj-$(CONFIG_SMB_COMMON_SMBDIRECT) += smbdirect/
fs/smb/common/smbdirect/Makefile deleted +0 -18
@@ -1,18 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-or-later -# -# Makefile for smbdirect support -# - -obj-$(CONFIG_SMB_COMMON_SMBDIRECT) += smbdirect.o - -smbdirect-y := \ - smbdirect_socket.o \ - smbdirect_connection.o \ - smbdirect_mr.o \ - smbdirect_rw.o \ - smbdirect_debug.o \ - smbdirect_connect.o \ - smbdirect_listen.o \ - smbdirect_accept.o \ - smbdirect_devices.o \ - smbdirect_main.o
fs/smb/server/Kconfig +1 -1
@@ -49,7 +49,7 @@ config SMB_SERVER_SMBDIRECT bool "Support for SMB Direct protocol" depends on SMB_SERVER && INFINIBAND && INFINIBAND_ADDR_TRANS depends on SMB_SERVER=m || INFINIBAND=y - select SMB_COMMON_SMBDIRECT + select SMBDIRECT default n help
fs/smb/server/transport_rdma.c +1 -1
@@ -18,7 +18,7 @@#include "smb_common.h" #include "../common/smb2status.h" #include "transport_rdma.h" -#include "../common/smbdirect/smbdirect_public.h" +#include "../smbdirect/public.h" #define SMB_DIRECT_PORT_IWARP 5445
fs/smb/server/transport_rdma.h +1 -1
@@ -25,6 +25,6 @@ static inline void init_smbd_max_io_size(unsigned int sz) { }static inline unsigned int get_smbd_max_read_write_size (struct ksmbd_transport *kt) {return 0 ; }#endif -#include "../common/smbdirect/smbdirect.h" +#include "../smbdirect/smbdirect.h" #endif /* __KSMBD_TRANSPORT_RDMA_H__ */
fs/smb/smbdirect/Kconfig renamed from fs/smb/common/smbdirect/Kconfig +1 -1
@@ -2,7 +2,7 @@ # # smbdirect configuration -config SMB_COMMON_SMBDIRECT +config SMBDIRECT def_tristate n depends on INFINIBAND && INFINIBAND_ADDR_TRANS depends on m || INFINIBAND=y
fs/smb/smbdirect/Makefile new file +18 -0
@@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Makefile for smbdirect support +# + +obj-$(CONFIG_SMBDIRECT) += smbdirect.o + +smbdirect-y := \ + socket.o \ + connection.o \ + mr.o \ + rw.o \ + debug.o \ + connect.o \ + listen.o \ + accept.o \ + devices.o \ + main.o
fs/smb/smbdirect/accept.c renamed from fs/smb/common/smbdirect/smbdirect_accept.c +2 -2
@@ -5,9 +5,9 @@* Copyright (c) 2025, Stefan Metzmacher */ -#include "smbdirect_internal.h" +#include "internal.h" #include <net/sock.h> -#include "../../common/smb2status.h" +#include "../common/smb2status.h" static int smbdirect_accept_rdma_event_handler (struct rdma_cm_id *id,struct rdma_cm_event *event);
fs/smb/smbdirect/connect.c renamed from fs/smb/common/smbdirect/smbdirect_connect.c +2 -2
@@ -3,8 +3,8 @@* Copyright (c) 2012,2016,2017,2025 Stefan Metzmacher */ -#include "smbdirect_internal.h" -#include "../../common/smb2status.h" +#include "internal.h" +#include "../common/smb2status.h" static int smbdirect_connect_setup_connection (struct smbdirect_socket *sc); static int smbdirect_connect_resolve_addr(struct smbdirect_socket *sc,
fs/smb/smbdirect/connection.c renamed from fs/smb/common/smbdirect/smbdirect_connection.c +1 -1
@@ -4,7 +4,7 @@* Copyright (c) 2025, Stefan Metzmacher */ -#include "smbdirect_internal.h" +#include "internal.h" #include <linux/folio_queue.h> struct smbdirect_map_sges {
fs/smb/smbdirect/debug.c renamed from fs/smb/common/smbdirect/smbdirect_debug.c +1 -1
@@ -4,7 +4,7 @@* Copyright (c) 2025, Stefan Metzmacher */ -#include "smbdirect_internal.h" +#include "internal.h" #include <linux/seq_file.h> void smbdirect_connection_legacy_debug_proc_show(struct smbdirect_socket *sc,
fs/smb/smbdirect/devices.c renamed from fs/smb/common/smbdirect/smbdirect_devices.c +1 -1
@@ -5,7 +5,7 @@* Copyright (c) 2025 Stefan Metzmacher */ -#include "smbdirect_internal.h" +#include "internal.h" static u8 smbdirect_ib_device_rdma_capable_node_type (struct ib_device *ib_dev) {
fs/smb/smbdirect/internal.h renamed from fs/smb/common/smbdirect/smbdirect_internal.h +3 -3
@@ -9,8 +9,8 @@#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt#include "smbdirect.h" -#include "smbdirect_pdu.h" -#include "smbdirect_public.h" +#include "pdu.h" +#include "public.h" #include <linux/mutex.h>
@@ -34,7 +34,7 @@ struct smbdirect_module_state {extern struct smbdirect_module_state smbdirect_globals; -#include "smbdirect_socket.h" +#include "socket.h" struct smbdirect_device {struct list_head list;
fs/smb/smbdirect/listen.c renamed from fs/smb/common/smbdirect/smbdirect_listen.c +1 -1
@@ -5,7 +5,7 @@* Copyright (c) 2025, Stefan Metzmacher */ -#include "smbdirect_internal.h" +#include "internal.h" static int smbdirect_listen_rdma_event_handler (struct rdma_cm_id *id,struct rdma_cm_event *event);
fs/smb/smbdirect/main.c renamed from fs/smb/common/smbdirect/smbdirect_main.c +1 -1
@@ -3,7 +3,7 @@* Copyright (c) 2025, Stefan Metzmacher */ -#include "smbdirect_internal.h" +#include "internal.h" #include <linux/module.h> struct smbdirect_module_state smbdirect_globals = {
fs/smb/smbdirect/mr.c renamed from fs/smb/common/smbdirect/smbdirect_mr.c +1 -1
@@ -4,7 +4,7 @@* Copyright (c) 2025, Stefan Metzmacher */ -#include "smbdirect_internal.h" +#include "internal.h" /* * Allocate MRs used for RDMA read/write
fs/smb/smbdirect/pdu.h renamed from fs/smb/common/smbdirect/smbdirect_pdu.h +0 -0
fs/smb/smbdirect/public.h renamed from fs/smb/common/smbdirect/smbdirect_public.h +0 -0
fs/smb/smbdirect/rw.c renamed from fs/smb/common/smbdirect/smbdirect_rw.c +1 -1
@@ -5,7 +5,7 @@* Copyright (c) 2025, Stefan Metzmacher */ -#include "smbdirect_internal.h" +#include "internal.h" static int smbdirect_connection_wait_for_rw_credits (struct smbdirect_socket *sc,int credits)
fs/smb/smbdirect/smbdirect.h renamed from fs/smb/common/smbdirect/smbdirect.h +0 -0
fs/smb/smbdirect/socket.c renamed from fs/smb/common/smbdirect/smbdirect_socket.c +1 -1
@@ -4,7 +4,7 @@* Copyright (c) 2025, Stefan Metzmacher */ -#include "smbdirect_internal.h" +#include "internal.h" bool smbdirect_frwr_is_supported (const struct ib_device_attr *attrs) {
fs/smb/smbdirect/socket.h renamed from fs/smb/common/smbdirect/smbdirect_socket.h +0 -0
Signature · 1 line
2.43.0
fs/smb/Makefile line 4
Quoted 9 lines
fs/smb/Makefile +1
-0@@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_SMBFS) += common/ +obj-$(CONFIG_SMBDIRECT) += smbdirect/
Why is this not in net/smbdirect/ or driver/infiniband/ulp/smdirect?
As far as I can tell there is zero file system logic in this code.
fs/smb/Makefile line 5
Quoted 2 lines
fs/smb/Makefile +1
-1-#include "../common/smbdirect/smbdirect_public.h" +#include "../smbdirect/public.h"
And all these relative includes suggest you really want a include/linux/smdirect/ instead.
While we're at it: __SMBDIRECT_EXPORT_SYMBOL__ is really odd. One thing is the __ pre- and postfix that make it look weird.
The other is that EXPORT_SYMBOL_FOR_MODULES is for very specific symbols that really should not exported. What this warrants instead is a normal EXPORT_SYMBOL_NS_GPL.
Stefan Metzmacher
reviewerHi Christoph,
Quoted 11 lines
fs/smb/Makefile line 4
Quoted 9 lines
fs/smb/Makefile +1
-0@@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_SMBFS) += common/ +obj-$(CONFIG_SMBDIRECT) += smbdirect/Why is this not in
net/smbdirect/or driver/infiniband/ulp/smdirect?
Yes, I also thought about net/smbdirect.
As IPPROTO_SMBDIRECT or PF_SMBDIRECT will be the next step, see the open discussion here:
https://lore.kernel.org/linux-cifs/[email protected]/
(I'll follow with that discussion soon)
I was just unsure about the consequences, e.g. would the maintainer/pull request flow have to change in that case? Or would Steve be able to take the changes via his trees? Any I also didn't want to offend anybody, so I just took what Linus proposed.
Using driver/infiniband/ulp/smdirect would also work, if everybody prefer that.
Quoted 7 lines
As far as I can tell there is zero file system logic in this code.
fs/smb/Makefile line 5
Quoted 2 lines
fs/smb/Makefile +1
-1-#include "../common/smbdirect/smbdirect_public.h" +#include "../smbdirect/public.h"And all these relative includes suggest you really want a
include/linux/smdirect/instead.
Yes, that's my also my goal in the next steps.
Quoted 2 lines
While we're at it:
__SMBDIRECT_EXPORT_SYMBOL__is really odd. One thing is the __ pre- and postfix that make it look weird.
Yes, the __SMBDIRECT_EXPORT_SYMBOL__ was mainly a temporary thing, now it's useless and I'll remove it.
Quoted 3 lines
The other is that
EXPORT_SYMBOL_FOR_MODULESis for very specific symbols that really should not exported. What this warrants instead is a normalEXPORT_SYMBOL_NS_GPL.
I want the exported functions be minimal, as most of of should go via the socket layer instead.
If EXPORT_SYMBOL_NS_GPL(func, "smbdirect") is better than EXPORT_SYMBOL_FOR_MODULES() I can change that.
It means cifs.ko and ksmbd.ko would need MODULE_IMPORT_NS("smbdirect"), correct?
Thanks!
metze
Quoted 10 lines · Stefan Metzmacher
Hi Christoph,
Quoted 7 lines
Quoted 7 lines
fs/smb/Makefile +0
-0@@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0
Quoted 6 lines
Quoted 4 lines
fs/smb/Makefile line 4
Quoted 2 lines
fs/smb/Makefile +1
-0obj-$(CONFIG_SMBFS) += common/ +obj-$(CONFIG_SMBDIRECT) += smbdirect/Why is this not in
net/smbdirect/or driver/infiniband/ulp/smdirect?Yes, I also thought about net/smbdirect.
I would prefer to leave it in fs/smb for the time being, since it makes it easier to track since fs/smb/server and fs/smb/client have dependencies
on it. In the long run, I don't mind moving it, if it starts being
used outside
of smb client and server.
Quoted 44 lines
As
IPPROTO_SMBDIRECTorPF_SMBDIRECTwill be the next step, see the open discussion here:
https://lore.kernel.org/linux-cifs/[email protected]/
(I'll follow with that discussion soon)I was just unsure about the consequences, e.g. would the maintainer/pull request flow have to change in that case? Or would Steve be able to take the changes via his trees? Any I also didn't want to offend anybody, so I just took what Linus proposed.
Using driver/infiniband/ulp/smdirect would also work, if everybody prefer that.
Quoted 7 lines
As far as I can tell there is zero file system logic in this code.
fs/smb/Makefile line 5
Quoted 2 lines
fs/smb/Makefile +1
-1-#include "../common/smbdirect/smbdirect_public.h" +#include "../smbdirect/public.h"And all these relative includes suggest you really want a
include/linux/smdirect/instead.Yes, that's my also my goal in the next steps.
Quoted 2 lines
While we're at it:
__SMBDIRECT_EXPORT_SYMBOL__is really odd. One thing is the __ pre- and postfix that make it look weird.Yes, the
__SMBDIRECT_EXPORT_SYMBOL__was mainly a temporary thing, now it's useless and I'll remove it.Quoted 3 lines
The other is that
EXPORT_SYMBOL_FOR_MODULESis for very specific symbols that really should not exported. What this warrants instead is a normalEXPORT_SYMBOL_NS_GPL.I want the exported functions be minimal, as most of of should go via the socket layer instead.
If
EXPORT_SYMBOL_NS_GPL(func, "smbdirect")is better thanEXPORT_SYMBOL_FOR_MODULES()I can change that.It means cifs.ko and ksmbd.ko would need
MODULE_IMPORT_NS("smbdirect"), correct?Thanks!
metze
Signature · 3 lines
Thanks, Steve
Paulo Alcantara
maintainerQuoted 16 lines · Steve French
Quoted 15 lines · Stefan Metzmacher
Hi Christoph,
Quoted 11 lines
fs/smb/Makefile line 4
Quoted 9 lines
fs/smb/Makefile +1
-0@@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_SMBFS) += common/ +obj-$(CONFIG_SMBDIRECT) += smbdirect/Why is this not in
net/smbdirect/or driver/infiniband/ulp/smdirect?
Quoted 7 lines
Quoted 1 line
Yes, I also thought about net/smbdirect.
I would prefer to leave it in fs/smb for the time being, since it makes it easier to track since
fs/smb/serverandfs/smb/clienthave dependencies
on it. In the long run, I don't mind moving it, if it starts being
used outside
of smb client and server.
Please let's not break backporting any further. Decide where it will end up at once. We don't want the "fs/cifs -> fs/smb/client" history all over again.
Won't samba be using it? If so, you could consider an user outside fs/smb/{client,server} and then leave it in net/ instead, as hch suggested.
Quoted 11 lines · Steve French
Quoted 4 lines · Stefan Metzmacher
Quoted 2 lines
Why is this not in
net/smbdirect/or driver/infiniband/ulp/smdirect?Yes, I also thought about net/smbdirect.
I would prefer to leave it in fs/smb for the time being, since it makes it easier to track since
fs/smb/serverandfs/smb/clienthave dependencies
on it. In the long run, I don't mind moving it, if it starts being
used outside of smb client and server.
I personally have no hugely strong opinions, but I think Christophs very question that gives two different alternative locations argues for just leaving it in fs/smb/
That driver/infiniband/ulp/smdirect location in particular is just a disgusting path.
It sure as hell is *not* a driver, it just uses the rdma infrastructure.
If rdma were to eventually itself split itself up into the driver code and non-driver code (like networking does), that might change things, but that's not happening now.
And as long as we expect smbdirect code to go through the smb maintainer, I'd rather have the location be about that clear situation rather than some arbitrary "it uses the rdma code" or "it's networking".
Because that code is not primarily about networking or about rdma. That code is primarily about smb.
So while I have no *strong* opinions and can deal with whatever maintainers find convenient, I think fs/smb/smbdirect is at least currently the sane location.
Linus
Quoted 8 lines · Stefan Metzmacher
Quoted 1 line
Why is this not in
net/smbdirect/or driver/infiniband/ulp/smdirect?Yes, I also thought about net/smbdirect.
As
IPPROTO_SMBDIRECTorPF_SMBDIRECTwill be the next step, see the open discussion here:
https://lore.kernel.org/linux-cifs/[email protected]/
(I'll follow with that discussion soon)
Seems like it is the right fit then.
Quoted 5 lines
I was just unsure about the consequences, e.g. would the maintainer/pull request flow have to change in that case? Or would Steve be able to take the changes via his trees? Any I also didn't want to offend anybody, so I just took what Linus proposed.
You might want to ask the sunrpc or ceph maintainers as they have a similar split.
Quoted 13 lines · Stefan Metzmacher
This also removes the
smbdirect_prefix from the files.Suggested-by Linus Torvalds <[email protected]>Link https://lore.kernel.org/linux-cifs/CAHk-=whmue3PVi88K0UZLZO0at22QhQZ-yu+qO2TOKyZpGqecw@mail.gmail.com/ open hereCc Steve French <[email protected]>Cc Tom Talpey <[email protected]>Cc Long Li <[email protected]>Cc Namjae Jeon <[email protected]>Cc Linus Torvalds <[email protected]>Signed-off-by Stefan Metzmacher <[email protected]>
I also prefer to leave it in fs/smb, and I completely agree with Linus's opinion.
Thanks!