]> Pileus Git - ~andy/linux/commitdiff
Merge branch 'hotfixes-20111024/josef/for-chris' into btrfs-next-stable
authorDavid Sterba <dsterba@suse.cz>
Mon, 24 Oct 2011 12:47:58 +0000 (14:47 +0200)
committerDavid Sterba <dsterba@suse.cz>
Mon, 24 Oct 2011 12:47:58 +0000 (14:47 +0200)
1  2 
fs/btrfs/ioctl.c

index 877727b28d88d8d58b903dd2896b43d495833344,136a2f980e216392132c9c0a39cd6943cb1d917b..33aae13cc74b56a0b20b4643c7ffe1e6251c3860
@@@ -1051,18 -1055,9 +1055,18 @@@ int btrfs_defrag_file(struct inode *ino
                i = range->start >> PAGE_CACHE_SHIFT;
        }
        if (!max_to_defrag)
-               max_to_defrag = last_index - 1;
+               max_to_defrag = last_index;
  
 -      while (i <= last_index && defrag_count < max_to_defrag) {
 +      /*
 +       * make writeback starts from i, so the defrag range can be
 +       * written sequentially.
 +       */
 +      if (i < inode->i_mapping->writeback_index)
 +              inode->i_mapping->writeback_index = i;
 +
 +      while (i <= last_index && defrag_count < max_to_defrag &&
 +             (i < (i_size_read(inode) + PAGE_CACHE_SIZE - 1) >>
 +              PAGE_CACHE_SHIFT)) {
                /*
                 * make sure we stop running if someone unmounts
                 * the FS