/* writepages retry size */
        unsigned int (*wp_retry_size)(struct inode *);
        /* get mtu credits */
-       int (*wait_mtu_credits)(struct TCP_Server_Info *, unsigned int,
-                               unsigned int *, struct cifs_credits *);
+       int (*wait_mtu_credits)(struct TCP_Server_Info *, size_t,
+                               size_t *, struct cifs_credits *);
        /* adjust previously taken mtu credits to request size */
        int (*adjust_credits)(struct TCP_Server_Info *server,
                              struct cifs_credits *credits,
 
 extern int cifs_check_receive(struct mid_q_entry *mid,
                        struct TCP_Server_Info *server, bool log_error);
 extern int cifs_wait_mtu_credits(struct TCP_Server_Info *server,
-                                unsigned int size, unsigned int *num,
+                                size_t size, size_t *num,
                                 struct cifs_credits *credits);
 extern int SendReceive2(const unsigned int /* xid */ , struct cifs_ses *,
                        struct kvec *, int /* nvec to send */,
 
        struct cifs_credits *credits = &credits_on_stack;
        struct cifsFileInfo *cfile = NULL;
        unsigned long long i_size = i_size_read(inode), max_len;
-       unsigned int xid, wsize;
+       unsigned int xid;
+       size_t wsize;
        size_t len = folio_size(folio);
        long count = wbc->nr_to_write;
        int rc;
 cifs_resend_wdata(struct cifs_io_subrequest *wdata, struct list_head *wdata_list,
        struct cifs_aio_ctx *ctx)
 {
-       unsigned int wsize;
+       size_t wsize;
        struct cifs_credits credits;
        int rc;
        struct TCP_Server_Info *server = wdata->server;
        do {
                struct cifs_credits credits_on_stack;
                struct cifs_credits *credits = &credits_on_stack;
-               unsigned int wsize, nsegs = 0;
+               unsigned int nsegs = 0;
+               size_t wsize;
 
                if (signal_pending(current)) {
                        rc = -EINTR;
                        struct list_head *rdata_list,
                        struct cifs_aio_ctx *ctx)
 {
-       unsigned int rsize;
+       size_t rsize;
        struct cifs_credits credits;
        int rc;
        struct TCP_Server_Info *server;
                     struct cifs_aio_ctx *ctx)
 {
        struct cifs_io_subrequest *rdata;
-       unsigned int rsize, nsegs, max_segs = INT_MAX;
+       unsigned int nsegs, max_segs = INT_MAX;
        struct cifs_credits credits_on_stack;
        struct cifs_credits *credits = &credits_on_stack;
-       size_t cur_len, max_len;
+       size_t cur_len, max_len, rsize;
        int rc;
        pid_t pid;
        struct TCP_Server_Info *server;
         * Chop the readahead request up into rsize-sized read requests.
         */
        while ((nr_pages = ra_pages)) {
-               unsigned int i, rsize;
+               unsigned int i;
                struct cifs_io_subrequest *rdata;
                struct cifs_credits credits_on_stack;
                struct cifs_credits *credits = &credits_on_stack;
                struct folio *folio;
                pgoff_t fsize;
+               size_t rsize;
 
                /*
                 * Find out if we have anything cached in the range of
 
 }
 
 static int
-smb2_wait_mtu_credits(struct TCP_Server_Info *server, unsigned int size,
-                     unsigned int *num, struct cifs_credits *credits)
+smb2_wait_mtu_credits(struct TCP_Server_Info *server, size_t size,
+                     size_t *num, struct cifs_credits *credits)
 {
        int rc = 0;
        unsigned int scredits, in_flight;