* [PATCH] Btrfs: remove BUG_ON() in compress_file_range()
@ 2011-09-08 2:22 Li Zefan
2011-09-22 10:23 ` David Sterba
0 siblings, 1 reply; 2+ messages in thread
From: Li Zefan @ 2011-09-08 2:22 UTC (permalink / raw)
To: linux-btrfs
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>
---
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 0ccc743..63b4fc0 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -393,7 +393,10 @@ again:
(BTRFS_I(inode)->flags & BTRFS_INODE_COMPRESS))) {
WARN_ON(pages);
pages = kzalloc(sizeof(struct page *) * nr_pages, GFP_NOFS);
- BUG_ON(!pages);
+ if (!pages) {
+ /* just bail out to the uncompressed code */
+ goto cont;
+ }
if (BTRFS_I(inode)->force_compress)
compress_type = BTRFS_I(inode)->force_compress;
@@ -424,6 +427,7 @@ again:
will_compress = 1;
}
}
+cont:
if (start == 0) {
trans = btrfs_join_transaction(root);
BUG_ON(IS_ERR(trans));
-- 1.7.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Btrfs: remove BUG_ON() in compress_file_range()
2011-09-08 2:22 [PATCH] Btrfs: remove BUG_ON() in compress_file_range() Li Zefan
@ 2011-09-22 10:23 ` David Sterba
0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2011-09-22 10:23 UTC (permalink / raw)
To: Li Zefan; +Cc: linux-btrfs
On Thu, Sep 08, 2011 at 10:22:01AM +0800, Li Zefan wrote:
> It's not a big deal if we fail to allocate the array, and instead of
> panic we can just give up compressing.
Makes sense.
> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Reviewed-by: David Sterba <dsterba@suse.cz>
> ---
> 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 0ccc743..63b4fc0 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -393,7 +393,10 @@ again:
> (BTRFS_I(inode)->flags & BTRFS_INODE_COMPRESS))) {
> WARN_ON(pages);
> pages = kzalloc(sizeof(struct page *) * nr_pages, GFP_NOFS);
> - BUG_ON(!pages);
> + if (!pages) {
> + /* just bail out to the uncompressed code */
> + goto cont;
> + }
>
> if (BTRFS_I(inode)->force_compress)
> compress_type = BTRFS_I(inode)->force_compress;
> @@ -424,6 +427,7 @@ again:
> will_compress = 1;
> }
> }
> +cont:
> if (start == 0) {
> trans = btrfs_join_transaction(root);
> BUG_ON(IS_ERR(trans));
> -- 1.7.3.1
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-09-22 10:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-08 2:22 [PATCH] Btrfs: remove BUG_ON() in compress_file_range() Li Zefan
2011-09-22 10:23 ` David Sterba
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.