Btrfs: do not run snapshot-aware defragment on error
authorLiu Bo <bo.li.liu@oracle.com>
Tue, 29 Oct 2013 02:45:05 +0000 (10:45 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 20 Dec 2013 15:45:12 +0000 (07:45 -0800)
commitf5749e3720c038fe92dc9ffb5e6fe7b4d8809ea1
tree77590b8afd7012083cc6e03711a43ee1df53f00c
parent9436cf971ed1aa296e6ca36489f5240d3868ff84
Btrfs: do not run snapshot-aware defragment on error

commit 6f519564d7d978c00351d9ab6abac3deeac31621 upstream.

If something wrong happens in write endio, running snapshot-aware defragment
can end up with undefined results, maybe a crash, so we should avoid it.

In order to share similar code, this also adds a helper to free the struct for
snapshot-aware defrag.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/inode.c