ntfs3: remove ntfs_alloc_bio
authorChristoph Hellwig <hch@lst.de>
Mon, 24 Jan 2022 09:10:52 +0000 (10:10 +0100)
committerJens Axboe <axboe@kernel.dk>
Wed, 2 Feb 2022 14:49:59 +0000 (07:49 -0700)
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>
fs/ntfs3/fsntfs.c

index 4de9acb..4a255e2 100644 (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);