diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2011-09-07 22:22:01 -0400 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2011-10-20 12:10:43 -0400 |
commit | 560f7d75457f86a43970aa413e334e394082dce4 (patch) | |
tree | 19167f699de731a0c9cc1faf44035e0e958ab9fb /fs/btrfs | |
parent | a05a9bb18ae0abec0b513b5fde876c47905fa13e (diff) |
Btrfs: remove BUG_ON() in compress_file_range()
It's not a big deal if we fail to allocate the array, and instead of
panic we can just give up compressing.
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/inode.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index f12747c9447b..81d4f68f35c9 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -393,7 +393,10 @@ again: | |||
393 | (BTRFS_I(inode)->flags & BTRFS_INODE_COMPRESS))) { | 393 | (BTRFS_I(inode)->flags & BTRFS_INODE_COMPRESS))) { |
394 | WARN_ON(pages); | 394 | WARN_ON(pages); |
395 | pages = kzalloc(sizeof(struct page *) * nr_pages, GFP_NOFS); | 395 | pages = kzalloc(sizeof(struct page *) * nr_pages, GFP_NOFS); |
396 | BUG_ON(!pages); | 396 | if (!pages) { |
397 | /* just bail out to the uncompressed code */ | ||
398 | goto cont; | ||
399 | } | ||
397 | 400 | ||
398 | if (BTRFS_I(inode)->force_compress) | 401 | if (BTRFS_I(inode)->force_compress) |
399 | compress_type = BTRFS_I(inode)->force_compress; | 402 | compress_type = BTRFS_I(inode)->force_compress; |
@@ -424,6 +427,7 @@ again: | |||
424 | will_compress = 1; | 427 | will_compress = 1; |
425 | } | 428 | } |
426 | } | 429 | } |
430 | cont: | ||
427 | if (start == 0) { | 431 | if (start == 0) { |
428 | trans = btrfs_join_transaction(root); | 432 | trans = btrfs_join_transaction(root); |
429 | BUG_ON(IS_ERR(trans)); | 433 | BUG_ON(IS_ERR(trans)); |