]> www.infradead.org Git - users/jedix/linux-maple.git/commit
Btrfs: fix defragmentation regression
authorLi Zefan <lizf@cn.fujitsu.com>
Fri, 2 Sep 2011 07:56:25 +0000 (15:56 +0800)
committerChris Mason <chris.mason@oracle.com>
Wed, 16 Nov 2011 02:20:38 +0000 (21:20 -0500)
commit0e32366f3a5a31e70bb07feadb0131d2a7a4ca05
tree85b7481552dee91d4a84406487f6d3141e492f1a
parent51e73b968655202cb7e1433a2d645d7bce94fb7f
Btrfs: fix defragmentation regression

There's an off-by-one bug:

  # create a file with lots of 4K file extents
  # btrfs fi defrag /mnt/file
  # sync
  # filefrag -v /mnt/file
  Filesystem type is: 9123683e
  File size of /mnt/file is 1228800 (300 blocks, blocksize 4096)
   ext logical physical expected length flags
     0       0     3372              64
     1      64     3136     3435      1
     2      65     3436     3136     64
     3     129     3201     3499      1
     4     130     3500     3201     64
     5     194     3266     3563      1
     6     195     3564     3266     64
     7     259     3331     3627      1
     8     260     3628     3331     40 eof

After this patch:

  ...
  # filefrag -v /mnt/file
  Filesystem type is: 9123683e
  File size of /mnt/file is 1228800 (300 blocks, blocksize 4096)
   ext logical physical expected length flags
     0       0     3372             300 eof
  /mnt/file: 1 extent found

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
(cherry picked from commit cbcc83265d929ac71553c1b5dafdb830171af947)
fs/btrfs/ioctl.c