[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240625093851.73331-1-chunjie.zhu@cloud.com>
Date: Tue, 25 Jun 2024 09:38:51 +0000
From: Chunjie Zhu <chunjie.zhu@...ud.com>
To: "Darrick J. Wong" <djwong@...nel.org>
Cc: Chunjie Zhu <chunjie.zhu@...ud.com>,
linux-xfs@...r.kernel.org,
linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH v1 1/1] revert "iomap: add support for dma aligned direct-io"
This reverts commit bf8d08532bc19a14cfb54ae61099dccadefca446 as it
causes applications unable to probe a consistent value for direct
io buffer alignment, see an example,
buffer alignment: 512
|
ext3
|
buffer alignment: 4 lvm (dma_alignment: 511)
| |
xfs device mapper
| |
sda1 sda2
| |
--- sda (dma_alignment: 3) ---
Signed-off-by: Chunjie Zhu <chunjie.zhu@...ud.com>
---
fs/iomap/direct-io.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c
index bcd3f8cf5ea4..448b563a634c 100644
--- a/fs/iomap/direct-io.c
+++ b/fs/iomap/direct-io.c
@@ -277,7 +277,9 @@ static loff_t iomap_dio_bio_iter(const struct iomap_iter *iter,
{
const struct iomap *iomap = &iter->iomap;
struct inode *inode = iter->inode;
+ unsigned int blkbits = blksize_bits(bdev_logical_block_size(iomap->bdev));
unsigned int fs_block_size = i_blocksize(inode), pad;
+ unsigned int align = iov_iter_alignment(dio->submit.iter);
loff_t length = iomap_length(iter);
loff_t pos = iter->pos;
blk_opf_t bio_opf;
@@ -288,8 +290,7 @@ static loff_t iomap_dio_bio_iter(const struct iomap_iter *iter,
size_t copied = 0;
size_t orig_count;
- if ((pos | length) & (bdev_logical_block_size(iomap->bdev) - 1) ||
- !bdev_iter_is_aligned(iomap->bdev, dio->submit.iter))
+ if ((pos | length | align) & ((1 << blkbits) - 1))
return -EINVAL;
if (iomap->type == IOMAP_UNWRITTEN) {
--
2.34.1
Powered by blists - more mailing lists