From patchwork Fri Nov 17 21:15:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13459602 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C52A8C5AE4A for ; Fri, 17 Nov 2023 21:18:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 55D958D0064; Fri, 17 Nov 2023 16:18:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4E7B48D005B; Fri, 17 Nov 2023 16:18:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 278E98D0064; Fri, 17 Nov 2023 16:18:50 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 0C0578D005B for ; Fri, 17 Nov 2023 16:18:50 -0500 (EST) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id D6569C071E for ; Fri, 17 Nov 2023 21:18:49 +0000 (UTC) X-FDA: 81468710778.29.D1A0E3D Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf23.hostedemail.com (Postfix) with ESMTP id 09207140015 for ; Fri, 17 Nov 2023 21:18:47 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=KTRvftFI; spf=pass (imf23.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700255928; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=F1Bu22gnjoTinDIEaWTyZ/Cz7QBpdn6BKVutBUI1hCg=; b=ll1O0c2uzrS3BJHEwIIFbLbxRolUdPJKn3ngzuF9ydjuHad4MnJAJU3EjBGGM+1vcxX+ik NN48ZKYyWf8A9fkh0TWrHP3dNlN7M+5hOBFydgXVnDZnjcK2JJ1wBC6JZG/s9VjCpFD+oU ZZOaEQfqDjWELqye5DUBiQDr++6sN3Q= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700255928; a=rsa-sha256; cv=none; b=c//VFBVF4TISD9pOqwYU/r1jtEBUlFPyomN8ukp0oFi05Uv8SHYGoh7HdMBiTzF92nkBFx Dyp6gpPg7cHOXFY2njZ/wPEIZJNxchzNmwgRFMvAqGmAN3jftCql691y8jrAVyYgMT6V3a mxzC7mHILNG1y4JZUlc8uEEMUmT/FH0= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=KTRvftFI; spf=pass (imf23.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700255927; 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=F1Bu22gnjoTinDIEaWTyZ/Cz7QBpdn6BKVutBUI1hCg=; b=KTRvftFIGjcUG/Dkskpfwsmdw6/m+UWAAkwbnLV+KOQZiECRRNeZGIo7ZslS3JrMYca9gi HqqqJ+Ou+OcbAeboGVFqBPQAGM9QkM4M6ywbXw3S3GVFBX1WoWImE7X1a01q2Blh6KMYvd eBq5oozOeiloLn/O0qH/d7pSfbhKuFc= 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-81-WAZa6l5HPW2_g-HIm8AyKQ-1; Fri, 17 Nov 2023 16:18:45 -0500 X-MC-Unique: WAZa6l5HPW2_g-HIm8AyKQ-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (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 0CB4C1C068C3; Fri, 17 Nov 2023 21:18:44 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1EB31492BE0; Fri, 17 Nov 2023 21:18:41 +0000 (UTC) From: David Howells To: Jeff Layton , Steve French Cc: David Howells , Matthew Wilcox , Marc Dionne , Paulo Alcantara , Shyam Prasad N , Tom Talpey , Dominique Martinet , Ilya Dryomov , Christian Brauner , linux-cachefs@redhat.com, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs@lists.linux.dev, 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 Subject: [PATCH v2 45/51] cifs: Make wait_mtu_credits take size_t args Date: Fri, 17 Nov 2023 21:15:37 +0000 Message-ID: <20231117211544.1740466-46-dhowells@redhat.com> In-Reply-To: <20231117211544.1740466-1-dhowells@redhat.com> References: <20231117211544.1740466-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.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Qp2NYN9YaziYriHS6i9i58Y7 r6WTWZ8C pVcUgdt0X2QRvAGotf0FaeuQsJle+PzXhkDYxMe+nLnqatGc9UBYXZ/asa2WWjSzt8yFRcv4Nlk5NS8eQxLMZgvKPPfYYRf69rwgfwW9BgQpmvexfWM0sdFry4kXKM+4qpkBxMo2PBI25I3Nuy5PrDCgnj1N0Rkrf9aZ0q9wWIi66iktygIOAgwSMxTaSN5Ql152fosww0rL9D03QkgsCjuACUBvhCu7yPamnZT7rvSlDKkQKTCfYwQuGZHu4linPOPKRKSroEkCpMKXnWozt4gS7Mt6p4RpHpAytTye8ssXWLhm2gFd8mcqtLySgthAswa9jzABnvL6QhxSqRgE5f+jbQ+4/hYIM7ZVkEMFKmfY89dRvBok7grL27Hi02QT5VNp9ifgW6vK6xQMQoi6A2FMJg1sLyU1teplG/a8BPCNurUYjowc3F6/Y5sx4E9ueTOXbPEtkU6U5ICf9NjswCFWZGsvzat+VCHohCEre05CAaV1prHoDRCgJjA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org --- fs/smb/client/cifsglob.h | 4 ++-- fs/smb/client/cifsproto.h | 2 +- fs/smb/client/file.c | 18 ++++++++++-------- fs/smb/client/smb2ops.c | 4 ++-- fs/smb/client/transport.c | 4 ++-- 5 files changed, 17 insertions(+), 15 deletions(-) diff --git a/fs/smb/client/cifsglob.h b/fs/smb/client/cifsglob.h index 9c2bb0fc58e8..e02044f0f458 100644 --- a/fs/smb/client/cifsglob.h +++ b/fs/smb/client/cifsglob.h @@ -507,8 +507,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 be46efbbf7ac..824a84f14f4a 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 497429eec942..7621eb7a544d 100644 --- a/fs/smb/client/file.c +++ b/fs/smb/client/file.c @@ -2733,9 +2733,9 @@ static ssize_t cifs_write_back_from_locked_folio(struct address_space *mapping, struct cifs_credits credits_on_stack; struct cifs_credits *credits = &credits_on_stack; struct cifsFileInfo *cfile = NULL; - unsigned int xid, wsize, len; + unsigned int xid, len; loff_t i_size = i_size_read(inode); - size_t max_len; + size_t max_len, wsize; long count = wbc->nr_to_write; int rc; @@ -3247,7 +3247,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; @@ -3381,7 +3381,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; @@ -3818,7 +3819,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; @@ -3892,10 +3893,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; @@ -4491,12 +4492,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 5d8566ba4d20..d80026a50f62 100644 --- a/fs/smb/client/smb2ops.c +++ b/fs/smb/client/smb2ops.c @@ -216,8 +216,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 3048516573e8..5cf653463c55 100644 --- a/fs/smb/client/transport.c +++ b/fs/smb/client/transport.c @@ -684,8 +684,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;