Skip to content

btrfs: fix cases of stat(2) reporting incorrect number of used blocks

[email protected] linux-btrfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 7 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4btrfs: fix missing delalloc new bit for new delalloc rangesfs/btrfs/file.c fs/btrfs/inode.c fs/btrfs/tests/inode-tests.c+65 -601 reply
2/4btrfs: refactor btrfs_drop_extents() to make it easier to extendfs/btrfs/ctree.h fs/btrfs/file.c fs/btrfs/inode.c +2 more+187 -1071 reply
3/4btrfs: fix race when defragging that leads to unnecessary IOfs/btrfs/ioctl.c+39 -01 reply
4/4btrfs: update the number of bytes used by an inode atomicallyfs/btrfs/btrfs_inode.h fs/btrfs/ctree.h fs/btrfs/extent-io-tree.h +5 more+171 -503 replies

Reviews trailers per patch

All 4 patches have a Reviewed-by or Acked-by.

PatchJosef Bacik
1/4R-b
2/4R-b
3/4R-b
4/4R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/4] btrfs: fix cases of stat(2) reporting incorrect number of used blocks

From: Filipe Manana <[email protected]>

There are several cases where a stat(2) call can report an incorrect number of used blocks. In some cases can even result in reporting 0 used blocks, which is a specially bad value to report when a file is not empty, and we had user bug reports in the past for such cases (the changelogs in the patches point to one such report).

This patchset addresses all those cases. The third patch fixes a race in defrag that while it does not result in a functional problem (data loss or some corruption), it leads to unnecessary IO and space allocation, and it's necessary for the 4th and final patch to work as it is.

A couple test cases for fstests will follow.

Filipe Manana (4):
btrfs: fix missing delalloc new bit for new delalloc ranges
btrfs: refactor btrfs_drop_extents() to make it easier to extend
btrfs: fix race when defragging that leads to unnecessary IO
btrfs: update the number of bytes used by an inode atomically

 fs/btrfs/btrfs_inode.h       |   3 +-
 fs/btrfs/ctree.h             |  71 ++++++++--
 fs/btrfs/extent-io-tree.h    |  16 ++-
 fs/btrfs/extent_io.c         |  10 +-
 fs/btrfs/file.c              | 246 +++++++++++++++--------------------
 fs/btrfs/inode.c             | 233 +++++++++++++++++++++++++++------
 fs/btrfs/ioctl.c             |  39 ++++++
 fs/btrfs/reflink.c           |   9 +-
 fs/btrfs/tests/inode-tests.c |  12 +-
 fs/btrfs/tree-log.c          |  32 +++--
 10 files changed, 458 insertions(+), 213 deletions(-)
Signature · 1 line
2.28.0