From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oo1-f46.google.com (mail-oo1-f46.google.com [209.85.161.46]) (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 6C495CA6F for ; Wed, 1 Jul 2026 00:11:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782864675; cv=none; b=nvHRv6X2pSDWZXZ2d9ASqWqfJgfatY7zYhK2vmt6gPm2MfPVrOCffLvl/pQOhMCjRxMWKrzwl6AKSz592YCodub8LngmfEL9Hx+AQnIZMaVLKThKsDdOk7A1TdAOJBAH7J+aigcwsABM3T1kr2M3JptY4ZUYqgbvTAE7LhJ/bgQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782864675; c=relaxed/simple; bh=zHWmKUCnN9WkUCSZXVq2kyOq9l5T0i6QS1ziiAD3fMw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=M+C6hcvqeXuUtKhNOSI9IIGgbfgnr3G1Xa2zsnY1sDkLht0OvXDzbXk6EsYj3iMzXTESklrw0H362ULL93hSz2Kc73I1eG3kdY7fR9NWz3YxHEHBMqgvuNfB8Sb9zp8dt4ffjkTwbcOnGBG2Li4wdwJ1FDD8HP1chE8UPIiiELI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QqegPpk6; arc=none smtp.client-ip=209.85.161.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QqegPpk6" Received: by mail-oo1-f46.google.com with SMTP id 006d021491bc7-69de16f5f79so39691eaf.0 for ; Tue, 30 Jun 2026 17:11:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1782864673; x=1783469473; 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=oNPbzx+vXvTNK/IK2NGcoyn2nveTdVJbNDgmvFlw3Co=; b=QqegPpk6ZFxWjZ0P0x7QqsQzHJouuNh3I5khH5Vz5JflEAw2IjjYIaYri9/e6AL26O boea6qJ9R82kOTnu65PavNPteJx6MyOn7a2zCKB/JPjeERU1EVh//We8vH1N8Or9oa9R qhvtERVqtDmluTY1Pkc+uws2upzOGFyPyCXTm947fifCwgY5dDJ+n2d9EyPmGdYHyhTW G9AU7EQyg6gdRFwa/jfHbk22OBt4bTYOOsGzIAfYjQkg2+ss7+4cRyV3kMeFlKCL0C8q 1/SFbOhN6Lz3tw0+4VY4WjDvSoVDg5L6MV2DzILvlg7X4SJmDDxyT8TeZn8OqlrHtwV4 5FRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782864673; x=1783469473; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=oNPbzx+vXvTNK/IK2NGcoyn2nveTdVJbNDgmvFlw3Co=; b=X4uVg5wswJ4AmXWnQJGoXHPyPtbctNA0FzLvZetXqohfuisLV+gYvQRN/pvqneqCW3 iVFRz2DCuBaaNRihxv1t+w+mrqQF07dOR6o8eZdz6wy3/wqKfb/qCl0tSW+l4teDO/0l mWNGf0GNOC1ZQ/Prcq0nAr9Lnre7qgLLSXUaeU/ztYqnm6VeV/r3rjCED5s/EzxdCFmw PAuJLrNgnA5eVs1tiZ5QkTjjXp7LKXE/1qnDgEFCuIDP4uqhzGFl4B5LkiovcZ71ks3C onBv+oy0O07iruNE+9veAB9c7R2oKtylF41LPLPLmm1RQgQrAmNRCXjSiNvy9dbo27tK UIhg== X-Forwarded-Encrypted: i=1; AFNElJ8S/HuuwCvLhKZhH0j3ycbrwhl+O5jkvN2uRcnjCouPGpjQ1BNpNAQIzfFWyeQ93yzovt/x64u4hQv0nBc=@vger.kernel.org X-Gm-Message-State: AOJu0YyRH/OSutEjoV/85I9vuvMmOOisN9+DAq/mbosCOBPyzqEyTiS+ 9Ej4WZMfMniJ2gR1QBZGnw1s72zYjmUaIXSkzhjuhVw9ToV+JXTCtLXI X-Gm-Gg: AfdE7cmRgcUdIej2dlTmrRFIIe9eRs+R5ZiCueMVEZDObGgv1LX+rlHHRKZBZ441YHM 7nlNDnRvc8/mPIrmmBKlzGLQ5Sc4j6X5vby38ppL/VcrRK9NhH3/jho6WEn/941/sSJhVpkLIP4 6Z7rlr52MJ5O7ParWyXyMQ2XzOet84cDBiOI14MUMvs/ytZsvaTKiRYMlfBgBfflPtLNkeWkj29 h/moCForO8GDyU7DMZVX6qcTkJVUt7GBVx96w57/9WmiXG4Ch5Oyl89AvW7GXVgta8d2PVZI/TV PxruX8GmNWXm+rvC4WS74Boe1jXdT/JzgOssOC9cRaqTRGja6p84OnTr9rfw/0YeL3cI0r9E/Sd t+BaW6/GOmsJDtp+5H2livTKbe1BA6bukymdqEwhsPGTElyJ2ik+1ysdLBXsdniGA79SfptrtIv 0HpGCugMHDjGox5RsMfwBo4ZN9mY0vfDDUh2McHJzjjsFJ1GN7Ahfx+pbPDUpb1hc= X-Received: by 2002:a05:6820:4dc2:b0:6a0:a791:6885 with SMTP id 006d021491bc7-6a1890a59b5mr4146462eaf.23.1782864673320; Tue, 30 Jun 2026 17:11:13 -0700 (PDT) Received: from localhost ([2a03:2880:ff:4::]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-44c5f7b8b80sm366853fac.0.2026.06.30.17.11.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jun 2026 17:11:12 -0700 (PDT) From: Joanne Koong To: brauner@kernel.org, hch@lst.de Cc: djwong@kernel.org, willy@infradead.org, hsiangkao@linux.alibaba.com, linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, Carlos Maiolino , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v2 02/18] xfs: convert iomap ops to ->iomap_next() Date: Tue, 30 Jun 2026 17:09:17 -0700 Message-ID: <20260701000949.1666714-3-joannelkoong@gmail.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260701000949.1666714-1-joannelkoong@gmail.com> References: <20260701000949.1666714-1-joannelkoong@gmail.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 Convert xfs iomap_ops to the new ->iomap_next() callback. This uses the iomap_process() helper, which finishes the previous mapping if needed and produces the next one. No functional changes are intended. Signed-off-by: Joanne Koong --- fs/xfs/xfs_file.c | 4 +- fs/xfs/xfs_iomap.c | 96 +++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 88 insertions(+), 12 deletions(-) diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index 845a97c9b063..7f8bef1a9954 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c @@ -857,9 +857,9 @@ xfs_file_dio_write_atomic( NULL, 0); /* - * The retry mechanism is based on the ->iomap_begin method returning + * The retry mechanism is based on the ->iomap_next method returning * -ENOPROTOOPT, which would be when the REQ_ATOMIC-based write is not - * possible. The REQ_ATOMIC-based method typically not be possible if + * possible. The REQ_ATOMIC-based method is typically not possible if * the write spans multiple extents or the disk blocks are misaligned. */ if (ret == -ENOPROTOOPT && dops == &xfs_direct_write_iomap_ops) { diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c index 225c3de88d03..4fa1a5c985db 100644 --- a/fs/xfs/xfs_iomap.c +++ b/fs/xfs/xfs_iomap.c @@ -1037,8 +1037,18 @@ xfs_direct_write_iomap_begin( return error; } +static int +xfs_direct_write_iomap_next( + const struct iomap_iter *iter, + struct iomap *iomap, + struct iomap *srcmap) +{ + return iomap_process(iter, iomap, srcmap, xfs_direct_write_iomap_begin, + NULL); +} + const struct iomap_ops xfs_direct_write_iomap_ops = { - .iomap_begin = xfs_direct_write_iomap_begin, + .iomap_next = xfs_direct_write_iomap_next, }; #ifdef CONFIG_XFS_RT @@ -1089,8 +1099,18 @@ xfs_zoned_direct_write_iomap_begin( return 0; } +static int +xfs_zoned_direct_write_iomap_next( + const struct iomap_iter *iter, + struct iomap *iomap, + struct iomap *srcmap) +{ + return iomap_process(iter, iomap, srcmap, + xfs_zoned_direct_write_iomap_begin, NULL); +} + const struct iomap_ops xfs_zoned_direct_write_iomap_ops = { - .iomap_begin = xfs_zoned_direct_write_iomap_begin, + .iomap_next = xfs_zoned_direct_write_iomap_next, }; #endif /* CONFIG_XFS_RT */ @@ -1274,8 +1294,18 @@ xfs_atomic_write_cow_iomap_begin( return error; } +static int +xfs_atomic_write_cow_iomap_next( + const struct iomap_iter *iter, + struct iomap *iomap, + struct iomap *srcmap) +{ + return iomap_process(iter, iomap, srcmap, + xfs_atomic_write_cow_iomap_begin, NULL); +} + const struct iomap_ops xfs_atomic_write_cow_iomap_ops = { - .iomap_begin = xfs_atomic_write_cow_iomap_begin, + .iomap_next = xfs_atomic_write_cow_iomap_next, }; static int @@ -1298,9 +1328,18 @@ xfs_dax_write_iomap_end( return xfs_reflink_end_cow(ip, pos, written); } +static int +xfs_dax_write_iomap_next( + const struct iomap_iter *iter, + struct iomap *iomap, + struct iomap *srcmap) +{ + return iomap_process(iter, iomap, srcmap, xfs_direct_write_iomap_begin, + xfs_dax_write_iomap_end); +} + const struct iomap_ops xfs_dax_write_iomap_ops = { - .iomap_begin = xfs_direct_write_iomap_begin, - .iomap_end = xfs_dax_write_iomap_end, + .iomap_next = xfs_dax_write_iomap_next, }; /* @@ -2168,9 +2207,19 @@ xfs_buffered_write_iomap_end( return 0; } +static int +xfs_buffered_write_iomap_next( + const struct iomap_iter *iter, + struct iomap *iomap, + struct iomap *srcmap) +{ + return iomap_process(iter, iomap, srcmap, + xfs_buffered_write_iomap_begin, + xfs_buffered_write_iomap_end); +} + const struct iomap_ops xfs_buffered_write_iomap_ops = { - .iomap_begin = xfs_buffered_write_iomap_begin, - .iomap_end = xfs_buffered_write_iomap_end, + .iomap_next = xfs_buffered_write_iomap_next, }; static int @@ -2214,8 +2263,17 @@ xfs_read_iomap_begin( shared ? IOMAP_F_SHARED : 0, seq); } +static int +xfs_read_iomap_next( + const struct iomap_iter *iter, + struct iomap *iomap, + struct iomap *srcmap) +{ + return iomap_process(iter, iomap, srcmap, xfs_read_iomap_begin, NULL); +} + const struct iomap_ops xfs_read_iomap_ops = { - .iomap_begin = xfs_read_iomap_begin, + .iomap_next = xfs_read_iomap_next, }; static int @@ -2302,8 +2360,17 @@ xfs_seek_iomap_begin( return error; } +static int +xfs_seek_iomap_next( + const struct iomap_iter *iter, + struct iomap *iomap, + struct iomap *srcmap) +{ + return iomap_process(iter, iomap, srcmap, xfs_seek_iomap_begin, NULL); +} + const struct iomap_ops xfs_seek_iomap_ops = { - .iomap_begin = xfs_seek_iomap_begin, + .iomap_next = xfs_seek_iomap_next, }; static int @@ -2349,8 +2416,17 @@ xfs_xattr_iomap_begin( return xfs_bmbt_to_iomap(ip, iomap, &imap, flags, IOMAP_F_XATTR, seq); } +static int +xfs_xattr_iomap_next( + const struct iomap_iter *iter, + struct iomap *iomap, + struct iomap *srcmap) +{ + return iomap_process(iter, iomap, srcmap, xfs_xattr_iomap_begin, NULL); +} + const struct iomap_ops xfs_xattr_iomap_ops = { - .iomap_begin = xfs_xattr_iomap_begin, + .iomap_next = xfs_xattr_iomap_next, }; int -- 2.52.0