diff options
Diffstat (limited to 'fs/ext4/mballoc.c')
-rw-r--r-- | fs/ext4/mballoc.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index d429014071c0..b64600be2066 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -890,6 +890,7 @@ ext4_mb_load_buddy(struct super_block *sb, ext4_group_t group, | |||
890 | int pnum; | 890 | int pnum; |
891 | int poff; | 891 | int poff; |
892 | struct page *page; | 892 | struct page *page; |
893 | int ret; | ||
893 | 894 | ||
894 | mb_debug("load group %lu\n", group); | 895 | mb_debug("load group %lu\n", group); |
895 | 896 | ||
@@ -921,15 +922,21 @@ ext4_mb_load_buddy(struct super_block *sb, ext4_group_t group, | |||
921 | if (page) { | 922 | if (page) { |
922 | BUG_ON(page->mapping != inode->i_mapping); | 923 | BUG_ON(page->mapping != inode->i_mapping); |
923 | if (!PageUptodate(page)) { | 924 | if (!PageUptodate(page)) { |
924 | ext4_mb_init_cache(page, NULL); | 925 | ret = ext4_mb_init_cache(page, NULL); |
926 | if (ret) { | ||
927 | unlock_page(page); | ||
928 | goto err; | ||
929 | } | ||
925 | mb_cmp_bitmaps(e4b, page_address(page) + | 930 | mb_cmp_bitmaps(e4b, page_address(page) + |
926 | (poff * sb->s_blocksize)); | 931 | (poff * sb->s_blocksize)); |
927 | } | 932 | } |
928 | unlock_page(page); | 933 | unlock_page(page); |
929 | } | 934 | } |
930 | } | 935 | } |
931 | if (page == NULL || !PageUptodate(page)) | 936 | if (page == NULL || !PageUptodate(page)) { |
937 | ret = -EIO; | ||
932 | goto err; | 938 | goto err; |
939 | } | ||
933 | e4b->bd_bitmap_page = page; | 940 | e4b->bd_bitmap_page = page; |
934 | e4b->bd_bitmap = page_address(page) + (poff * sb->s_blocksize); | 941 | e4b->bd_bitmap = page_address(page) + (poff * sb->s_blocksize); |
935 | mark_page_accessed(page); | 942 | mark_page_accessed(page); |
@@ -945,14 +952,20 @@ ext4_mb_load_buddy(struct super_block *sb, ext4_group_t group, | |||
945 | page = find_or_create_page(inode->i_mapping, pnum, GFP_NOFS); | 952 | page = find_or_create_page(inode->i_mapping, pnum, GFP_NOFS); |
946 | if (page) { | 953 | if (page) { |
947 | BUG_ON(page->mapping != inode->i_mapping); | 954 | BUG_ON(page->mapping != inode->i_mapping); |
948 | if (!PageUptodate(page)) | 955 | if (!PageUptodate(page)) { |
949 | ext4_mb_init_cache(page, e4b->bd_bitmap); | 956 | ret = ext4_mb_init_cache(page, e4b->bd_bitmap); |
950 | 957 | if (ret) { | |
958 | unlock_page(page); | ||
959 | goto err; | ||
960 | } | ||
961 | } | ||
951 | unlock_page(page); | 962 | unlock_page(page); |
952 | } | 963 | } |
953 | } | 964 | } |
954 | if (page == NULL || !PageUptodate(page)) | 965 | if (page == NULL || !PageUptodate(page)) { |
966 | ret = -EIO; | ||
955 | goto err; | 967 | goto err; |
968 | } | ||
956 | e4b->bd_buddy_page = page; | 969 | e4b->bd_buddy_page = page; |
957 | e4b->bd_buddy = page_address(page) + (poff * sb->s_blocksize); | 970 | e4b->bd_buddy = page_address(page) + (poff * sb->s_blocksize); |
958 | mark_page_accessed(page); | 971 | mark_page_accessed(page); |
@@ -969,7 +982,7 @@ err: | |||
969 | page_cache_release(e4b->bd_buddy_page); | 982 | page_cache_release(e4b->bd_buddy_page); |
970 | e4b->bd_buddy = NULL; | 983 | e4b->bd_buddy = NULL; |
971 | e4b->bd_bitmap = NULL; | 984 | e4b->bd_bitmap = NULL; |
972 | return -EIO; | 985 | return ret; |
973 | } | 986 | } |
974 | 987 | ||
975 | static void ext4_mb_release_desc(struct ext4_buddy *e4b) | 988 | static void ext4_mb_release_desc(struct ext4_buddy *e4b) |