diff options
author | Joern Engel <joern@logfs.org> | 2010-03-17 08:47:45 -0400 |
---|---|---|
committer | Joern Engel <joern@logfs.org> | 2010-03-27 06:19:14 -0400 |
commit | 59fe27c0a8173a74b105debc803b97582028c90b (patch) | |
tree | 6011317b8da26f879989a4b654aedf6549181968 /fs | |
parent | 49137f2efb5cf68724bccaba531ab3d59acd71f9 (diff) |
Limit max_pages for insane devices
Intel SSDs have a limit of 0xffff as queue_max_hw_sectors(q). Such a
limit may make sense from a hardware pov, but it causes bio_alloc() to
return NULL.
Signed-off-by: Joern Engel <joern@logfs.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/logfs/dev_bdev.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/logfs/dev_bdev.c b/fs/logfs/dev_bdev.c index 9718c22f186d..f99f5dcce546 100644 --- a/fs/logfs/dev_bdev.c +++ b/fs/logfs/dev_bdev.c | |||
@@ -97,8 +97,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); | 97 | unsigned int max_pages = queue_max_hw_sectors(q) >> (PAGE_SHIFT - 9); |
98 | int i; | 98 | int i; |
99 | 99 | ||
100 | if (max_pages > BIO_MAX_PAGES) | ||
101 | max_pages = BIO_MAX_PAGES; | ||
100 | bio = bio_alloc(GFP_NOFS, max_pages); | 102 | bio = bio_alloc(GFP_NOFS, max_pages); |
101 | BUG_ON(!bio); /* FIXME: handle this */ | 103 | BUG_ON(!bio); |
102 | 104 | ||
103 | for (i = 0; i < nr_pages; i++) { | 105 | for (i = 0; i < nr_pages; i++) { |
104 | if (i >= max_pages) { | 106 | if (i >= max_pages) { |
@@ -191,8 +193,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); | 193 | unsigned int max_pages = queue_max_hw_sectors(q) >> (PAGE_SHIFT - 9); |
192 | int i; | 194 | int i; |
193 | 195 | ||
196 | if (max_pages > BIO_MAX_PAGES) | ||
197 | max_pages = BIO_MAX_PAGES; | ||
194 | bio = bio_alloc(GFP_NOFS, max_pages); | 198 | bio = bio_alloc(GFP_NOFS, max_pages); |
195 | BUG_ON(!bio); /* FIXME: handle this */ | 199 | BUG_ON(!bio); |
196 | 200 | ||
197 | for (i = 0; i < nr_pages; i++) { | 201 | for (i = 0; i < nr_pages; i++) { |
198 | if (i >= max_pages) { | 202 | if (i >= max_pages) { |