Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp2696359rdb; Mon, 5 Feb 2024 15:02:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IFefDQ1Pbz1doqBO6ytBnOGZIfuO0v/LTnWIeFpqq5f1VKCLdU5tTYmFjaJ11Wb52g+rZ6z X-Received: by 2002:a17:902:ed97:b0:1d9:a2d3:8127 with SMTP id e23-20020a170902ed9700b001d9a2d38127mr569092plj.52.1707174128477; Mon, 05 Feb 2024 15:02:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707174128; cv=pass; d=google.com; s=arc-20160816; b=agMe2RZE3DYPgzKd84BcfucIAAjbV14w9UyB4K99w2IdW1x3Nn3A/I4jY6sfIYcDEn DNfiUJIKyNOpnBKEZ+J885tr+CyCVcudq9n4uzgyOebOBW5Ou3rtVCViAf1Iy6Hj/dO2 YtQX4TtYUHlOOrykIy4IGwOoUZjESrdI0ecQQzODQZGovzEG6cFhnO9w+u0hxRYtt2/x 99jTm5JXZn48PoRwPBXFfgDCzvFnvjxEdrBDPUq3vnDkpe6ok7P/TmoldzfAQVxMNP1K tt7M0Wi/WE+4CkcB7ODpW2Qyp3bRsg6iUBs3mK8LO1RS1RkH550MQ8jfxTNCrTE8v2q2 vbhQ== 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=rsfhF+v4jP24sud3ne/FJVWtqEteLzbJn5JlLIWDz9E=; fh=aS/WWJ4lgiQ0EeqgZ86Yr2WX3kIuLJyYcST082IXh4Q=; b=ZAfZJizqMMwKqHh1kWdJ/J7kzfq0yqLDzyAirwc4hdRcz1qtJdVTDQW2xyzVkbQ1Vz LPLuq75V7Xi9xHt+FJNnUL8g8rHNNyTXN67ODzGTsfzLqAY1ucTICMWCsUZmVVqlgvsf /fUFby/sOT0kIyoHJmaPp7S1RZ0vQKsbpVQAvev0cwYniLmq27EyBqkGVeNrWeL5IY8k FyIV4oYX4Tk5rV1e4Xf4HKUkho1fDLPD6AFCz5bEwWJC2yv5BKgMZxywRnqVy8zprwRz 689wbWJmYfDNGf5kxJcIaIvw5/fAmHYUR8hSH7SpThfb09+xSPMZ6sFD5ZTDHNef00jQ OiNQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GGqPbEIA; 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-54051-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54051-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Forwarded-Encrypted: i=1; AJvYcCXxzJCnxyErXChpZCMBLX9RosGdH+R4WBmKZN7/Qmi54zqIDqCx1PwDB9qD1E0OdHc0QdE3zZEvuWqnFMm0jVklcfaRsA9RzK+3FYbw+Q== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id im23-20020a170902bb1700b001d7859eee6bsi553633plb.181.2024.02.05.15.02.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 15:02:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-54051-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=GGqPbEIA; 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-54051-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54051-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 AF3A128EB3F for ; Mon, 5 Feb 2024 22:59:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0EC084F8B5; Mon, 5 Feb 2024 22:57:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="GGqPbEIA" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 AFDBA41218 for ; Mon, 5 Feb 2024 22:57:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707173875; cv=none; b=FU3W1v0lnAe7CqafBDuoi3kJksbMcmHaXj/D9BrXS1ZFLXibUTIPMDWGnD63s4UP54Z+tU5H/z8vgaPjf4v8Vx5BfgiLXtgUFz2bvDtlIvdOtewMpcm06tCYZz20odZCzDKk1qjLZXaivVIRSXfdoQ7A0ZJsUVvj07SEZaJdVt0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707173875; c=relaxed/simple; bh=nbCva3Pi+RfwE482peq2H/s2WoE0tO6Xpi+JhvsOI38=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Yym1gx8dTrsQJc5A0jQiCCXlCKJyzlgCvoxN2Ed6xKYPMnbj7LPsBxVi3aHXmoDiVu7TudiWJOm7pwfOBnlQI/dpnCP0OBZcbouPWCdI02dI+sbZEXv/Df93TSP6REF7Pv1odXHtFASwiXXWfdQWA5TDCavWVtTdw12Y2ozmbxk= 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=GGqPbEIA; arc=none smtp.client-ip=170.10.133.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=1707173872; 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=GGqPbEIACIIecPKbDt4Rjb9AP0cjkoUlpzZBFMRhr3IcQZyMu4frmONQ9uQ7R9emj6+K2P rZd7tKRAmIsEJT7ShcK/yamoZ521DyGti5CfLlXXIK6TrmuPFZEe2NDV+j2aSbNCnh0Lh+ aMEY8Gg0w34UIS+svJXZwTXl0ov6L/0= 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> 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.1 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;