Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 360449
b: refs/heads/master
c: 210549e
h: refs/heads/master
i:
  360447: 3a4bf49
v: v3
  • Loading branch information
David Sterba authored and Josef Bacik committed Feb 20, 2013
1 parent 7d1a5bd commit 3ebaa2a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b069e0c3450ae388d7a9c94ded6d938a465de262
refs/heads/master: 210549ebe9047ae5a8cc47487203d3ee16a7749b
7 changes: 7 additions & 0 deletions trunk/fs/btrfs/ctree.h
Original file line number Diff line number Diff line change
Expand Up @@ -3786,4 +3786,11 @@ static inline int is_fstree(u64 rootid)
return 1;
return 0;
}

static inline int btrfs_defrag_cancelled(struct btrfs_fs_info *fs_info)
{
return signal_pending(current);
}


#endif
6 changes: 6 additions & 0 deletions trunk/fs/btrfs/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1202,6 +1202,12 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
if (!(inode->i_sb->s_flags & MS_ACTIVE))
break;

if (btrfs_defrag_cancelled(root->fs_info)) {
printk(KERN_DEBUG "btrfs: defrag_file cancelled\n");
ret = -EAGAIN;
break;
}

if (!should_defrag_range(inode, (u64)i << PAGE_CACHE_SHIFT,
extent_thresh, &last_len, &skip,
&defrag_end, range->flags &
Expand Down
6 changes: 6 additions & 0 deletions trunk/fs/btrfs/transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -984,6 +984,12 @@ int btrfs_defrag_root(struct btrfs_root *root)

if (btrfs_fs_closing(root->fs_info) || ret != -EAGAIN)
break;

if (btrfs_defrag_cancelled(root->fs_info)) {
printk(KERN_DEBUG "btrfs: defrag_root cancelled\n");
ret = -EAGAIN;
break;
}
}
root->defrag_running = 0;
return ret;
Expand Down

0 comments on commit 3ebaa2a

Please sign in to comment.