aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/brd.c
diff options
context:
space:
mode:
authorMatthew Wilcox <matthew.r.wilcox@intel.com>2014-06-04 19:07:50 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-04 19:54:02 -0400
commit96f8d8e0965ba3d895f4cf63bbb16fd9fca8998b (patch)
tree1c8423c21320beb5a499a7fcf891e8d4debef1c1 /drivers/block/brd.c
parenta72132c31d580969a38972aaf925915e861cd342 (diff)
brd: return -ENOSPC rather than -ENOMEM on page allocation failure
brd is effectively a thinly provisioned device. Thinly provisioned devices return -ENOSPC when they can't write a new block. -ENOMEM is an implementation detail that callers shouldn't know. Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com> Acked-by: Dave Chinner <david@fromorbit.com> Cc: Dheeraj Reddy <dheeraj.reddy@intel.com> Cc: Hugh Dickins <hughd@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/block/brd.c')
-rw-r--r--drivers/block/brd.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index 807d3d5d2fe5..c7d138eca731 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -200,11 +200,11 @@ static int copy_to_brd_setup(struct brd_device *brd, sector_t sector, size_t n)
200 200
201 copy = min_t(size_t, n, PAGE_SIZE - offset); 201 copy = min_t(size_t, n, PAGE_SIZE - offset);
202 if (!brd_insert_page(brd, sector)) 202 if (!brd_insert_page(brd, sector))
203 return -ENOMEM; 203 return -ENOSPC;
204 if (copy < n) { 204 if (copy < n) {
205 sector += copy >> SECTOR_SHIFT; 205 sector += copy >> SECTOR_SHIFT;
206 if (!brd_insert_page(brd, sector)) 206 if (!brd_insert_page(brd, sector))
207 return -ENOMEM; 207 return -ENOSPC;
208 } 208 }
209 return 0; 209 return 0;
210} 210}
@@ -384,7 +384,7 @@ static int brd_direct_access(struct block_device *bdev, sector_t sector,
384 return -ERANGE; 384 return -ERANGE;
385 page = brd_insert_page(brd, sector); 385 page = brd_insert_page(brd, sector);
386 if (!page) 386 if (!page)
387 return -ENOMEM; 387 return -ENOSPC;
388 *kaddr = page_address(page); 388 *kaddr = page_address(page);
389 *pfn = page_to_pfn(page); 389 *pfn = page_to_pfn(page);
390 390