Skip to content

U-boot: fs: add generic unaligned read offset handling

Qu Wenruo linux-btrfs linux-erofs u-boot 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest8 patches 1 replyIn review
  2. v28 patches 3 repliesSuperseded
  3. v18 patches 4 repliesSuperseded

Changes in v3 from the cover letter

- Fix an error that we always return 0 actread bytes for unsupported fses For unsupported fses, we should also populate @total_read. Or we will just read the data but still return 0 for actually bytes.

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8fs: fat: unexport file_fat_read_at()fs/fat/fat.c include/fat.h+2 -40 replies
2/8fs: btrfs: fix a bug which no data get read if the length is not 0fs/btrfs/btrfs.c+9 -80 replies
3/8fs: btrfs: fix a crash if specified range is beyond file sizefs/btrfs/btrfs.c+6 -00 replies
4/8fs: btrfs: move the unaligned read code to _fs_read() for btrfsfs/btrfs/btrfs.c fs/btrfs/inode.c fs/fs.c +1 more+141 -890 replies
5/8fs: ext4: rely on _fs_read() to handle leading unaligned block readfs/ext4/ext4fs.c fs/fs.c include/ext4fs.h+24 -10 replies
6/8fs: fat: rely on higher layer to get block aligned read rangefs/fat/fat.c fs/fs.c include/fat.h+15 -10 replies
7/8fs: ubifs: rely on higher layer to do unaligned readfs/fs.c fs/ubifs/ubifs.c include/ubifs_uboot.h+10 -60 replies
8/8fs: erofs: add unaligned read range handlingfs/erofs/internal.h fs/erofs/super.c fs/fs.c +1 more+9 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH v3 0/8] U-boot: fs: add generic unaligned read offset handling

[CHANGELOG]
v3:
- Fix an error that we always return 0 actread bytes for unsupported fses For unsupported fses, we should also populate @total_read. Or we will just read the data but still return 0 for actually bytes.

Now it pass all test_fs* cases.

v2
- Fix a linkage error where (U64 % U32) is called without proper helper Fix it with U64 & (U32 - 1), as the U32 value (@blocksize) should always be power of 2, thus (@blocksize - 1) is the mask we want to calculate the offset inside the block.

Above change only affects the 4th patch, everything else is not touched.

RFC->v1:
- More (manual) testing
Unfortunately, in the latest master (75967970850a), the fs-tests.sh always seems to hang at preparing the fs image.

Thus still has to do manual testing, tested btrfs, ext4 and fat, with aligned and unaligned read, also added soft link read, all looks fine here.

Extra testing is still appreciated.

- Two more btrfs specific bug fixes
All exposed during manual tests

- Remove the tailing unaligned block handling
In fact, all fses can easily handle such case, just a min() call is enough.

- Remove the support for sandboxfs
Since it's using read() calls, really no need to do block alignment check.

- Enhanced blocksize check
Ensure the returned blocksize is not only non-error, but also non-zero.

Qu Wenruo (8):
fs: fat: unexport file_fat_read_at()
fs: btrfs: fix a bug which no data get read if the length is not 0
fs: btrfs: fix a crash if specified range is beyond file size
fs: btrfs: move the unaligned read code to _fs_read() for btrfs
fs: ext4: rely on _fs_read() to handle leading unaligned block read
fs: fat: rely on higher layer to get block aligned read range
fs: ubifs: rely on higher layer to do unaligned read
fs: erofs: add unaligned read range handling

 fs/btrfs/btrfs.c      |  33 ++++++++---
 fs/btrfs/inode.c      |  89 +++--------------------------
 fs/erofs/internal.h   |   1 +
 fs/erofs/super.c      |   6 ++
 fs/ext4/ext4fs.c      |  22 +++++++
 fs/fat/fat.c          |  17 +++++-
 fs/fs.c               | 130 +++++++++++++++++++++++++++++++++++++++---
 fs/ubifs/ubifs.c      |  13 +++--
 include/btrfs.h       |   1 +
 include/erofs.h       |   1 +
 include/ext4fs.h      |   1 +
 include/fat.h         |   3 +-
 include/ubifs_uboot.h |   1 +
 13 files changed, 212 insertions(+), 106 deletions(-)
Signature · 1 line
2.37.1