mirror of
https://github.com/torvalds/linux.git
synced 2026-05-24 23:22:31 +02:00
ntfs3: remove copy and pasted iomap code
ntfs3 copied the iomap code without attribution or talking to the maintainers, to hook into the bio completion for (unexplained) zeroing. Fix this by just overriding the bio completion handler in the submit handler. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://patch.msgid.link/20260223132021.292832-13-hch@lst.de Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
parent
5f4fe046cb
commit
6810365c0d
|
|
@ -605,63 +605,18 @@ static void ntfs_iomap_read_end_io(struct bio *bio)
|
|||
bio_put(bio);
|
||||
}
|
||||
|
||||
/*
|
||||
* Copied from iomap/bio.c.
|
||||
*/
|
||||
static int ntfs_iomap_bio_read_folio_range(const struct iomap_iter *iter,
|
||||
struct iomap_read_folio_ctx *ctx,
|
||||
size_t plen)
|
||||
{
|
||||
struct folio *folio = ctx->cur_folio;
|
||||
const struct iomap *iomap = &iter->iomap;
|
||||
loff_t pos = iter->pos;
|
||||
size_t poff = offset_in_folio(folio, pos);
|
||||
loff_t length = iomap_length(iter);
|
||||
sector_t sector;
|
||||
struct bio *bio = ctx->read_ctx;
|
||||
|
||||
sector = iomap_sector(iomap, pos);
|
||||
if (!bio || bio_end_sector(bio) != sector ||
|
||||
!bio_add_folio(bio, folio, plen, poff)) {
|
||||
gfp_t gfp = mapping_gfp_constraint(folio->mapping, GFP_KERNEL);
|
||||
gfp_t orig_gfp = gfp;
|
||||
unsigned int nr_vecs = DIV_ROUND_UP(length, PAGE_SIZE);
|
||||
|
||||
if (bio)
|
||||
submit_bio(bio);
|
||||
|
||||
if (ctx->rac) /* same as readahead_gfp_mask */
|
||||
gfp |= __GFP_NORETRY | __GFP_NOWARN;
|
||||
bio = bio_alloc(iomap->bdev, bio_max_segs(nr_vecs), REQ_OP_READ,
|
||||
gfp);
|
||||
/*
|
||||
* If the bio_alloc fails, try it again for a single page to
|
||||
* avoid having to deal with partial page reads. This emulates
|
||||
* what do_mpage_read_folio does.
|
||||
*/
|
||||
if (!bio)
|
||||
bio = bio_alloc(iomap->bdev, 1, REQ_OP_READ, orig_gfp);
|
||||
if (ctx->rac)
|
||||
bio->bi_opf |= REQ_RAHEAD;
|
||||
bio->bi_iter.bi_sector = sector;
|
||||
bio->bi_end_io = ntfs_iomap_read_end_io;
|
||||
bio_add_folio_nofail(bio, folio, plen, poff);
|
||||
ctx->read_ctx = bio;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ntfs_iomap_bio_submit_read(const struct iomap_iter *iter,
|
||||
struct iomap_read_folio_ctx *ctx)
|
||||
{
|
||||
struct bio *bio = ctx->read_ctx;
|
||||
|
||||
bio->bi_end_io = ntfs_iomap_read_end_io;
|
||||
submit_bio(bio);
|
||||
}
|
||||
|
||||
static const struct iomap_read_ops ntfs_iomap_bio_read_ops = {
|
||||
.read_folio_range = ntfs_iomap_bio_read_folio_range,
|
||||
.submit_read = ntfs_iomap_bio_submit_read,
|
||||
.read_folio_range = iomap_bio_read_folio_range,
|
||||
.submit_read = ntfs_iomap_bio_submit_read,
|
||||
};
|
||||
|
||||
static int ntfs_read_folio(struct file *file, struct folio *folio)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user