Received: by 2002:ab2:7988:0:b0:1f4:b336:87c4 with SMTP id g8csp48880lqj; Thu, 11 Apr 2024 09:30:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX6YFhuQ1fUYbgVK8G9lb3E2xp0ohkX6jOqjFtyZLZ2qWS/Z+WbOfPjqHiyjKHzddROoY/II5qW/FHYvOZwjircQmgzlO9s57TgO23GCA== X-Google-Smtp-Source: AGHT+IGkxWrqGkV+qNtg2lo5PqEWn7su04dioWwV8KAbouzvu8zQBLG5fjm9Xzxlkjh9wiajY9tF X-Received: by 2002:a05:6a00:ac2:b0:6ed:4aaa:3cbf with SMTP id c2-20020a056a000ac200b006ed4aaa3cbfmr252460pfl.3.1712853033231; Thu, 11 Apr 2024 09:30:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712853033; cv=pass; d=google.com; s=arc-20160816; b=BeDIlsJLPy9KtqRRVyG9SJlF7g6HWPq23O96ZInA87I7j14ay+t0QoLmOe8OD4Bb1g Rwea+izgGGyKRQGDdwKHsQ6gWBn0IJKs4vN4iyabyyK8sHeFQPbRtETAjarXuTejr3bh F4ackUklSeYlUTDO9EWgf7eHZOzg/mmGON3pipmyHZZGQH8nB7BLqF7uU15EfxYpW9OV JfHZ6GOrn/1J6Yi09QQIxb6lSfdinoSMZpqmGLm7plLS5AuAItbVhxQb2RX2/kM1vECB ZgBwcxGBFc6WsyaYfpySDp/c9lRO+0QCOtDse+K3PchYFbQu4FW9ekfSt8+tTQG1BVwS 5kMA== 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=+csp6tEDNXsIebOPAwRBqaO3HCxKbRxFbSXk6qUvjbo=; fh=2FInBIgEh7xt9W7JS1z2wQ7fUhvLHtwfAfkXluU3JoI=; b=D021JEk6UV4ZLcKA6HKUeZUDAg5kcxmvCoNEhc3Hy24CK2HjFwn3MR2pbzV1dLuuBN Xd/Af4VIwxd+eq4wYiO7oPx2SxWjKTwqx62SuXcj9/m0vUjX9iT1oHNgvkloMjl10Fcf rdd2oXICxaq+rXPX8bIu9FNZZtJmmztuR4FnA+4dynb2EtNS9bs0xZcc3uIUVduWoNpu UFvIVk8Yx+ONwMNXFZlBJaNDj+fiW1q77I6QDdu+cxE4pDL60ciNQq7kzTOr6qxBLSQ9 WLefNE+Cg0zHvULqN1RKwjY7E4lQkJ80e0J1Zz3HbYaNjfXNbh3slSPOGkLB/Tw6/dl3 b7jg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b="21wII/8A"; arc=pass (i=1 spf=pass spfdomain=kernel.dk dkim=pass dkdomain=kernel-dk.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-140809-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-140809-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id n8-20020aa79848000000b006ecfaa31d70si1576737pfq.359.2024.04.11.09.30.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 09:30:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-140809-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b="21wII/8A"; arc=pass (i=1 spf=pass spfdomain=kernel.dk dkim=pass dkdomain=kernel-dk.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-140809-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-140809-linux.lists.archive=gmail.com@vger.kernel.org" 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 4D239B2B4B2 for ; Thu, 11 Apr 2024 15:50:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3EADE6A8A5; Thu, 11 Apr 2024 15:33:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel-dk.20230601.gappssmtp.com header.i=@kernel-dk.20230601.gappssmtp.com header.b="21wII/8A" Received: from mail-io1-f44.google.com (mail-io1-f44.google.com [209.85.166.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E8702633FE for ; Thu, 11 Apr 2024 15:33:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712849587; cv=none; b=Qaj5sxjRz7HTgT/m2GR295sp7lC9kzPSUofSk4Tke2gJbmgLiUzCiY4FGsWmii3pGHFSyt5Pqq+wTR6VYZVFWcNLLZ+2yZwebCOZbZlcK0SCzoQKApDHdVfJNyBZ0hIIj5zq+QCu8iNpoD18cozr8SdnB/rr2hC3ZURGR75y8Zk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712849587; c=relaxed/simple; bh=r61+X9nse5GdL0xP9XGOtlPPjs63tdsfCiTgWIm731w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=P5Qedsv2X9erWYudKfImDwaYfyN4ReBteSH/PXwy4Fxfo5HWvECHsHRJJ0js4aK/xLavxJuMqvZlMveZBfDocdVMH9l2GB7q7Iu1lCjGLuvoLXMr4Yc44QmmJg7luyiPVb/ULAqsuD2Pz+nb71Chygtz/KsMjbBnmC4saUQYErM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk; spf=pass smtp.mailfrom=kernel.dk; dkim=pass (2048-bit key) header.d=kernel-dk.20230601.gappssmtp.com header.i=@kernel-dk.20230601.gappssmtp.com header.b=21wII/8A; arc=none smtp.client-ip=209.85.166.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kernel.dk Received: by mail-io1-f44.google.com with SMTP id ca18e2360f4ac-7d6112ba6baso57965939f.1 for ; Thu, 11 Apr 2024 08:33:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1712849585; x=1713454385; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+csp6tEDNXsIebOPAwRBqaO3HCxKbRxFbSXk6qUvjbo=; b=21wII/8AuLr8iyExh2r1kL2wON+g1QY7kBac1gxON45nWakgr+EAB4dK0TTInmyaNY C3ODAOpq2NV8QjCDP6NQrQrz2QN1N7MiRT5HO39Gsw9xZMC9V6fdOe2AVTJktV3p80Uc JqKceH2DrD3T29yg2/KdPhatcfdUwyXfAh0exw/qLnreh5bv2FWqSHFRPCN2x1hpHBgA LK/HE1JDQSwOKQv3645l6unsHR4KM3EEPVwPtaxJNrTbIzHTGtieJwYPPwVdh9Totdse 3UbDUWtZia5ny+cg6NVqOCvGfPCi4az587pcZgwdWaMfSq89WFWpO+MD1+7Tj8Mdr/be mdVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712849585; x=1713454385; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+csp6tEDNXsIebOPAwRBqaO3HCxKbRxFbSXk6qUvjbo=; b=NlCV4g1US1qfL/+YS/gWl4s3Ss1qlDj6o8ehYoPK8EB4TOQGNrkVaNsw9QbtOz4fKY FoFK8blfE6Pxz9MrMd19BVTt2RBOzTEsS9OCeHsKXRfx7HGTgHDB7h4cho83Q64NgKcx HG+K/hZ3jGmm6izZHQs04E36nJqEA02ixsvhFhURCghXeUREF5mEBHszScRWjE5Q4tYF sRe2CZGmEOPwD6bekKgsuc7m57S0KzEwYcR+YgEtzzXcp2hqPjAtLOclMuo4ODcn1gdo no7KqepmGeUzSkhEnE8L472bpc1/HIDsN1P+U29za/Uc67/jJcl3NO8n7tzkE7C5FDl3 cf2A== X-Gm-Message-State: AOJu0YzDrem3NEnvmvaNNhUvVGiUTf/ehmFgmWgiic//rePW01VRO9jp PmJqIr8/xDeF+KdGuEx8S1/j0E8RgYg13BhHR+sWWVoJElgsbFR0zTOOXiL9HvnKQvGolbYD2iZ O X-Received: by 2002:a05:6602:38d:b0:7d6:513b:254 with SMTP id f13-20020a056602038d00b007d6513b0254mr172846iov.2.1712849584825; Thu, 11 Apr 2024 08:33:04 -0700 (PDT) Received: from localhost.localdomain ([96.43.243.2]) by smtp.gmail.com with ESMTPSA id jc25-20020a056638891900b0047f14b7f6c0sm457056jab.5.2024.04.11.08.33.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 08:33:03 -0700 (PDT) From: Jens Axboe To: linux-kernel@vger.kernel.org Cc: Jens Axboe Subject: [PATCH 049/437] fuse: convert to read/write iterators Date: Thu, 11 Apr 2024 09:13:09 -0600 Message-ID: <20240411153126.16201-50-axboe@kernel.dk> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240411153126.16201-1-axboe@kernel.dk> References: <20240411153126.16201-1-axboe@kernel.dk> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Signed-off-by: Jens Axboe --- fs/fuse/control.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/fs/fuse/control.c b/fs/fuse/control.c index 97ac994ff78f..0ca1d1f418c3 100644 --- a/fs/fuse/control.c +++ b/fs/fuse/control.c @@ -31,37 +31,36 @@ static struct fuse_conn *fuse_ctl_file_conn_get(struct file *file) return fc; } -static ssize_t fuse_conn_abort_write(struct file *file, const char __user *buf, - size_t count, loff_t *ppos) +static ssize_t fuse_conn_abort_write(struct kiocb *iocb, struct iov_iter *from) { - struct fuse_conn *fc = fuse_ctl_file_conn_get(file); + struct fuse_conn *fc = fuse_ctl_file_conn_get(iocb->ki_filp); if (fc) { if (fc->abort_err) fc->aborted = true; fuse_abort_conn(fc); fuse_conn_put(fc); } - return count; + return iov_iter_count(from); } -static ssize_t fuse_conn_waiting_read(struct file *file, char __user *buf, - size_t len, loff_t *ppos) +static ssize_t fuse_conn_waiting_read_iter(struct kiocb *iocb, + struct iov_iter *to) { char tmp[32]; size_t size; - if (!*ppos) { + if (!iocb->ki_pos) { long value; - struct fuse_conn *fc = fuse_ctl_file_conn_get(file); + struct fuse_conn *fc = fuse_ctl_file_conn_get(iocb->ki_filp); if (!fc) return 0; value = atomic_read(&fc->num_waiting); - file->private_data = (void *)value; + iocb->ki_filp->private_data = (void *)value; fuse_conn_put(fc); } - size = sprintf(tmp, "%ld\n", (long)file->private_data); - return simple_read_from_buffer(buf, len, ppos, tmp, size); + size = sprintf(tmp, "%ld\n", (long)iocb->ki_filp->private_data); + return simple_copy_to_iter(tmp, &iocb->ki_pos, size, to); } static ssize_t fuse_conn_limit_read(struct file *file, char __user *buf, @@ -115,6 +114,7 @@ static ssize_t fuse_conn_max_background_read(struct file *file, return fuse_conn_limit_read(file, buf, len, ppos, val); } +FOPS_READ_ITER_HELPER(fuse_conn_max_background_read); static ssize_t fuse_conn_max_background_write(struct file *file, const char __user *buf, @@ -140,6 +140,7 @@ static ssize_t fuse_conn_max_background_write(struct file *file, return ret; } +FOPS_WRITE_ITER_HELPER(fuse_conn_max_background_write); static ssize_t fuse_conn_congestion_threshold_read(struct file *file, char __user *buf, size_t len, @@ -179,30 +180,31 @@ static ssize_t fuse_conn_congestion_threshold_write(struct file *file, out: return ret; } +FOPS_WRITE_ITER_HELPER(fuse_conn_congestion_threshold_write); static const struct file_operations fuse_ctl_abort_ops = { .open = nonseekable_open, - .write = fuse_conn_abort_write, + .write_iter = fuse_conn_abort_write, .llseek = no_llseek, }; static const struct file_operations fuse_ctl_waiting_ops = { .open = nonseekable_open, - .read = fuse_conn_waiting_read, + .read_iter = fuse_conn_waiting_read_iter, .llseek = no_llseek, }; static const struct file_operations fuse_conn_max_background_ops = { .open = nonseekable_open, - .read = fuse_conn_max_background_read, - .write = fuse_conn_max_background_write, + .read_iter = fuse_conn_max_background_read_iter, + .write_iter = fuse_conn_max_background_write_iter, .llseek = no_llseek, }; static const struct file_operations fuse_conn_congestion_threshold_ops = { .open = nonseekable_open, .read = fuse_conn_congestion_threshold_read, - .write = fuse_conn_congestion_threshold_write, + .write_iter = fuse_conn_congestion_threshold_write_iter, .llseek = no_llseek, }; -- 2.43.0