From patchwork Mon Feb 5 22:57:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13546379 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 5A133C4828D for ; Mon, 5 Feb 2024 22:57:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D87366B0096; Mon, 5 Feb 2024 17:57:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CEADF6B0098; Mon, 5 Feb 2024 17:57:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BB36E6B0099; Mon, 5 Feb 2024 17:57:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id A5F406B0096 for ; Mon, 5 Feb 2024 17:57:51 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 7BA1A160BB1 for ; Mon, 5 Feb 2024 22:57:51 +0000 (UTC) X-FDA: 81759264342.12.F478EE8 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf04.hostedemail.com (Postfix) with ESMTP id BCACE4000D for ; Mon, 5 Feb 2024 22:57:49 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=gnn1EZ6h; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf04.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1707173869; 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=rsfhF+v4jP24sud3ne/FJVWtqEteLzbJn5JlLIWDz9E=; b=pgz07Kuf9VtVsz+Nk0baB4Ap2eFZtM5O9ZUoNzuz2YqYRKtCsfP7pK1S11Ts5PSEvLWPQE UBhnTYlg3D7CNFZTOezvo3TqUYxuFIaLV7gkT42vVHzlawlSfP6rbsjLh/wkeRtsKBfuFS N1jMCx6xCAoFO2U9eS2ZBjoNQ//AF2g= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=gnn1EZ6h; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf04.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1707173869; a=rsa-sha256; cv=none; b=4jmFR/crJF4yEUkMJniaLd/UYUT4LpkA9Mf1xdwFw/BbFcoaFiB28c6A0xcAJLsIqxVj6H gEyi0lYGxwpOYe8kT9EzLBJuZdtyCds4UqX9p4pqsyTr2mWKyKGNDmVAABy7Y3QePZdCEN kZOXKjcOjQBQARgmL/fCLJOWK1k88iI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707173869; 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=rsfhF+v4jP24sud3ne/FJVWtqEteLzbJn5JlLIWDz9E=; b=gnn1EZ6hMEeu3O5fVtqSa9o8AT6C2kpzdsV9i61lIc/fljKRM2KArLL4V/xPtJ0i5ITxRE VUbFzlDx65r+VgJjewaTDtn1wCHs8e5g2MNLLMYmiod8jVET5T3TuV0TlHWTBQ1VyVWZmB ZgDQ2yq2qMbYBpdisgcbwToDxiCyF7c= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-142-d_VwA-mlOuCghcd8uSgV0A-1; Mon, 05 Feb 2024 17:57:45 -0500 X-MC-Unique: d_VwA-mlOuCghcd8uSgV0A-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (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 C153B8870E2; Mon, 5 Feb 2024 22:57:44 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.245]) by smtp.corp.redhat.com (Postfix) with ESMTP id B02C13C2E; Mon, 5 Feb 2024 22:57:42 +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 v5 05/12] cifs: Make wait_mtu_credits take size_t args Date: Mon, 5 Feb 2024 22:57:17 +0000 Message-ID: <20240205225726.3104808-6-dhowells@redhat.com> In-Reply-To: <20240205225726.3104808-1-dhowells@redhat.com> References: <20240205225726.3104808-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 X-Rspamd-Queue-Id: BCACE4000D X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: kk8mwoxi3bkf5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nkbKiTa/zajjKMpxkZVEUBnaIJDg/yBi+p7UzjDjdLEszDObOllgSoH3KG3nrN+KVheMkcwfP8eTNAviHhfcZxKIHhH/A7YwddjH9IwZnKT54pZhU3Ulo5GXFOZY4hBZ5blLzdCZ5EDKv3YAsok2pE27NzlJez6Xg/oab2llnbgyuv5ShYvYw0fzjQ0xrh+4P74as95pKCJbPKtQ25A/eh2IIWYZHXdFXrU41QFR/mI4TtJCn96/ARsh33UQuud3JVvpF9tqEf4DeoNBdosonlTNrYyw/vpzUaQEkNdv0UQSglts6lFLmHkZ1njdA07uIiuF7wP4o22GtyFV1aWGQmTJhgLlnumlaNNpbtR+8fl03FPtd2L1g4WY7otmrv4dftTt66kyFpFv8GExVqN+FGRH1b6Hr1Cj5B/VGb1+TFpDS+W/aqSQVujwcHqG84T3qbCh7ZRuHQcxp4+GWlDrnEQNQtjEPGgYRcKarZuozadJdCN4KaI= 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: 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 | 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 cac10f8e17e4..c0a0de24f52a 100644 --- a/fs/smb/client/cifsglob.h +++ b/fs/smb/client/cifsglob.h @@ -530,8 +530,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 867077be859c..00cb0d2dc935 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 6e53657154d6..63237dad0c4d 100644 --- a/fs/smb/client/file.c +++ b/fs/smb/client/file.c @@ -2735,9 +2735,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; @@ -3249,7 +3249,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; @@ -3384,7 +3384,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; @@ -3821,7 +3822,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; @@ -3895,10 +3896,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; @@ -4494,12 +4495,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 8d674aef8dd9..b79b6bbd7103 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;