From nobody Fri Dec 19 17:15:17 2025 Received: from mail-io1-f50.google.com (mail-io1-f50.google.com [209.85.166.50]) (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 87DD31D2A1E for ; Thu, 11 Apr 2024 15:39:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712849983; cv=none; b=CbEbHhK5uRLIqqsnqVTdxLuKVHLNJrsTlexdULIkeVvgkI3PDKtmxANezQySIrV7nSa4Jd0KA3J8awHzmkYRcJcxM903Zz/xjV9GzNGx8gll/QBm1C2swSmXcqQdA+6JXv0yE4jclDKsWal/65K5w/BK9TN8nxtn9IuU+doZ4FY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712849983; c=relaxed/simple; bh=ES225KtuVoJ5i6v6nvtizWVMfFAa5TGb/0Yk5uukEPE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=r9n1ucvtgxKtEyPR6nh9TOBoc8yLc61XTygGwJ5LBI/YsYqUrcRCxuvXQOMO6XlDif/VsPXAU2fs1h/HjtDfbS2aOqxzpFTJrigrEzt8YQUfby1dXapmnS7PdnzTGIVj53rZxbLKI3AjnoTvobjWySiAt2y96xE0eBq5Hw/D2Wc= 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=n0WHij6j; arc=none smtp.client-ip=209.85.166.50 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 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="n0WHij6j" Received: by mail-io1-f50.google.com with SMTP id ca18e2360f4ac-7cc0e831e11so170583139f.1 for ; Thu, 11 Apr 2024 08:39:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1712849980; x=1713454780; 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=+nLu7wpnWOLvM+s2AzprnSTFqRjsfhkfx2fTjpg7ngA=; b=n0WHij6je4wpMpzHb7A5vMzVc1l0h1v5QeJJZNviDy7eK9Xj/SLRKsy5Jyp9jXaVtM LkCSS7Nhbh9dydZQfsXcuBAmUXBOP5uVdsWUyYG0t7cVP5S2x2VlOoSPJphh56hevEJY uAgt0xWaC2QwKYYQw28AktFTaWKgs/ADFoCKRuJLa9fJL2wqdlY2PrlPYmeekvqNhvDs NbTVnZWekg2c7U/kCc5gWQtmzwzphJD8D/9EsubiYP4K+YltzhfrQmlOomMb3SV3KsJM g6HSL3/33Nz9iKsZzmPlbHd1frcGAaxhK9TnqJoB0HNlje4N4Q7HtOFbFV2tPGkD4pO/ MILw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712849980; x=1713454780; 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=+nLu7wpnWOLvM+s2AzprnSTFqRjsfhkfx2fTjpg7ngA=; b=dtq8dCnBcT70KeXT3cVJTGLB93zSDiQnBfW0jqnDMC05go0NcMRmK1OlUOOtqulk5c 9hnEiOSn6V0vpwsMIUcHLsAkPSJVGuu0VeY5MCzzQybyJpWd5kQ7gvNlcC11ppx2BTEm mDtdFIu4n8gA93P5Bd5//jnqQfpXRMVbDCb39hHa5+oJ/WVACcKpP6o74X6JTV31Y1go RjhFIz1f0P1WqvtBzKVns+54xLGEq6jx63DohNeLECja8r45y47gc92q9tUPlFz9VbQK QhGq2/bOJg0obZRSKJjtfbByE4fvKMb5wBXtJHXV+ZIOyTRcWYZ0Zidi4Ogr+Rcjpi6k EwvQ== X-Gm-Message-State: AOJu0Yw8TDqSXaBGG1XnksgOqNLQjp2NDK2lK30bUHpGHBDcAQ2GyAMd eU+tgfNh4+mheIPYNp6/j4HSfAkEe6ct7k0fIz8wpXZ50GcP1eVPD15Y+PlWFLWU4+3+PmJC7K9 X X-Google-Smtp-Source: AGHT+IFKxP68b1/qavwsvg18NGRRbHieEwN3uZfjp4zvWzZzKwO/J4I5ASD4jVp8a+UNEuY2tJWbLQ== X-Received: by 2002:a92:d352:0:b0:36a:1275:4aeb with SMTP id a18-20020a92d352000000b0036a12754aebmr5890513ilh.1.1712849980225; Thu, 11 Apr 2024 08:39:40 -0700 (PDT) Received: from localhost.localdomain ([96.43.243.2]) by smtp.gmail.com with ESMTPSA id jc25-20020a056638891900b0047f14b7f6c0sm457056jab.5.2024.04.11.08.39.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 08:39:39 -0700 (PDT) From: Jens Axboe To: linux-kernel@vger.kernel.org Cc: Jens Axboe Subject: [PATCH 290/437] fs/ocfs2: convert to read/write iterators Date: Thu, 11 Apr 2024 09:17:10 -0600 Message-ID: <20240411153126.16201-291-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: quoted-printable Content-Type: text/plain; charset="utf-8" Signed-off-by: Jens Axboe --- fs/ocfs2/cluster/netdebug.c | 11 ++++++----- fs/ocfs2/dlmfs/dlmfs.c | 38 +++++++++++++++++-------------------- 2 files changed, 23 insertions(+), 26 deletions(-) diff --git a/fs/ocfs2/cluster/netdebug.c b/fs/ocfs2/cluster/netdebug.c index fde10358c8ee..877955f35aef 100644 --- a/fs/ocfs2/cluster/netdebug.c +++ b/fs/ocfs2/cluster/netdebug.c @@ -468,17 +468,18 @@ static int o2net_debug_release(struct inode *inode, s= truct file *file) return 0; } =20 -static ssize_t o2net_debug_read(struct file *file, char __user *buf, - size_t nbytes, loff_t *ppos) +static ssize_t o2net_debug_read(struct kiocb *iocb, struct iov_iter *to) { - return simple_read_from_buffer(buf, nbytes, ppos, file->private_data, - i_size_read(file->f_mapping->host)); + struct file *file =3D iocb->ki_filp; + + return simple_copy_to_iter(file->private_data, &iocb->ki_pos, + i_size_read(file->f_mapping->host), to); } =20 static const struct file_operations nodes_fops =3D { .open =3D nodes_fop_open, .release =3D o2net_debug_release, - .read =3D o2net_debug_read, + .read_iter =3D o2net_debug_read, .llseek =3D generic_file_llseek, }; =20 diff --git a/fs/ocfs2/dlmfs/dlmfs.c b/fs/ocfs2/dlmfs/dlmfs.c index 7fc0e920eda7..a13b80cb11f1 100644 --- a/fs/ocfs2/dlmfs/dlmfs.c +++ b/fs/ocfs2/dlmfs/dlmfs.c @@ -28,6 +28,7 @@ #include #include #include +#include =20 #include =20 @@ -219,47 +220,42 @@ static __poll_t dlmfs_file_poll(struct file *file, po= ll_table *wait) return event; } =20 -static ssize_t dlmfs_file_read(struct file *file, - char __user *buf, - size_t count, - loff_t *ppos) +static ssize_t dlmfs_file_read(struct kiocb *iocb, struct iov_iter *to) { char lvb[DLM_LVB_LEN]; =20 - if (!user_dlm_read_lvb(file_inode(file), lvb)) + if (!user_dlm_read_lvb(file_inode(iocb->ki_filp), lvb)) return 0; =20 - return simple_read_from_buffer(buf, count, ppos, lvb, sizeof(lvb)); + return simple_copy_to_iter(lvb, &iocb->ki_pos, sizeof(lvb), to); } =20 -static ssize_t dlmfs_file_write(struct file *filp, - const char __user *buf, - size_t count, - loff_t *ppos) +static ssize_t dlmfs_file_write(struct kiocb *iocb, struct iov_iter *from) { char lvb_buf[DLM_LVB_LEN]; - int bytes_left; - struct inode *inode =3D file_inode(filp); + int copied; + struct inode *inode =3D file_inode(iocb->ki_filp); + size_t count =3D iov_iter_count(from); =20 mlog(0, "inode %lu, count =3D %zu, *ppos =3D %llu\n", - inode->i_ino, count, *ppos); + inode->i_ino, count, iocb->ki_pos); =20 - if (*ppos >=3D DLM_LVB_LEN) + if (iocb->ki_pos >=3D DLM_LVB_LEN) return -ENOSPC; =20 /* don't write past the lvb */ - if (count > DLM_LVB_LEN - *ppos) - count =3D DLM_LVB_LEN - *ppos; + if (count > DLM_LVB_LEN - iocb->ki_pos) + count =3D DLM_LVB_LEN - iocb->ki_pos; =20 if (!count) return 0; =20 - bytes_left =3D copy_from_user(lvb_buf, buf, count); - count -=3D bytes_left; + copied =3D copy_from_iter(lvb_buf, count, from); + count -=3D copied; if (count) user_dlm_write_lvb(inode, lvb_buf, count); =20 - *ppos =3D *ppos + count; + iocb->ki_pos +=3D count; mlog(0, "wrote %zu bytes\n", count); return count; } @@ -525,8 +521,8 @@ static const struct file_operations dlmfs_file_operatio= ns =3D { .open =3D dlmfs_file_open, .release =3D dlmfs_file_release, .poll =3D dlmfs_file_poll, - .read =3D dlmfs_file_read, - .write =3D dlmfs_file_write, + .read_iter =3D dlmfs_file_read, + .write_iter =3D dlmfs_file_write, .llseek =3D default_llseek, }; =20 --=20 2.43.0