ntfs3: remove ntfs_alloc_bio

bio_alloc will never fail if it is allowed to sleep, so there is no
need for this loop.  Also remove the __GFP_HIGH specifier as it doesn't
make sense here given that we'll always fall back to the mempool anyway.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20220124091107.642561-5-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Christoph Hellwig 2022-01-24 10:10:52 +01:00 committed by Jens Axboe
parent 5d2ca2132f
commit 39146b6f66
1 changed files with 2 additions and 21 deletions

View File

@ -1443,17 +1443,6 @@ int ntfs_write_bh(struct ntfs_sb_info *sbi, struct NTFS_RECORD_HEADER *rhdr,
return err;
}
static inline struct bio *ntfs_alloc_bio(u32 nr_vecs)
{
struct bio *bio = bio_alloc(GFP_NOFS | __GFP_HIGH, nr_vecs);
if (!bio && (current->flags & PF_MEMALLOC)) {
while (!bio && (nr_vecs /= 2))
bio = bio_alloc(GFP_NOFS | __GFP_HIGH, nr_vecs);
}
return bio;
}
/*
* ntfs_bio_pages - Read/write pages from/to disk.
*/
@ -1496,11 +1485,7 @@ int ntfs_bio_pages(struct ntfs_sb_info *sbi, const struct runs_tree *run,
lbo = ((u64)lcn << cluster_bits) + off;
len = ((u64)clen << cluster_bits) - off;
new_bio:
new = ntfs_alloc_bio(nr_pages - page_idx);
if (!new) {
err = -ENOMEM;
goto out;
}
new = bio_alloc(GFP_NOFS, nr_pages - page_idx);
if (bio) {
bio_chain(bio, new);
submit_bio(bio);
@ -1599,11 +1584,7 @@ int ntfs_bio_fill_1(struct ntfs_sb_info *sbi, const struct runs_tree *run)
lbo = (u64)lcn << cluster_bits;
len = (u64)clen << cluster_bits;
new_bio:
new = ntfs_alloc_bio(BIO_MAX_VECS);
if (!new) {
err = -ENOMEM;
break;
}
new = bio_alloc(GFP_NOFS, BIO_MAX_VECS);
if (bio) {
bio_chain(bio, new);
submit_bio(bio);