mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-15 09:03:59 +08:00
iomap: simplify iomap_readpage_actor
Now that the outstanding reads are counted in bytes, there is no need to use the low-level __bio_try_merge_page API, we can switch back to always using bio_add_page and simplify iomap_readpage_actor again. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
This commit is contained in:
parent
c500bee1c5
commit
d0364f9490
@ -241,7 +241,6 @@ iomap_readpage_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
|
|||||||
struct iomap_readpage_ctx *ctx = data;
|
struct iomap_readpage_ctx *ctx = data;
|
||||||
struct page *page = ctx->cur_page;
|
struct page *page = ctx->cur_page;
|
||||||
struct iomap_page *iop;
|
struct iomap_page *iop;
|
||||||
bool same_page = false, is_contig = false;
|
|
||||||
loff_t orig_pos = pos;
|
loff_t orig_pos = pos;
|
||||||
unsigned poff, plen;
|
unsigned poff, plen;
|
||||||
sector_t sector;
|
sector_t sector;
|
||||||
@ -268,16 +267,10 @@ iomap_readpage_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
|
|||||||
if (iop)
|
if (iop)
|
||||||
atomic_add(plen, &iop->read_bytes_pending);
|
atomic_add(plen, &iop->read_bytes_pending);
|
||||||
|
|
||||||
/* Try to merge into a previous segment if we can */
|
|
||||||
sector = iomap_sector(iomap, pos);
|
sector = iomap_sector(iomap, pos);
|
||||||
if (ctx->bio && bio_end_sector(ctx->bio) == sector) {
|
if (!ctx->bio ||
|
||||||
if (__bio_try_merge_page(ctx->bio, page, plen, poff,
|
bio_end_sector(ctx->bio) != sector ||
|
||||||
&same_page))
|
bio_add_page(ctx->bio, page, plen, poff) != plen) {
|
||||||
goto done;
|
|
||||||
is_contig = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!is_contig || bio_full(ctx->bio, plen)) {
|
|
||||||
gfp_t gfp = mapping_gfp_constraint(page->mapping, GFP_KERNEL);
|
gfp_t gfp = mapping_gfp_constraint(page->mapping, GFP_KERNEL);
|
||||||
gfp_t orig_gfp = gfp;
|
gfp_t orig_gfp = gfp;
|
||||||
unsigned int nr_vecs = DIV_ROUND_UP(length, PAGE_SIZE);
|
unsigned int nr_vecs = DIV_ROUND_UP(length, PAGE_SIZE);
|
||||||
@ -301,9 +294,8 @@ iomap_readpage_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
|
|||||||
ctx->bio->bi_iter.bi_sector = sector;
|
ctx->bio->bi_iter.bi_sector = sector;
|
||||||
bio_set_dev(ctx->bio, iomap->bdev);
|
bio_set_dev(ctx->bio, iomap->bdev);
|
||||||
ctx->bio->bi_end_io = iomap_read_end_io;
|
ctx->bio->bi_end_io = iomap_read_end_io;
|
||||||
|
__bio_add_page(ctx->bio, page, plen, poff);
|
||||||
}
|
}
|
||||||
|
|
||||||
bio_add_page(ctx->bio, page, plen, poff);
|
|
||||||
done:
|
done:
|
||||||
/*
|
/*
|
||||||
* Move the caller beyond our range so that it keeps making progress.
|
* Move the caller beyond our range so that it keeps making progress.
|
||||||
|
Loading…
Reference in New Issue
Block a user