Linux network filesystem support library
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Steve French <sfrench@samba.org>
Cc: David Howells <dhowells@redhat.com>,
	Paulo Alcantara <pc@manguebit.org>,
	Shyam Prasad N <sprasad@microsoft.com>,
	Tom Talpey <tom@talpey.com>, Stefan Metzmacher <metze@samba.org>,
	Mina Almasry <almasrymina@google.com>,
	linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org,
	netfs@lists.linux.dev, linux-fsdevel@vger.kernel.org
Subject: [RFC PATCH 14/36] cifs: Remove cifs_io_subrequest::got_bytes
Date: Tue, 19 May 2026 11:21:32 +0100	[thread overview]
Message-ID: <20260519102158.592165-15-dhowells@redhat.com> (raw)
In-Reply-To: <20260519102158.592165-1-dhowells@redhat.com>

Remove cifs_io_subrequest::got_bytes as smb->resp_data_len can be used
instead.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Paulo Alcantara <pc@manguebit.org>
cc: Shyam Prasad N <sprasad@microsoft.com>
cc: Tom Talpey <tom@talpey.com>
cc: linux-cifs@vger.kernel.org
cc: netfs@lists.linux.dev
cc: linux-fsdevel@vger.kernel.org
---
 fs/smb/client/cifsglob.h |  1 -
 fs/smb/client/cifssmb.c  | 27 +++++++++++++--------------
 fs/smb/client/smb2pdu.c  | 22 ++++++++++------------
 3 files changed, 23 insertions(+), 27 deletions(-)

diff --git a/fs/smb/client/cifsglob.h b/fs/smb/client/cifsglob.h
index 7187e304c42e..2cb858495bc1 100644
--- a/fs/smb/client/cifsglob.h
+++ b/fs/smb/client/cifsglob.h
@@ -1467,7 +1467,6 @@ struct cifs_io_subrequest {
 		struct netfs_io_request *rreq;
 		struct cifs_io_request *req;
 	};
-	ssize_t				got_bytes;
 	unsigned int			xid;
 	int				result;
 	bool				have_xid;
diff --git a/fs/smb/client/cifssmb.c b/fs/smb/client/cifssmb.c
index 901f8aff6134..62f554f97a5c 100644
--- a/fs/smb/client/cifssmb.c
+++ b/fs/smb/client/cifssmb.c
@@ -1450,7 +1450,7 @@ cifs_readv_callback(struct TCP_Server_Info *server, struct smb_message *smb)
 		 __func__, smb->mid, smb->mid_state, rdata->result,
 		 rdata->subreq.len);
 
-	if (rdata->got_bytes)
+	if (smb->resp_data_len)
 		iov_iter_bvec_queue(&rqst.rq_iter, ITER_DEST,
 				    rdata->subreq.content.bvecq, rdata->subreq.content.slot,
 				    rdata->subreq.content.offset, rdata->subreq.len);
@@ -1458,9 +1458,8 @@ cifs_readv_callback(struct TCP_Server_Info *server, struct smb_message *smb)
 	switch (smb->mid_state) {
 	case MID_RESPONSE_RECEIVED:
 		/* result already set, check signature */
-		rdata->got_bytes = smb->resp_data_len;
 		if (server->sign) {
-			int rc = 0;
+			int rc;
 
 			iov_iter_truncate(&rqst.rq_iter, smb->resp_data_len);
 			rc = cifs_verify_signature(&rqst, server,
@@ -1470,8 +1469,8 @@ cifs_readv_callback(struct TCP_Server_Info *server, struct smb_message *smb)
 					 rc);
 		}
 		/* FIXME: should this be counted toward the initiating task? */
-		task_io_account_read(rdata->got_bytes);
-		cifs_stats_bytes_read(tcon, rdata->got_bytes);
+		task_io_account_read(smb->resp_data_len);
+		cifs_stats_bytes_read(tcon, smb->resp_data_len);
 		break;
 	case MID_REQUEST_SUBMITTED:
 		trace_netfs_sreq(&rdata->subreq, netfs_sreq_trace_io_req_submitted);
@@ -1481,12 +1480,12 @@ cifs_readv_callback(struct TCP_Server_Info *server, struct smb_message *smb)
 do_retry:
 		__set_bit(NETFS_SREQ_NEED_RETRY, &rdata->subreq.flags);
 		rdata->result = -EAGAIN;
-		if (server->sign && rdata->got_bytes)
+		if (server->sign && smb->resp_data_len)
 			/* reset bytes number since we can not check a sign */
-			rdata->got_bytes = 0;
+			smb->resp_data_len = 0;
 		/* FIXME: should this be counted toward the initiating task? */
-		task_io_account_read(rdata->got_bytes);
-		cifs_stats_bytes_read(tcon, rdata->got_bytes);
+		task_io_account_read(smb->resp_data_len);
+		cifs_stats_bytes_read(tcon, smb->resp_data_len);
 		break;
 	case MID_RESPONSE_MALFORMED:
 		trace_netfs_sreq(&rdata->subreq, netfs_sreq_trace_io_malformed);
@@ -1511,15 +1510,15 @@ cifs_readv_callback(struct TCP_Server_Info *server, struct smb_message *smb)
 				    rdata->subreq.len   - rdata->subreq.transferred,
 				    rdata->result);
 	} else {
-		size_t trans = rdata->subreq.transferred + rdata->got_bytes;
+		size_t trans = rdata->subreq.transferred + smb->resp_data_len;
 		if (trans < rdata->subreq.len &&
 		    rdata->subreq.start + trans >= netfs_read_remote_i_size(inode)) {
 			rdata->result = 0;
 			__set_bit(NETFS_SREQ_HIT_EOF, &rdata->subreq.flags);
-		} else if (rdata->got_bytes > 0) {
+		} else if (smb->resp_data_len > 0) {
 			__set_bit(NETFS_SREQ_MADE_PROGRESS, &rdata->subreq.flags);
 		}
-		if (rdata->got_bytes)
+		if (smb->resp_data_len)
 			__set_bit(NETFS_SREQ_MADE_PROGRESS, &rdata->subreq.flags);
 		trace_smb3_read_done(rdata->rreq->debug_id,
 				     rdata->subreq.debug_index,
@@ -1527,7 +1526,7 @@ cifs_readv_callback(struct TCP_Server_Info *server, struct smb_message *smb)
 				     rdata->req->cfile->fid.persistent_fid,
 				     tcon->tid, tcon->ses->Suid,
 				     rdata->subreq.start + rdata->subreq.transferred,
-				     rdata->got_bytes);
+				     smb->resp_data_len);
 	}
 
 	trace_smb3_rw_credits(rreq_debug_id, subreq_debug_index, rdata->credits.value,
@@ -1535,7 +1534,7 @@ cifs_readv_callback(struct TCP_Server_Info *server, struct smb_message *smb)
 			      0, cifs_trace_rw_credits_read_response_clear);
 	rdata->credits.value = 0;
 	rdata->subreq.error = rdata->result;
-	rdata->subreq.transferred += rdata->got_bytes;
+	rdata->subreq.transferred += smb->resp_data_len;
 	trace_netfs_sreq(&rdata->subreq, netfs_sreq_trace_io_progress);
 	netfs_read_subreq_terminated(&rdata->subreq);
 	release_mid(server, smb);
diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c
index ab193f84c1ab..ddf127dc27bb 100644
--- a/fs/smb/client/smb2pdu.c
+++ b/fs/smb/client/smb2pdu.c
@@ -4671,10 +4671,9 @@ smb2_readv_callback(struct TCP_Server_Info *server, struct smb_message *smb)
 				trace_netfs_sreq(&rdata->subreq, netfs_sreq_trace_io_progress);
 		}
 
-		rdata->got_bytes = smb->resp_data_len;
 		/* FIXME: should this be counted toward the initiating task? */
-		task_io_account_read(rdata->got_bytes);
-		cifs_stats_bytes_read(tcon, rdata->got_bytes);
+		task_io_account_read(smb->resp_data_len);
+		cifs_stats_bytes_read(tcon, smb->resp_data_len);
 		break;
 	case MID_REQUEST_SUBMITTED:
 		trace_netfs_sreq(&rdata->subreq, netfs_sreq_trace_io_req_submitted);
@@ -4684,12 +4683,12 @@ smb2_readv_callback(struct TCP_Server_Info *server, struct smb_message *smb)
 do_retry:
 		__set_bit(NETFS_SREQ_NEED_RETRY, &rdata->subreq.flags);
 		rdata->result = -EAGAIN;
-		if (server->sign && rdata->got_bytes)
+		if (server->sign && smb->resp_data_len)
 			/* reset bytes number since we can not check a sign */
-			rdata->got_bytes = 0;
+			smb->resp_data_len = 0;
 		/* FIXME: should this be counted toward the initiating task? */
-		task_io_account_read(rdata->got_bytes);
-		cifs_stats_bytes_read(tcon, rdata->got_bytes);
+		task_io_account_read(smb->resp_data_len);
+		cifs_stats_bytes_read(tcon, smb->resp_data_len);
 		break;
 	case MID_RESPONSE_MALFORMED:
 		trace_netfs_sreq(&rdata->subreq, netfs_sreq_trace_io_malformed);
@@ -4731,19 +4730,19 @@ smb2_readv_callback(struct TCP_Server_Info *server, struct smb_message *smb)
 				     rdata->req->cfile->fid.persistent_fid,
 				     tcon->tid, tcon->ses->Suid,
 				     rdata->subreq.start + rdata->subreq.transferred,
-				     rdata->got_bytes);
+				     smb->resp_data_len);
 
 	if (rdata->result == -ENODATA) {
 		__set_bit(NETFS_SREQ_HIT_EOF, &rdata->subreq.flags);
 		rdata->result = 0;
 	} else {
-		size_t trans = rdata->subreq.transferred + rdata->got_bytes;
+		size_t trans = rdata->subreq.transferred + smb->resp_data_len;
 		if (trans < rdata->subreq.len &&
 		    rdata->subreq.start + trans >= netfs_read_remote_i_size(inode)) {
 			__set_bit(NETFS_SREQ_HIT_EOF, &rdata->subreq.flags);
 			rdata->result = 0;
 		}
-		if (rdata->got_bytes)
+		if (smb->resp_data_len)
 			__set_bit(NETFS_SREQ_MADE_PROGRESS, &rdata->subreq.flags);
 	}
 
@@ -4759,7 +4758,7 @@ smb2_readv_callback(struct TCP_Server_Info *server, struct smb_message *smb)
 			      0, cifs_trace_rw_credits_read_response_clear);
 	rdata->credits.value = 0;
 	rdata->subreq.error = rdata->result;
-	rdata->subreq.transferred += rdata->got_bytes;
+	rdata->subreq.transferred += smb->resp_data_len;
 	trace_netfs_sreq(&rdata->subreq, netfs_sreq_trace_io_progress);
 	netfs_read_subreq_terminated(&rdata->subreq);
 	release_mid(server, smb);
@@ -4814,7 +4813,6 @@ smb2_async_readv(struct cifs_io_subrequest *rdata)
 
 	rdata->iov[0].iov_base = buf;
 	rdata->iov[0].iov_len = total_len;
-	rdata->got_bytes = 0;
 	rdata->result = 0;
 
 	shdr = (struct smb2_hdr *)buf;


  parent reply	other threads:[~2026-05-19 10:23 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260519102158.592165-1-dhowells@redhat.com>
2026-05-19 10:21 ` [RFC PATCH 01/36] net: Perform special handling for a splice from a bvecq David Howells
2026-05-19 10:21 ` [RFC PATCH 02/36] netfs: Add a facility to splice TCP receive buffers into " David Howells
2026-05-19 10:21 ` [RFC PATCH 03/36] netfs: Add some TCP receive queue helpers David Howells
2026-05-19 10:21 ` [RFC PATCH 04/36] cifs, nls: Provide unicode size determination func David Howells
2026-05-19 10:21 ` [RFC PATCH 05/36] cifs: Introduce an ALIGN8() macro David Howells
2026-05-19 10:21 ` [RFC PATCH 06/36] cifs: Rename mid_q_entry to smb_message David Howells
2026-05-19 10:21 ` [RFC PATCH 07/36] cifs: Add "Has dynamic part" flag form SMB2/3 StructureSize LSB David Howells
2026-05-19 10:21 ` [RFC PATCH 09/36] cifs: Institute message managing struct David Howells
2026-05-19 10:21 ` [RFC PATCH 10/36] cifs: Split crypt_message() into encrypt and decrypt variants David Howells
2026-05-19 10:21 ` [RFC PATCH 11/36] cifs: Add new AEAD alloc and setup routines that draw from an iterator David Howells
2026-05-19 10:21 ` [RFC PATCH 12/36] cifs: [WIP] Rewrite base Rx to put data off the socket into a bvecq David Howells
2026-05-19 10:21 ` [RFC PATCH 13/36] cifs: Remove validate_t2() David Howells
2026-05-19 10:21 ` David Howells [this message]
2026-05-19 10:21 ` [RFC PATCH 15/36] cifs: Pass smb_message to cifs_verify_signature() David Howells
2026-05-19 10:21 ` [RFC PATCH 16/36] cifs: Rewrite base TCP transmission David Howells
2026-05-19 10:36   ` Stefan Metzmacher
2026-05-19 10:21 ` [RFC PATCH 17/36] cifs: Don't use corking David Howells
2026-05-19 10:21 ` [RFC PATCH 20/36] cifs: Pass smb_message structs down into the transport layer David Howells
2026-05-19 10:21 ` [RFC PATCH 21/36] cifs: Add a tracepoint to trace the smb_message refcount David Howells
2026-05-19 10:21 ` [RFC PATCH 22/36] cifs: Trace smb1/2_copy_to_prepped_buffers() David Howells
2026-05-19 10:21 ` [RFC PATCH 23/36] cifs: Clean up mid->callback_data and kill off mid->creator David Howells
2026-05-19 10:21 ` [RFC PATCH 24/36] cifs: Add netmem allocation functions David Howells
2026-05-19 10:21 ` [RFC PATCH 25/36] cifs: Add more pieces to smb_message David Howells
2026-05-19 10:21 ` [RFC PATCH 26/36] cifs: Convert SMB2 Negotiate Protocol request David Howells
2026-05-19 10:21 ` [RFC PATCH 27/36] cifs: Convert SMB2 Session Setup request David Howells
2026-05-19 10:21 ` [RFC PATCH 28/36] cifs: Convert SMB2 Logoff request David Howells
2026-05-19 10:21 ` [RFC PATCH 29/36] cifs: Convert SMB2 Tree Connect request David Howells
2026-05-19 10:21 ` [RFC PATCH 30/36] cifs: Convert SMB2 Tree Disconnect request David Howells
2026-05-19 10:21 ` [RFC PATCH 31/36] cifs: Convert SMB2 Read request David Howells
2026-05-19 10:21 ` [RFC PATCH 32/36] cifs: Convert SMB2 Write request David Howells
2026-05-19 10:21 ` [RFC PATCH 33/36] cifs: [WIP] Don't copy new-style smb_messages to a set of pages David Howells
2026-05-19 10:21 ` [RFC PATCH 34/36] cifs: [WIP] Rearrange Create request subfuncs David Howells
2026-05-19 10:21 ` [RFC PATCH 35/36] cifs: [WIP] Convert SMB2 Posix Mkdir request David Howells
2026-05-19 10:21 ` [RFC PATCH 36/36] cifs: [WIP] Convert SMB2 Open request David Howells

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260519102158.592165-15-dhowells@redhat.com \
    --to=dhowells@redhat.com \
    --cc=almasrymina@google.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=metze@samba.org \
    --cc=netfs@lists.linux.dev \
    --cc=pc@manguebit.org \
    --cc=sfrench@samba.org \
    --cc=sprasad@microsoft.com \
    --cc=tom@talpey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox