aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/zlib.c
diff options
context:
space:
mode:
authorLi Zefan <lizf@cn.fujitsu.com>2010-11-08 19:27:27 -0500
committerLi Zefan <lizf@cn.fujitsu.com>2010-12-22 10:15:43 -0500
commit4b72029dc3fd6ba7dc45ccd1cf0aa0ebfa209bd3 (patch)
tree116285c40ed2fa30e91d164e2e16e0d82ae450f9 /fs/btrfs/zlib.c
parent8844355df7f4e091b03cc131e1549631238b397b (diff)
btrfs: Fix error handling in zlib
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>
Diffstat (limited to 'fs/btrfs/zlib.c')
-rw-r--r--fs/btrfs/zlib.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/btrfs/zlib.c b/fs/btrfs/zlib.c
index e5b8b22e07d6..b01558661e3b 100644
--- a/fs/btrfs/zlib.c
+++ b/fs/btrfs/zlib.c
@@ -225,6 +225,10 @@ int btrfs_zlib_compress_pages(struct address_space *mapping,
225 data_in = kmap(in_page); 225 data_in = kmap(in_page);
226 226
227 out_page = alloc_page(GFP_NOFS | __GFP_HIGHMEM); 227 out_page = alloc_page(GFP_NOFS | __GFP_HIGHMEM);
228 if (out_page == NULL) {
229 ret = -1;
230 goto out;
231 }
228 cpage_out = kmap(out_page); 232 cpage_out = kmap(out_page);
229 pages[0] = out_page; 233 pages[0] = out_page;
230 nr_pages = 1; 234 nr_pages = 1;
@@ -263,6 +267,10 @@ int btrfs_zlib_compress_pages(struct address_space *mapping,
263 goto out; 267 goto out;
264 } 268 }
265 out_page = alloc_page(GFP_NOFS | __GFP_HIGHMEM); 269 out_page = alloc_page(GFP_NOFS | __GFP_HIGHMEM);
270 if (out_page == NULL) {
271 ret = -1;
272 goto out;
273 }
266 cpage_out = kmap(out_page); 274 cpage_out = kmap(out_page);
267 pages[nr_pages] = out_page; 275 pages[nr_pages] = out_page;
268 nr_pages++; 276 nr_pages++;