Skip to content

Commit ab58fbd

Browse files
committed
cifs: Use more fields from netfs_io_subrequest
Use more fields from netfs_io_subrequest instead of those incorporated into cifs_io_subrequest from cifs_readdata and cifs_writedata. Signed-off-by: David Howells <dhowells@redhat.com> cc: Steve French <sfrench@samba.org> cc: Shyam Prasad N <nspmangalore@gmail.com> cc: Rohith Surabattula <rohiths.msft@gmail.com> cc: Jeff Layton <jlayton@kernel.org> cc: linux-cifs@vger.kernel.org cc: netfs@lists.linux.dev cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org
1 parent a975a2f commit ab58fbd

6 files changed

Lines changed: 113 additions & 116 deletions

File tree

fs/smb/client/cifsglob.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1515,9 +1515,6 @@ struct cifs_io_subrequest {
15151515
struct list_head list;
15161516
struct completion done;
15171517
struct work_struct work;
1518-
struct iov_iter iter;
1519-
__u64 offset;
1520-
unsigned int bytes;
15211518
};
15221519

15231520
/*

fs/smb/client/cifssmb.c

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,12 +1269,12 @@ cifs_readv_callback(struct mid_q_entry *mid)
12691269
struct TCP_Server_Info *server = tcon->ses->server;
12701270
struct smb_rqst rqst = { .rq_iov = rdata->iov,
12711271
.rq_nvec = 2,
1272-
.rq_iter = rdata->iter };
1272+
.rq_iter = rdata->subreq.io_iter };
12731273
struct cifs_credits credits = { .value = 1, .instance = 0 };
12741274

1275-
cifs_dbg(FYI, "%s: mid=%llu state=%d result=%d bytes=%u\n",
1275+
cifs_dbg(FYI, "%s: mid=%llu state=%d result=%d bytes=%zu\n",
12761276
__func__, mid->mid, mid->mid_state, rdata->result,
1277-
rdata->bytes);
1277+
rdata->subreq.len);
12781278

12791279
switch (mid->mid_state) {
12801280
case MID_RESPONSE_RECEIVED:
@@ -1322,14 +1322,14 @@ cifs_async_readv(struct cifs_io_subrequest *rdata)
13221322
struct smb_rqst rqst = { .rq_iov = rdata->iov,
13231323
.rq_nvec = 2 };
13241324

1325-
cifs_dbg(FYI, "%s: offset=%llu bytes=%u\n",
1326-
__func__, rdata->offset, rdata->bytes);
1325+
cifs_dbg(FYI, "%s: offset=%llu bytes=%zu\n",
1326+
__func__, rdata->subreq.start, rdata->subreq.len);
13271327

13281328
if (tcon->ses->capabilities & CAP_LARGE_FILES)
13291329
wct = 12;
13301330
else {
13311331
wct = 10; /* old style read */
1332-
if ((rdata->offset >> 32) > 0) {
1332+
if ((rdata->subreq.start >> 32) > 0) {
13331333
/* can not handle this big offset for old */
13341334
return -EIO;
13351335
}
@@ -1344,12 +1344,12 @@ cifs_async_readv(struct cifs_io_subrequest *rdata)
13441344

13451345
smb->AndXCommand = 0xFF; /* none */
13461346
smb->Fid = rdata->cfile->fid.netfid;
1347-
smb->OffsetLow = cpu_to_le32(rdata->offset & 0xFFFFFFFF);
1347+
smb->OffsetLow = cpu_to_le32(rdata->subreq.start & 0xFFFFFFFF);
13481348
if (wct == 12)
1349-
smb->OffsetHigh = cpu_to_le32(rdata->offset >> 32);
1349+
smb->OffsetHigh = cpu_to_le32(rdata->subreq.start >> 32);
13501350
smb->Remaining = 0;
1351-
smb->MaxCount = cpu_to_le16(rdata->bytes & 0xFFFF);
1352-
smb->MaxCountHigh = cpu_to_le32(rdata->bytes >> 16);
1351+
smb->MaxCount = cpu_to_le16(rdata->subreq.len & 0xFFFF);
1352+
smb->MaxCountHigh = cpu_to_le32(rdata->subreq.len >> 16);
13531353
if (wct == 12)
13541354
smb->ByteCount = 0;
13551355
else {
@@ -1633,13 +1633,13 @@ cifs_writev_callback(struct mid_q_entry *mid)
16331633
* client. OS/2 servers are known to set incorrect
16341634
* CountHigh values.
16351635
*/
1636-
if (written > wdata->bytes)
1636+
if (written > wdata->subreq.len)
16371637
written &= 0xFFFF;
16381638

1639-
if (written < wdata->bytes)
1639+
if (written < wdata->subreq.len)
16401640
wdata->result = -ENOSPC;
16411641
else
1642-
wdata->bytes = written;
1642+
wdata->subreq.len = written;
16431643
break;
16441644
case MID_REQUEST_SUBMITTED:
16451645
case MID_RETRY_NEEDED:
@@ -1670,7 +1670,7 @@ cifs_async_writev(struct cifs_io_subrequest *wdata)
16701670
wct = 14;
16711671
} else {
16721672
wct = 12;
1673-
if (wdata->offset >> 32 > 0) {
1673+
if (wdata->subreq.start >> 32 > 0) {
16741674
/* can not handle big offset for old srv */
16751675
return -EIO;
16761676
}
@@ -1685,9 +1685,9 @@ cifs_async_writev(struct cifs_io_subrequest *wdata)
16851685

16861686
smb->AndXCommand = 0xFF; /* none */
16871687
smb->Fid = wdata->cfile->fid.netfid;
1688-
smb->OffsetLow = cpu_to_le32(wdata->offset & 0xFFFFFFFF);
1688+
smb->OffsetLow = cpu_to_le32(wdata->subreq.start & 0xFFFFFFFF);
16891689
if (wct == 14)
1690-
smb->OffsetHigh = cpu_to_le32(wdata->offset >> 32);
1690+
smb->OffsetHigh = cpu_to_le32(wdata->subreq.start >> 32);
16911691
smb->Reserved = 0xFFFFFFFF;
16921692
smb->WriteMode = 0;
16931693
smb->Remaining = 0;
@@ -1703,24 +1703,24 @@ cifs_async_writev(struct cifs_io_subrequest *wdata)
17031703

17041704
rqst.rq_iov = iov;
17051705
rqst.rq_nvec = 2;
1706-
rqst.rq_iter = wdata->iter;
1707-
rqst.rq_iter_size = iov_iter_count(&wdata->iter);
1706+
rqst.rq_iter = wdata->subreq.io_iter;
1707+
rqst.rq_iter_size = iov_iter_count(&wdata->subreq.io_iter);
17081708

1709-
cifs_dbg(FYI, "async write at %llu %u bytes\n",
1710-
wdata->offset, wdata->bytes);
1709+
cifs_dbg(FYI, "async write at %llu %zu bytes\n",
1710+
wdata->subreq.start, wdata->subreq.len);
17111711

1712-
smb->DataLengthLow = cpu_to_le16(wdata->bytes & 0xFFFF);
1713-
smb->DataLengthHigh = cpu_to_le16(wdata->bytes >> 16);
1712+
smb->DataLengthLow = cpu_to_le16(wdata->subreq.len & 0xFFFF);
1713+
smb->DataLengthHigh = cpu_to_le16(wdata->subreq.len >> 16);
17141714

17151715
if (wct == 14) {
1716-
inc_rfc1001_len(&smb->hdr, wdata->bytes + 1);
1717-
put_bcc(wdata->bytes + 1, &smb->hdr);
1716+
inc_rfc1001_len(&smb->hdr, wdata->subreq.len + 1);
1717+
put_bcc(wdata->subreq.len + 1, &smb->hdr);
17181718
} else {
17191719
/* wct == 12 */
17201720
struct smb_com_writex_req *smbw =
17211721
(struct smb_com_writex_req *)smb;
1722-
inc_rfc1001_len(&smbw->hdr, wdata->bytes + 5);
1723-
put_bcc(wdata->bytes + 5, &smbw->hdr);
1722+
inc_rfc1001_len(&smbw->hdr, wdata->subreq.len + 5);
1723+
put_bcc(wdata->subreq.len + 5, &smbw->hdr);
17241724
iov[1].iov_len += 4; /* pad bigger by four bytes */
17251725
}
17261726

0 commit comments

Comments
 (0)