Commit 1165d20f authored by Keith Busch's avatar Keith Busch Committed by Jens Axboe
Browse files

null_blk: simplify copy_from_nullb



It always returns success, so the code that saves the errors status, but
proceeds without checking it looks a bit odd. Clean this up.

Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: default avatarDamien Le Moal <dlemoal@kernel.org>
Reviewed-by: default avatarChaitanya Kulkarni <kch@nvidia.com>
Tested-by: default avatarHans Holmberg <hans.holmberg@wdc.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent e87d66ab
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -1161,7 +1161,7 @@ static int copy_to_nullb(struct nullb *nullb, struct page *source,
	return 0;
}

static int copy_from_nullb(struct nullb *nullb, struct page *dest,
static void copy_from_nullb(struct nullb *nullb, struct page *dest,
	unsigned int off, sector_t sector, size_t n)
{
	size_t temp, count = 0;
@@ -1184,7 +1184,6 @@ static int copy_from_nullb(struct nullb *nullb, struct page *dest,
		count += temp;
		sector += temp >> SECTOR_SHIFT;
	}
	return 0;
}

static void nullb_fill_pattern(struct nullb *nullb, struct page *page,
@@ -1248,8 +1247,8 @@ static int null_transfer(struct nullb *nullb, struct page *page,
				sector, len);

		if (valid_len) {
			err = copy_from_nullb(nullb, page, off,
				sector, valid_len);
			copy_from_nullb(nullb, page, off, sector,
					valid_len);
			off += valid_len;
			len -= valid_len;
		}