diff options
Diffstat (limited to 'fs/logfs/dev_bdev.c')
-rw-r--r-- | fs/logfs/dev_bdev.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/logfs/dev_bdev.c b/fs/logfs/dev_bdev.c index 9718c22f186d..243c00071f76 100644 --- a/fs/logfs/dev_bdev.c +++ b/fs/logfs/dev_bdev.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <linux/bio.h> | 9 | #include <linux/bio.h> |
10 | #include <linux/blkdev.h> | 10 | #include <linux/blkdev.h> |
11 | #include <linux/buffer_head.h> | 11 | #include <linux/buffer_head.h> |
12 | #include <linux/gfp.h> | ||
12 | 13 | ||
13 | #define PAGE_OFS(ofs) ((ofs) & (PAGE_SIZE-1)) | 14 | #define PAGE_OFS(ofs) ((ofs) & (PAGE_SIZE-1)) |
14 | 15 | ||
@@ -80,6 +81,7 @@ static void writeseg_end_io(struct bio *bio, int err) | |||
80 | prefetchw(&bvec->bv_page->flags); | 81 | prefetchw(&bvec->bv_page->flags); |
81 | 82 | ||
82 | end_page_writeback(page); | 83 | end_page_writeback(page); |
84 | page_cache_release(page); | ||
83 | } while (bvec >= bio->bi_io_vec); | 85 | } while (bvec >= bio->bi_io_vec); |
84 | bio_put(bio); | 86 | bio_put(bio); |
85 | if (atomic_dec_and_test(&super->s_pending_writes)) | 87 | if (atomic_dec_and_test(&super->s_pending_writes)) |
@@ -97,8 +99,10 @@ static int __bdev_writeseg(struct super_block *sb, u64 ofs, pgoff_t index, | |||
97 | unsigned int max_pages = queue_max_hw_sectors(q) >> (PAGE_SHIFT - 9); | 99 | unsigned int max_pages = queue_max_hw_sectors(q) >> (PAGE_SHIFT - 9); |
98 | int i; | 100 | int i; |
99 | 101 | ||
102 | if (max_pages > BIO_MAX_PAGES) | ||
103 | max_pages = BIO_MAX_PAGES; | ||
100 | bio = bio_alloc(GFP_NOFS, max_pages); | 104 | bio = bio_alloc(GFP_NOFS, max_pages); |
101 | BUG_ON(!bio); /* FIXME: handle this */ | 105 | BUG_ON(!bio); |
102 | 106 | ||
103 | for (i = 0; i < nr_pages; i++) { | 107 | for (i = 0; i < nr_pages; i++) { |
104 | if (i >= max_pages) { | 108 | if (i >= max_pages) { |
@@ -191,8 +195,10 @@ static int do_erase(struct super_block *sb, u64 ofs, pgoff_t index, | |||
191 | unsigned int max_pages = queue_max_hw_sectors(q) >> (PAGE_SHIFT - 9); | 195 | unsigned int max_pages = queue_max_hw_sectors(q) >> (PAGE_SHIFT - 9); |
192 | int i; | 196 | int i; |
193 | 197 | ||
198 | if (max_pages > BIO_MAX_PAGES) | ||
199 | max_pages = BIO_MAX_PAGES; | ||
194 | bio = bio_alloc(GFP_NOFS, max_pages); | 200 | bio = bio_alloc(GFP_NOFS, max_pages); |
195 | BUG_ON(!bio); /* FIXME: handle this */ | 201 | BUG_ON(!bio); |
196 | 202 | ||
197 | for (i = 0; i < nr_pages; i++) { | 203 | for (i = 0; i < nr_pages; i++) { |
198 | if (i >= max_pages) { | 204 | if (i >= max_pages) { |