Commit 39146b6f authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

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: default avatarChristoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20220124091107.642561-5-hch@lst.deSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 5d2ca213
...@@ -1443,17 +1443,6 @@ int ntfs_write_bh(struct ntfs_sb_info *sbi, struct NTFS_RECORD_HEADER *rhdr, ...@@ -1443,17 +1443,6 @@ int ntfs_write_bh(struct ntfs_sb_info *sbi, struct NTFS_RECORD_HEADER *rhdr,
return err; 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. * 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, ...@@ -1496,11 +1485,7 @@ int ntfs_bio_pages(struct ntfs_sb_info *sbi, const struct runs_tree *run,
lbo = ((u64)lcn << cluster_bits) + off; lbo = ((u64)lcn << cluster_bits) + off;
len = ((u64)clen << cluster_bits) - off; len = ((u64)clen << cluster_bits) - off;
new_bio: new_bio:
new = ntfs_alloc_bio(nr_pages - page_idx); new = bio_alloc(GFP_NOFS, nr_pages - page_idx);
if (!new) {
err = -ENOMEM;
goto out;
}
if (bio) { if (bio) {
bio_chain(bio, new); bio_chain(bio, new);
submit_bio(bio); submit_bio(bio);
...@@ -1599,11 +1584,7 @@ int ntfs_bio_fill_1(struct ntfs_sb_info *sbi, const struct runs_tree *run) ...@@ -1599,11 +1584,7 @@ int ntfs_bio_fill_1(struct ntfs_sb_info *sbi, const struct runs_tree *run)
lbo = (u64)lcn << cluster_bits; lbo = (u64)lcn << cluster_bits;
len = (u64)clen << cluster_bits; len = (u64)clen << cluster_bits;
new_bio: new_bio:
new = ntfs_alloc_bio(BIO_MAX_VECS); new = bio_alloc(GFP_NOFS, BIO_MAX_VECS);
if (!new) {
err = -ENOMEM;
break;
}
if (bio) { if (bio) {
bio_chain(bio, new); bio_chain(bio, new);
submit_bio(bio); submit_bio(bio);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment