From: Li Zefan <lizf@cn.fujitsu.com>
To: Chris Mason <chris.mason@oracle.com>
Cc: Mitch Harder <mitch.harder@sabayonlinux.org>,
linux-btrfs@vger.kernel.org
Subject: [PATCH v2 2/6] btrfs: Fix error handling in zlib
Date: Thu, 18 Nov 2010 10:10:01 +0800 [thread overview]
Message-ID: <4CE48AF9.6070000@cn.fujitsu.com> (raw)
In-Reply-To: <4CE48ABB.5070302@cn.fujitsu.com>
Return failure if alloc_page() fails to allocate memory,
and the upper code will just give up compression.
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
fs/btrfs/zlib.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/fs/btrfs/zlib.c b/fs/btrfs/zlib.c
index e5b8b22..5a8ba17 100644
--- a/fs/btrfs/zlib.c
+++ b/fs/btrfs/zlib.c
@@ -225,6 +225,10 @@ int btrfs_zlib_compress_pages(struct address_space *mapping,
data_in = kmap(in_page);
out_page = alloc_page(GFP_NOFS | __GFP_HIGHMEM);
+ if (out_page == NULL) {
+ ret = -ENOMEM;
+ goto out;
+ }
cpage_out = kmap(out_page);
pages[0] = out_page;
nr_pages = 1;
@@ -263,6 +267,10 @@ int btrfs_zlib_compress_pages(struct address_space *mapping,
goto out;
}
out_page = alloc_page(GFP_NOFS | __GFP_HIGHMEM);
+ if (out_page == NULL) {
+ ret = -ENOMEM;
+ goto out;
+ }
cpage_out = kmap(out_page);
pages[nr_pages] = out_page;
nr_pages++;
-- 1.7.3.1
next prev parent reply other threads:[~2010-11-18 2:10 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-18 2:08 [GIT PULL][PATCH v2 0/6] btrfs: Add lzo compression support Li Zefan
2010-11-18 2:09 ` [PATCH v2 1/6] btrfs: Fix bugs in zlib workspace Li Zefan
2010-11-18 2:10 ` Li Zefan [this message]
2010-11-18 2:10 ` [PATCH v2 3/6] btrfs: Allow to add new compression algorithm Li Zefan
2010-11-18 2:10 ` [PATCH v2 4/6] btrfs: Add lzo compression support Li Zefan
2010-11-18 2:11 ` [PATCH v2 5/6] btrfs: Allow to specify compress method when defrag Li Zefan
2010-11-18 2:11 ` [PATCH v2 6/6] btrfs: Extract duplicate decompress code Li Zefan
2010-11-29 17:54 ` [GIT PULL][PATCH v2 0/6] btrfs: Add lzo compression support C Anthony Risinger
2010-11-30 1:00 ` Li Zefan
2010-11-30 17:12 ` C Anthony Risinger
2010-12-01 1:02 ` Li Zefan
2010-12-24 5:35 ` cwillu
2010-12-24 6:55 ` Li Zefan
2010-12-24 12:32 ` Chris Mason
2010-12-24 20:45 ` Chris Mason
2010-12-26 3:31 ` C Anthony Risinger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4CE48AF9.6070000@cn.fujitsu.com \
--to=lizf@cn.fujitsu.com \
--cc=chris.mason@oracle.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=mitch.harder@sabayonlinux.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.