diff --git a/[refs] b/[refs] index ef4bb02e173e..8d51eb8e43fa 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 2a0f7f5769992bae5b3f97157fd80b2b943be485 +refs/heads/master: f7f43cc84152e53b5687cd0eb8823310ba065524 diff --git a/trunk/fs/btrfs/ioctl.c b/trunk/fs/btrfs/ioctl.c index df40b7c5f06b..efc4e4a85a69 100644 --- a/trunk/fs/btrfs/ioctl.c +++ b/trunk/fs/btrfs/ioctl.c @@ -1062,7 +1062,9 @@ int btrfs_defrag_file(struct inode *inode, struct file *file, if (i < inode->i_mapping->writeback_index) inode->i_mapping->writeback_index = i; - while (i <= last_index && defrag_count < max_to_defrag) { + 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