Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 274660
b: refs/heads/master
c: 151a31b
h: refs/heads/master
v: v3
  • Loading branch information
Li Zefan authored and David Sterba committed Oct 20, 2011
1 parent cf3cf72 commit 31d999e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cbcc83265d929ac71553c1b5dafdb830171af947
refs/heads/master: 151a31b25e5c941bdd9fdefed650effca223c716
7 changes: 4 additions & 3 deletions trunk/fs/btrfs/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,7 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
struct btrfs_super_block *disk_super;
struct file_ra_state *ra = NULL;
unsigned long last_index;
u64 isize = i_size_read(inode);
u64 features;
u64 last_len = 0;
u64 skip = 0;
Expand All @@ -1003,7 +1004,7 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
compress_type = range->compress_type;
}

if (inode->i_size == 0)
if (isize == 0)
return 0;

/*
Expand All @@ -1028,10 +1029,10 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,

/* find the last page to defrag */
if (range->start + range->len > range->start) {
last_index = min_t(u64, inode->i_size - 1,
last_index = min_t(u64, isize - 1,
range->start + range->len - 1) >> PAGE_CACHE_SHIFT;
} else {
last_index = (inode->i_size - 1) >> PAGE_CACHE_SHIFT;
last_index = (isize - 1) >> PAGE_CACHE_SHIFT;
}

if (newer_than) {
Expand Down

0 comments on commit 31d999e

Please sign in to comment.