Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp582262lqh; Thu, 28 Mar 2024 10:03:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWCw4x92X+yQFSRyX/jsgtFl4rHMIv3VRXQ22Z+/SUkq2SBWzIFWepoFiLqTerXqBoqh/wyPNHmPPXRwG1+wDfUHbq0jY0syNf6oWICgA== X-Google-Smtp-Source: AGHT+IGL4qgD5TEJ2Vb8AEWmHS/+g7WW0som/qzyQPuH7VbQXp8Jhdch7KUa5IeLYJufU2XPOkdZ X-Received: by 2002:a05:6358:5611:b0:17e:b867:cb94 with SMTP id b17-20020a056358561100b0017eb867cb94mr3287019rwf.17.1711645431298; Thu, 28 Mar 2024 10:03:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711645431; cv=pass; d=google.com; s=arc-20160816; b=v49l+Pn+vstgJf3H9n6+q+v1+yilPVeBhLAZWq56ehd63QLcgB13GocEtRbrOTcAaw su14r7Qa/6MFsF3b/C/HiCOFdcO4hVtNmiV9KNNh3pHe4M01VlEVS4voL+tn0wFFoPpk 0y+sn1fsFMsA3Zs+DUuOSqCuucOzg2bsjEadJmywJz6BzjuJzhSGTalkh8S0rXR5rZWL KtEpPYUvs02X69+6/QDODpaGEHfzB03u8KcjpjbCPZqM6aMmvc31ZdKi1E6wUmQ4iR1c AVDseKgxG3HSiEQCxrXalYimOV62qlzAx2Sv3m5kX/o9Kjc6zhCTmwlCpb0J840BvGqh MXJg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=tzNFrIx51OPZGYIohrzRvwjxtNHaaHVdYPKmPKDLG9U=; fh=oodmRKDi9WgwC2gH74uORLc3G9y6uDHX8GjesF5Bym4=; b=XRI5ExZjIpODVTdkXV4qgNT3z8+AduXfTsLlr7shRYweOv8vf0WnShbKtPwWvSlcDz E1v7IwWdO3JYolWVf0LrozaH5Q33aJdO8ldLyCeSzuIcR3Zqrre+P2Z9AJA+0XlFtH4G MwdOhIwNgGisR2wry7ebBe8up9KTFUfO1acdj3SbbpdTLthFCxtjUYxS0DiOlrlwJE5+ uUgRMZ1YIHMya67bXv7KE5h9X7RM+lsargr6GL1YgGrIuXGMkdKIb+3kO65mkCahnR8X 6QBSNTQY8mDIck5K6/M4lrCNM8gm7R4iJxXq+jyqmt2ffQ/ZGOr9KRrifPwC3fX9PSYM yYzQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Vzhs6N0g; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-123321-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123321-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id o6-20020a655206000000b005cdc5c9d6a2si1796899pgp.576.2024.03.28.10.03.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 10:03:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-123321-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Vzhs6N0g; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-123321-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123321-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E270F29E939 for ; Thu, 28 Mar 2024 17:00:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D9A4612EBC4; Thu, 28 Mar 2024 16:59:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Vzhs6N0g" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2FB6282870 for ; Thu, 28 Mar 2024 16:59:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711645183; cv=none; b=ZBV3/bcaQLn+j5RExYqq5ed1M6Bo9Esmzb9Veh8UGt+whFi7ogHADK/J/erP+PYG920DfbNL6epLFKsrYp2GK8Bbxk+RzdIIVNyz/nz1szB2n9raplmGWwF8vQ6D0EcDYu8/R9+eoEYLlEjm7MVBALB3iowdFTzRfluU6THMOEY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711645183; c=relaxed/simple; bh=91203nhPa825Pcw3EKi4vZbAvQwkqupVawlE3FIuJdA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eEKj1H1lLdg0ut9zHy4tytcv/5/j2UCOjjX6yuAqLkqy8Xmoz4iR1hWtCPuIwxkM/ikx8FwdKe8+JGGeou2WP43or1lDZ5DA4Qq3sxYwp7V9BCyonMChmcv+IO0IixVuKxbuZwS3ldVnpdqkAJDwMyhq27X9J9AzcakMo4LemzU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Vzhs6N0g; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711645181; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tzNFrIx51OPZGYIohrzRvwjxtNHaaHVdYPKmPKDLG9U=; b=Vzhs6N0g+G9hd7HgS0/lmlbWkdHRwohOUh5iWBQDykNIopksEWdX9VrGYfRA5v3tm+wRkG 9da5RvCztFctdeezzA3tNavERfXtMs4+keFIzF/3X+UafZlUoAEnrTiZoFDI5AOarkNmgc McQj8BQf2RERQejzR32+7I0E2eOoEsA= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-393-M-9TrocPM52Eo_XJTQe1gg-1; Thu, 28 Mar 2024 12:59:38 -0400 X-MC-Unique: M-9TrocPM52Eo_XJTQe1gg-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1748D28EC105; Thu, 28 Mar 2024 16:59:36 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.146]) by smtp.corp.redhat.com (Postfix) with ESMTP id D6D84492BD0; Thu, 28 Mar 2024 16:59:33 +0000 (UTC) From: David Howells To: Steve French Cc: David Howells , Jeff Layton , Matthew Wilcox , Paulo Alcantara , Shyam Prasad N , Tom Talpey , Christian Brauner , netfs@lists.linux.dev, linux-cifs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Steve French , Shyam Prasad N , Rohith Surabattula , linux-cachefs@redhat.com Subject: [PATCH v6 04/15] cifs: Make wait_mtu_credits take size_t args Date: Thu, 28 Mar 2024 16:57:55 +0000 Message-ID: <20240328165845.2782259-5-dhowells@redhat.com> In-Reply-To: <20240328165845.2782259-1-dhowells@redhat.com> References: <20240328165845.2782259-1-dhowells@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 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 cc: Steve French cc: Shyam Prasad N cc: Rohith Surabattula cc: Jeff Layton cc: linux-cifs@vger.kernel.org cc: linux-cachefs@redhat.com cc: netfs@lists.linux.dev cc: linux-mm@kvack.org --- fs/smb/client/cifsglob.h | 4 ++-- fs/smb/client/cifsproto.h | 2 +- fs/smb/client/file.c | 17 ++++++++++------- fs/smb/client/smb2ops.c | 4 ++-- fs/smb/client/transport.c | 4 ++-- 5 files changed, 17 insertions(+), 14 deletions(-) diff --git a/fs/smb/client/cifsglob.h b/fs/smb/client/cifsglob.h index ff86ab3d6166..6436d360b9f4 100644 --- a/fs/smb/client/cifsglob.h +++ b/fs/smb/client/cifsglob.h @@ -546,8 +546,8 @@ struct smb_version_operations { /* 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, diff --git a/fs/smb/client/cifsproto.h b/fs/smb/client/cifsproto.h index 010601a89fe5..95b5fa385196 100644 --- a/fs/smb/client/cifsproto.h +++ b/fs/smb/client/cifsproto.h @@ -121,7 +121,7 @@ extern struct mid_q_entry *cifs_setup_async_request(struct TCP_Server_Info *, 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 */, diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c index c5850a1c484f..76bfefa9b669 100644 --- a/fs/smb/client/file.c +++ b/fs/smb/client/file.c @@ -2704,7 +2704,8 @@ static ssize_t cifs_write_back_from_locked_folio(struct address_space *mapping, 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; @@ -3206,7 +3207,7 @@ static int 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; @@ -3341,7 +3342,8 @@ cifs_write_from_iter(loff_t fpos, size_t len, struct iov_iter *from, 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; @@ -3778,7 +3780,7 @@ static int cifs_resend_rdata(struct cifs_io_subrequest *rdata, 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; @@ -3852,10 +3854,10 @@ cifs_send_async_read(loff_t fpos, size_t len, struct cifsFileInfo *open_file, 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; @@ -4451,12 +4453,13 @@ static void cifs_readahead(struct readahead_control *ractl) * 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 diff --git a/fs/smb/client/smb2ops.c b/fs/smb/client/smb2ops.c index b185b07ea86b..2413006e5f39 100644 --- a/fs/smb/client/smb2ops.c +++ b/fs/smb/client/smb2ops.c @@ -217,8 +217,8 @@ smb2_get_credits(struct mid_q_entry *mid) } 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; diff --git a/fs/smb/client/transport.c b/fs/smb/client/transport.c index e52967de59e6..5a69a7430ffa 100644 --- a/fs/smb/client/transport.c +++ b/fs/smb/client/transport.c @@ -691,8 +691,8 @@ wait_for_compound_request(struct TCP_Server_Info *server, int num, } int -cifs_wait_mtu_credits(struct TCP_Server_Info *server, unsigned int size, - unsigned int *num, struct cifs_credits *credits) +cifs_wait_mtu_credits(struct TCP_Server_Info *server, size_t size, + size_t *num, struct cifs_credits *credits) { *num = size; credits->value = 0;