[PATCH v5 07/12] cifs: Replace the writedata replay bool with a netfs sreq flag

From: David Howells
Date: Mon Feb 05 2024 - 17:59:59 EST


Replace the 'replay' bool in cifs_writedata (now cifs_io_subrequest) with a
flag in the netfs_io_subrequest flags.

Signed-off-by: David Howells <dhowells@xxxxxxxxxx>
cc: Steve French <sfrench@xxxxxxxxx>
cc: Shyam Prasad N <nspmangalore@xxxxxxxxx>
cc: Rohith Surabattula <rohiths.msft@xxxxxxxxx>
cc: Jeff Layton <jlayton@xxxxxxxxxx>
cc: linux-cifs@xxxxxxxxxxxxxxx
cc: netfs@xxxxxxxxxxxxxxx
cc: linux-fsdevel@xxxxxxxxxxxxxxx
cc: linux-mm@xxxxxxxxx
---
fs/smb/client/cifsglob.h | 1 -
fs/smb/client/file.c | 2 +-
fs/smb/client/smb2pdu.c | 4 ++--
include/linux/netfs.h | 1 +
4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/smb/client/cifsglob.h b/fs/smb/client/cifsglob.h
index dd0cef742a64..1dfed3eddaa2 100644
--- a/fs/smb/client/cifsglob.h
+++ b/fs/smb/client/cifsglob.h
@@ -1479,7 +1479,6 @@ struct cifs_io_subrequest {
unsigned int xid;
int result;
bool have_credits;
- bool replay;
struct kvec iov[2];
struct TCP_Server_Info *server;
#ifdef CONFIG_CIFS_SMB_DIRECT
diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c
index ce5f24206be0..14602ed6bc39 100644
--- a/fs/smb/client/file.c
+++ b/fs/smb/client/file.c
@@ -3645,7 +3645,7 @@ cifs_resend_wdata(struct cifs_io_subrequest *wdata, struct list_head *wdata_list
if (wdata->cfile->invalidHandle)
rc = -EAGAIN;
else {
- wdata->replay = true;
+ set_bit(NETFS_SREQ_RETRYING, &wdata->subreq.flags);
#ifdef CONFIG_CIFS_SMB_DIRECT
if (wdata->mr) {
wdata->mr->need_invalidate = true;
diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c
index 2ecc5f210329..84e3675eb41e 100644
--- a/fs/smb/client/smb2pdu.c
+++ b/fs/smb/client/smb2pdu.c
@@ -4797,7 +4797,7 @@ smb2_async_writev(struct cifs_io_subrequest *wdata)
struct cifs_io_parms *io_parms = NULL;
int credit_request;

- if (!wdata->server || wdata->replay)
+ if (!wdata->server || test_bit(NETFS_SREQ_RETRYING, &wdata->subreq.flags))
server = wdata->server = cifs_pick_channel(tcon->ses);

/*
@@ -4882,7 +4882,7 @@ smb2_async_writev(struct cifs_io_subrequest *wdata)
rqst.rq_nvec = 1;
rqst.rq_iter = wdata->subreq.io_iter;
rqst.rq_iter_size = iov_iter_count(&rqst.rq_iter);
- if (wdata->replay)
+ if (test_bit(NETFS_SREQ_RETRYING, &wdata->subreq.flags))
smb2_set_replay(server, &rqst);
#ifdef CONFIG_CIFS_SMB_DIRECT
if (wdata->mr)
diff --git a/include/linux/netfs.h b/include/linux/netfs.h
index 61195cf16d6e..455ccfe8bffa 100644
--- a/include/linux/netfs.h
+++ b/include/linux/netfs.h
@@ -224,6 +224,7 @@ struct netfs_io_subrequest {
#define NETFS_SREQ_SEEK_DATA_READ 3 /* Set if ->read() should SEEK_DATA first */
#define NETFS_SREQ_NO_PROGRESS 4 /* Set if we didn't manage to read any data */
#define NETFS_SREQ_ONDEMAND 5 /* Set if it's from on-demand read mode */
+#define NETFS_SREQ_RETRYING 6 /* Set if we're retrying the op */
};

enum netfs_io_origin {