Skip to content

Commit 5625733

Browse files
committed
cifs: Make wait_mtu_credits take size_t args
Make the wait_mtu_credits functions use size_t for the size and num arguments rather than unsigned int as netfslib uses size_t/ssize_t for arguments and return values to allow for extra capacity. 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: linux-cachefs@redhat.com cc: netfs@lists.linux.dev cc: linux-mm@kvack.org
1 parent ab58fbd commit 5625733

5 files changed

Lines changed: 17 additions & 14 deletions

File tree

fs/smb/client/cifsglob.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,8 +546,8 @@ struct smb_version_operations {
546546
/* writepages retry size */
547547
unsigned int (*wp_retry_size)(struct inode *);
548548
/* get mtu credits */
549-
int (*wait_mtu_credits)(struct TCP_Server_Info *, unsigned int,
550-
unsigned int *, struct cifs_credits *);
549+
int (*wait_mtu_credits)(struct TCP_Server_Info *, size_t,
550+
size_t *, struct cifs_credits *);
551551
/* adjust previously taken mtu credits to request size */
552552
int (*adjust_credits)(struct TCP_Server_Info *server,
553553
struct cifs_credits *credits,

fs/smb/client/cifsproto.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ extern struct mid_q_entry *cifs_setup_async_request(struct TCP_Server_Info *,
121121
extern int cifs_check_receive(struct mid_q_entry *mid,
122122
struct TCP_Server_Info *server, bool log_error);
123123
extern int cifs_wait_mtu_credits(struct TCP_Server_Info *server,
124-
unsigned int size, unsigned int *num,
124+
size_t size, size_t *num,
125125
struct cifs_credits *credits);
126126
extern int SendReceive2(const unsigned int /* xid */ , struct cifs_ses *,
127127
struct kvec *, int /* nvec to send */,

fs/smb/client/file.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2783,7 +2783,8 @@ static ssize_t cifs_write_back_from_locked_folio(struct address_space *mapping,
27832783
struct cifs_credits *credits = &credits_on_stack;
27842784
struct cifsFileInfo *cfile = NULL;
27852785
unsigned long long i_size = i_size_read(inode), max_len;
2786-
unsigned int xid, wsize;
2786+
unsigned int xid;
2787+
size_t wsize;
27872788
size_t len = folio_size(folio);
27882789
long count = wbc->nr_to_write;
27892790
int rc;
@@ -3285,7 +3286,7 @@ static int
32853286
cifs_resend_wdata(struct cifs_io_subrequest *wdata, struct list_head *wdata_list,
32863287
struct cifs_aio_ctx *ctx)
32873288
{
3288-
unsigned int wsize;
3289+
size_t wsize;
32893290
struct cifs_credits credits;
32903291
int rc;
32913292
struct TCP_Server_Info *server = wdata->server;
@@ -3420,7 +3421,8 @@ cifs_write_from_iter(loff_t fpos, size_t len, struct iov_iter *from,
34203421
do {
34213422
struct cifs_credits credits_on_stack;
34223423
struct cifs_credits *credits = &credits_on_stack;
3423-
unsigned int wsize, nsegs = 0;
3424+
unsigned int nsegs = 0;
3425+
size_t wsize;
34243426

34253427
if (signal_pending(current)) {
34263428
rc = -EINTR;
@@ -3857,7 +3859,7 @@ static int cifs_resend_rdata(struct cifs_io_subrequest *rdata,
38573859
struct list_head *rdata_list,
38583860
struct cifs_aio_ctx *ctx)
38593861
{
3860-
unsigned int rsize;
3862+
size_t rsize;
38613863
struct cifs_credits credits;
38623864
int rc;
38633865
struct TCP_Server_Info *server;
@@ -3931,10 +3933,10 @@ cifs_send_async_read(loff_t fpos, size_t len, struct cifsFileInfo *open_file,
39313933
struct cifs_aio_ctx *ctx)
39323934
{
39333935
struct cifs_io_subrequest *rdata;
3934-
unsigned int rsize, nsegs, max_segs = INT_MAX;
3936+
unsigned int nsegs, max_segs = INT_MAX;
39353937
struct cifs_credits credits_on_stack;
39363938
struct cifs_credits *credits = &credits_on_stack;
3937-
size_t cur_len, max_len;
3939+
size_t cur_len, max_len, rsize;
39383940
int rc;
39393941
pid_t pid;
39403942
struct TCP_Server_Info *server;
@@ -4530,12 +4532,13 @@ static void cifs_readahead(struct readahead_control *ractl)
45304532
* Chop the readahead request up into rsize-sized read requests.
45314533
*/
45324534
while ((nr_pages = ra_pages)) {
4533-
unsigned int i, rsize;
4535+
unsigned int i;
45344536
struct cifs_io_subrequest *rdata;
45354537
struct cifs_credits credits_on_stack;
45364538
struct cifs_credits *credits = &credits_on_stack;
45374539
struct folio *folio;
45384540
pgoff_t fsize;
4541+
size_t rsize;
45394542

45404543
/*
45414544
* Find out if we have anything cached in the range of

fs/smb/client/smb2ops.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,8 @@ smb2_get_credits(struct mid_q_entry *mid)
217217
}
218218

219219
static int
220-
smb2_wait_mtu_credits(struct TCP_Server_Info *server, unsigned int size,
221-
unsigned int *num, struct cifs_credits *credits)
220+
smb2_wait_mtu_credits(struct TCP_Server_Info *server, size_t size,
221+
size_t *num, struct cifs_credits *credits)
222222
{
223223
int rc = 0;
224224
unsigned int scredits, in_flight;

fs/smb/client/transport.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -691,8 +691,8 @@ wait_for_compound_request(struct TCP_Server_Info *server, int num,
691691
}
692692

693693
int
694-
cifs_wait_mtu_credits(struct TCP_Server_Info *server, unsigned int size,
695-
unsigned int *num, struct cifs_credits *credits)
694+
cifs_wait_mtu_credits(struct TCP_Server_Info *server, size_t size,
695+
size_t *num, struct cifs_credits *credits)
696696
{
697697
*num = size;
698698
credits->value = 0;

0 commit comments

Comments
 (0)