Skip to content

Commit 774bcb3

Browse files
Zach Brownmasoncl
authored andcommitted
btrfs: return ptr error from compression workspace
The btrfs compression wrappers translated errors from workspace allocation to either -ENOMEM or -1. The compression type workspace allocators are already returning a ERR_PTR(-ENOMEM). Just return that and get rid of the magical -1. This helps a future patch return errors from the compression wrappers. Signed-off-by: Zach Brown <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: Chris Mason <[email protected]>
1 parent 60e1975 commit 774bcb3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

fs/btrfs/compression.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@ int btrfs_compress_pages(int type, struct address_space *mapping,
887887

888888
workspace = find_workspace(type);
889889
if (IS_ERR(workspace))
890-
return -1;
890+
return PTR_ERR(workspace);
891891

892892
ret = btrfs_compress_op[type-1]->compress_pages(workspace, mapping,
893893
start, len, pages,
@@ -923,7 +923,7 @@ static int btrfs_decompress_biovec(int type, struct page **pages_in,
923923

924924
workspace = find_workspace(type);
925925
if (IS_ERR(workspace))
926-
return -ENOMEM;
926+
return PTR_ERR(workspace);
927927

928928
ret = btrfs_compress_op[type-1]->decompress_biovec(workspace, pages_in,
929929
disk_start,
@@ -945,7 +945,7 @@ int btrfs_decompress(int type, unsigned char *data_in, struct page *dest_page,
945945

946946
workspace = find_workspace(type);
947947
if (IS_ERR(workspace))
948-
return -ENOMEM;
948+
return PTR_ERR(workspace);
949949

950950
ret = btrfs_compress_op[type-1]->decompress(workspace, data_in,
951951
dest_page, start_byte,

0 commit comments

Comments
 (0)