From nobody Fri Jul 24 21:52:56 2026 Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) (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 5BB5C36F428 for ; Fri, 24 Jul 2026 05:26:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784870778; cv=none; b=uO0sYriCzpe66NVEJSSntGKwZcn9vyDiE7amHqPOZyMqz/OQYTSH114yRfyd9tD/6ulhKlQR943tORBzS9l8EiEMEyWX9W7McN9YNtt0gibt60I+q5I9/Gvyhx352+u7s5t/jgYAaaJhghxnVOw2/cJO82qFcEIWM7oqUXoEbAQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784870778; c=relaxed/simple; bh=WKqoca10O4t3Oju347uRIWeepA/cddxAeo+Q1+BF/BY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=gEJ1EnZZMANKJDosVTCfszcHs8JeFfS9MqqqAB7Q4pTIZ66+tGGqtHmLs33TfsL5qD7haSQrm3f38OMXQLe1GEGMbzDXs5KDa58yQ6GThDjCsvkW3SrC/AOIXn06Kumn2iaCgtC3sr5ICeU2ypUhfE0YG0O0SY1EtdAOsH4JqZU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=U1B0Z/u+; arc=none smtp.client-ip=209.85.208.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="U1B0Z/u+" Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-69848c9462aso4115a12.2 for ; Thu, 23 Jul 2026 22:26:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1784870774; x=1785475574; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=r268vXjA5mG0+LPoOSbwKU1HHavlapa/3U4ORjTQk7M=; b=U1B0Z/u+FEMoImQwXWmCL/XuqgirwS4zn/7KdRSd8vRDgbSURbno8xihcoLewEPzux /7zUyxE73h8VtUAsT9ENhQFv/TJfXXCfaFGI3un45ctOXypYIzUlyNBaysmg71lWGwfc 3VFKaUH3FZAVc/al4FFhPTvQ3Jw5G6i0+uVGDSCp1qPWV/tHvJHFF8FxHT5ePuhie25p a2JrjwqWLDKbapQLu/MTIfmGuuJFIdaPwQbCHiKE8Qi24FnFv6lJFqE4LVmleC7P9xGJ sSoyAzI7Ky//1W8GdDOKSmoFec2x4ycs1wr7cFcSA2GHI5ZNj5P9MKEAyjR6+QgHncgL kKRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784870774; x=1785475574; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=r268vXjA5mG0+LPoOSbwKU1HHavlapa/3U4ORjTQk7M=; b=GZAAc04SJcWZ0egrB0D2P7eblcM/gnsBK8G2WcuPe92SnSzj7yyL0r9bhwNY67XNTR 4PKFoG0bkdnTwKdEboXlDL51R3T/mDAqzHfaK+jlMmmE9h9kDxhJXBuClki+Ke1PPfSU AI/vCzyJN6oQHrr963f4methks+z5RukB1e0gfuj5tWnPXxtesrGqD6tpcET+twQWMR5 Rtup4+mSBn5xwh3ltBOuYhyykLX2Si73tm6zlIBIcXKqwN03IHW6CK6pG4mDQWy5zQXj oi1Z9ho5eYDwp9cVITgouu6+oWI2uA/SaiDGclEST8e44XtIdQJ3vXGlBv4ZERMfcfoN +5XQ== X-Forwarded-Encrypted: i=1; AHgh+Rox8aKoiv9w4qQ/L0crNIyjmeZDQBE7DkNgS+vt0Ka3s5CgAz6PHuYUAkB5m5eC13a4k9hC37i0R+2OBs8=@vger.kernel.org X-Gm-Message-State: AOJu0YzLstCdRadOrOldPhJfuUFfqKyNfgXM+hopsPIpoE2eDq7Rxo8O UMpvnP6l4xjy8NfXDHh46bHYMj1mAFZv514h3tIjrPp45NBNfFQcqkUtROVOsjwgH8E= X-Gm-Gg: AR+sD11iOLtRMsb5H19B+lZv9Ypztqf9s9670/airEmSaMZbfCh2+jnEDQqB8XgXPMO rkRs6nQBu8foECoiHIK4wq22vOzj9cvlSh+XWNN3ktSQJxvdkuBAWnM+e7NYkXCEaTNFl6/w2QN dm9n94r7gOuFH36psae8yiABNJm+RM7k8pME6eJS3ZVDvlbU9W2ug7ig4OOlyhNJ3F6LP96SGET 9OIej77fxDFj+ldnJnQpn0GGT3gTMwZqphI7EdZlnhr/RI9wULDbJQERpbDRURaGGHuo3abB7s3 afWgBr2UsuqGjZfod2Gmwcwm8FNFs4dKEJnVxM+Zs4hAAYh7IjpJY0x/O/8mvF2Nwumqod9b6KH YbqQrtg42EqjTyQWni18cRizM4cdyCyFcbrteaPlazaIO14CF+LSJ3uc/9GpnfNCx4YOYxE0Stj 19pd4= X-Received: by 2002:a05:6402:5255:b0:697:deb8:761a with SMTP id 4fb4d7f45d1cf-69f8ddeed17mr549117a12.6.1784870774551; Thu, 23 Jul 2026 22:26:14 -0700 (PDT) Received: from p15.suse.cz ([202.127.77.110]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-38f039b1ce3sm898577a91.4.2026.07.23.22.26.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2026 22:26:13 -0700 (PDT) From: Heming Zhao To: joseph.qi@linux.alibaba.com, mark@fasheh.com, jlbec@evilplan.org Cc: Heming Zhao , ocfs2-devel@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [RFC PATCH 0/3] migrates ocfs2 DIO from buffer_head to iomap Date: Fri, 24 Jul 2026 13:25:54 +0800 Message-ID: <20260724052559.15409-1-heming.zhao@suse.com> X-Mailer: git-send-email 2.54.0 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" This patch set migrates ocfs2 Direct I/O (DIO) from buffer_head mode to iomap mode. For patch [2/3], this patch leverages the top 2 bits of `iocb->ki_flags` (`IOCB_OCFS2_RW_LOCK` and `IOCB_OCFS2_RW_LOCK_LEVEL`) to safely carry the lock state into the `end_io` callback. If this patch set is accepted, I plan to submit a follow-up patch to the iomap module to introduce two dedicated flags for `iocb->ki_flags`, avoiding the need to use the top two bits internally in iomap. i.e.: ``` diff --git a/include/linux/fs.h b/include/linux/fs.h index 50ce731a2b78..ad9fd768746e 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -357,6 +357,8 @@ struct readahead_control; /* kiocb is a read or write operation submitted by fs/aio.c. */ #define IOCB_AIO_RW (1 << 22) #define IOCB_HAS_METADATA (1 << 23) +#define IOCB_FS_PRIVATE1 (1 << 30) +#define IOCB_FS_PRIVATE2 (1 << 31) =20 /* for use in trace events */ #define TRACE_IOCB_STRINGS \ ``` ---------------- This patch set has been tested on 7.2.0 kernel with the following test cases. ## ltp runltp -f dio -d /mnt/ocfs2/ The test results: passed ## xfstests ./check -g quick -T -b -s ocfs2 -e generic/081 \ -e generic/266 -e generic/272 -e generic/281 \ -e generic/338 -e generic/347 -e generic/361 \ -e generic/628 -e generic/629 -e generic/648 -e generic/650=20 The test results are the same before and after the patch set. Failures: generic/003 generic/322 generic/329 generic/331 generic/370 generic/376 generic/420 generic/424 generic/448 generic/449 generic/467 generic/477 generic/510 generic/513 generic/537 generic/552 generic/563 generic/578 generic/607 generic/620 generic/630 generic/755 generic/777 generic/784 Failed 24 of 632 tests ## fio on single node fio --direct=3D1 --iodepth=3D32 --rw=3Dwrite --ioengine=3Dlibaio --bs=3D128= k --size=3D1g \ --numjobs=3D4 --runtime=3D100 --group_reporting --filename=3D/mnt/ocfs2/wri= te.1g --name=3Dtst - before patch : write: IOPS=3D18.8k, BW=3D4708MiB/s (4937MB/s)(4096MiB/870= msec) - applied patch: write: IOPS=3D39.6k, BW=3D4953MiB/s (5193MB/s)(4096MiB/827= msec) - overwrite (don't remove write.1g, run above fio command) speed seems same= .=20 fio --direct=3D1 --iodepth=3D32 --rw=3Dread --ioengine=3Dlibaio --bs=3D128k= --size=3D1g \ --numjobs=3D4 --runtime=3D100 --group_reporting --filename=3D/mnt/ocfs2/wri= te.1g --name=3Dtst - before patch : read: IOPS=3D52.4k, BW=3D6554MiB/s (6872MB/s)(4096MiB/625m= sec) - applied patch: read: IOPS=3D52.2k, BW=3D6522MiB/s (6839MB/s)(4096MiB/628m= sec) fio --direct=3D1 --iodepth=3D32 --rw=3Drandwrite --ioengine=3Dlibaio --bs= =3D4k --size=3D1g \ --numjobs=3D4 --runtime=3D100 --group_reporting --filename=3D/mnt/ocfs2/wri= te.1g --name=3Dtst - before patch - creating write: IOPS=3D20.9k, BW=3D81.7MiB/s (85.6MB/s)(4096MiB/50159ms= ec) - overwriting write.1g: write: IOPS=3D281k, BW=3D1097MiB/s (1151MB/s)(409= 6MiB/3733msec) - applied patch - creating write: IOPS=3D21.0k, BW=3D82.0MiB/s (86.0MB/s)(4096MiB/49938ms= ec) - overwriting write.1g: write: IOPS=3D329k, BW=3D1286MiB/s (1348MB/s)(409= 6MiB/3185msec)=20 fio --direct=3D1 --iodepth=3D32 --rw=3Drandread --ioengine=3Dlibaio --bs=3D= 4k --size=3D1g \ --numjobs=3D4 --runtime=3D100 --group_reporting --filename=3D/mnt/ocfs2/wri= te.1g --name=3Dtst - before patch : read: IOPS=3D372k, BW=3D1452MiB/s (1522MB/s)(4096MiB/2821m= sec) - applied patch: read: IOPS=3D369k, BW=3D1441MiB/s (1511MB/s)(4096MiB/2842m= sec) ## fio on two nodes ### write in different folder node1 /root/fio/diff/ocfs2-w.sh: > fio --direct=3D1 --iodepth=3D32 --rw=3Dwrite --ioengine=3Dlibaio --bs=3D1= 28k --size=3D2g \ --numjobs=3D2 --runtime=3D100 --group_reporting --filename=3D/mnt/ocfs2/nod= e1/write.2g --name=3Dtst node2 /root/fio/diff/ocfs2-w.sh: > fio --direct=3D1 --iodepth=3D32 --rw=3Dwrite --ioengine=3Dlibaio --bs=3D1= 28k --size=3D2g \ --numjobs=3D2 --runtime=3D100 --group_reporting --filename=3D/mnt/ocfs2/nod= e2/write.2g --name=3Dtst node1 /root/fio/diff/ocfs2-randw.sh: > fio --direct=3D1 --iodepth=3D32 --rw=3Drandwrite --ioengine=3Dlibaio --bs= =3D4k --size=3D2g \ --numjobs=3D2 --runtime=3D100 --group_reporting --filename=3D/mnt/ocfs2/nod= e1/write.2g --name=3Dtst node2 /root/fio/diff/ocfs2-randw.sh: > fio --direct=3D1 --iodepth=3D32 --rw=3Drandwrite --ioengine=3Dlibaio --bs= =3D4k --size=3D2g \ --numjobs=3D2 --runtime=3D100 --group_reporting --filename=3D/mnt/ocfs2/nod= e2/write.2g --name=3Dtst run on both node,=20 pdsh -w ssh:tw2510-[1-2] /root/fio/diff/ocfs2-w.sh - before patch : write: IOPS=3D19.3k, BW=3D2417MiB/s (2534MB/s)(4096MiB/169= 5msec) - applied patch: write: IOPS=3D20.8k, BW=3D2599MiB/s (2725MB/s)(4096MiB/157= 6msec) pdsh -w ssh:tw2510-[1-2] /root/fio/diff/ocfs2-randw.sh - before patch : write: IOPS=3D3742, BW=3D14.6MiB/s (15.3MB/s)(1462MiB/1000= 07msec) - applied patch: write: IOPS=3D3765, BW=3D14.7MiB/s (15.4MB/s)(1471MiB/1000= 10msec) ### write in same file node1 & node2: (/root/fio/share/ocfs2-w.sh) fio --direct=3D1 --iodepth=3D32 --rw=3Dwrite --ioengine=3Dlibaio --bs=3D128= k --size=3D2g \ --numjobs=3D2 --runtime=3D100 --group_reporting --filename=3D/mnt/ocfs2/sha= re/write.2g --name=3Dtst node1 & node2: (/root/fio/share/ocfs2-randw.sh) fio --direct=3D1 --iodepth=3D32 --rw=3Drandwrite --ioengine=3Dlibaio --bs= =3D4k --size=3D2g \ --numjobs=3D2 --runtime=3D100 --group_reporting --filename=3D/mnt/ocfs2/sha= re/write.2g --name=3Dtst run on both node pdsh -w ssh:tw2510-[1-2] /root/fio/share/ocfs2-w.sh - before patch : write: IOPS=3D2052, BW=3D257MiB/s (269MB/s)(4096MiB/15967m= sec) - applied patch: write: IOPS=3D2558, BW=3D320MiB/s (335MB/s)(4096MiB/12808m= sec) pdsh -w ssh:tw2510-[1-2] /root/fio/share/ocfs2-randw.sh - before patch : write: IOPS=3D3588, BW=3D14.0MiB/s (14.7MB/s)(1402MiB/1000= 01msec) - applied patch: write: IOPS=3D3590, BW=3D14.0MiB/s (14.7MB/s)(1403MiB/1000= 01msec) Heming Zhao (3): ocfs2: Add new ocfs2_map_blocks() to introduce iomap feature ocfs2: switch dio read path from buffer_head to iomap ocfs2: switch dio write path from buffer_head to iomap fs/ocfs2/Kconfig | 1 + fs/ocfs2/aops.c | 580 +++++++++++++++++++++++++++++++++++++- fs/ocfs2/aops.h | 26 ++ fs/ocfs2/buffer_head_io.c | 19 +- fs/ocfs2/file.c | 108 ++++++- fs/ocfs2/ocfs2.h | 49 +++- fs/ocfs2/ocfs2_fs.h | 3 + 7 files changed, 753 insertions(+), 33 deletions(-) --=20 2.54.0