linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Thumshirn <johannes.thumshirn@wdc.com>
To: Damien Le Moal <dlemoal@kernel.org>,
	 Naohiro Aota <naohiro.aota@wdc.com>,
	Johannes Thumshirn <jth@kernel.org>,
	 Alasdair Kergon <agk@redhat.com>,
	Mike Snitzer <snitzer@kernel.org>,
	 Mikulas Patocka <mpatocka@redhat.com>,
	dm-devel@lists.linux.dev,  Chris Mason <clm@fb.com>,
	Josef Bacik <josef@toxicpanda.com>,
	 David Sterba <dsterba@suse.com>,
	Jaegeuk Kim <jaegeuk@kernel.org>,  Chao Yu <chao@kernel.org>,
	Jens Axboe <axboe@kernel.dk>,  Christoph Hellwig <hch@lst.de>,
	Sagi Grimberg <sagi@grimberg.me>,
	 Chaitanya Kulkarni <kch@nvidia.com>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	 linux-btrfs@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net,
	 linux-block@vger.kernel.org, linux-nvme@lists.infradead.org,
	 Johannes Thumshirn <johannes.thumshirn@wdc.com>
Subject: [PATCH v3 4/5] f2fs: guard blkdev_zone_mgmt with nofs scope
Date: Sun, 28 Jan 2024 23:52:19 -0800	[thread overview]
Message-ID: <20240128-zonefs_nofs-v3-4-ae3b7c8def61@wdc.com> (raw)
In-Reply-To: <20240128-zonefs_nofs-v3-0-ae3b7c8def61@wdc.com>

Guard the calls to blkdev_zone_mgmt() with a memalloc_nofs scope.
This helps us getting rid of the GFP_NOFS argument to blkdev_zone_mgmt();

Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
 fs/f2fs/segment.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 4c8836ded90f..0094fe491364 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -1971,9 +1971,15 @@ static int __f2fs_issue_discard_zone(struct f2fs_sb_info *sbi,
 		}
 
 		if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING))) {
+			unsigned int nofs_flags;
+			int ret;
+
 			trace_f2fs_issue_reset_zone(bdev, blkstart);
-			return blkdev_zone_mgmt(bdev, REQ_OP_ZONE_RESET,
-						sector, nr_sects, GFP_NOFS);
+			nofs_flags = memalloc_nofs_save();
+			ret = blkdev_zone_mgmt(bdev, REQ_OP_ZONE_RESET,
+						sector, nr_sects, GFP_KERNEL);
+			memalloc_nofs_restore(nofs_flags);
+			return ret;
 		}
 
 		__queue_zone_reset_cmd(sbi, bdev, blkstart, lblkstart, blklen);
@@ -4865,6 +4871,7 @@ static int check_zone_write_pointer(struct f2fs_sb_info *sbi,
 	block_t zone_block, valid_block_cnt;
 	unsigned int log_sectors_per_block = sbi->log_blocksize - SECTOR_SHIFT;
 	int ret;
+	unsigned int nofs_flags;
 
 	if (zone->type != BLK_ZONE_TYPE_SEQWRITE_REQ)
 		return 0;
@@ -4912,8 +4919,10 @@ static int check_zone_write_pointer(struct f2fs_sb_info *sbi,
 		    "pointer: valid block[0x%x,0x%x] cond[0x%x]",
 		    zone_segno, valid_block_cnt, zone->cond);
 
+	nofs_flags = memalloc_nofs_save();
 	ret = blkdev_zone_mgmt(fdev->bdev, REQ_OP_ZONE_FINISH,
-				zone->start, zone->len, GFP_NOFS);
+				zone->start, zone->len, GFP_KERNEL);
+	memalloc_nofs_restore(nofs_flags);
 	if (ret == -EOPNOTSUPP) {
 		ret = blkdev_issue_zeroout(fdev->bdev, zone->wp,
 					zone->len - (zone->wp - zone->start),

-- 
2.43.0


  parent reply	other threads:[~2024-01-29  7:52 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-29  7:52 [PATCH v3 0/5] block: remove gfp_mask for blkdev_zone_mgmt() Johannes Thumshirn
2024-01-29  7:52 ` [PATCH v3 1/5] zonefs: pass GFP_KERNEL to blkdev_zone_mgmt() call Johannes Thumshirn
2024-01-29 23:25   ` Damien Le Moal
2024-02-09  7:44   ` Damien Le Moal
2024-01-29  7:52 ` [PATCH v3 2/5] dm: dm-zoned: guard blkdev_zone_mgmt with noio scope Johannes Thumshirn
2024-01-29 23:26   ` Damien Le Moal
2024-01-30 20:48   ` Mike Snitzer
2024-01-29  7:52 ` [PATCH v3 3/5] btrfs: zoned: call blkdev_zone_mgmt in nofs scope Johannes Thumshirn
2024-01-29 23:27   ` Damien Le Moal
2024-01-31  7:15   ` David Sterba
2024-01-29  7:52 ` Johannes Thumshirn [this message]
2024-01-29 23:27   ` [PATCH v3 4/5] f2fs: guard blkdev_zone_mgmt with " Damien Le Moal
2024-01-31  7:32   ` Chao Yu
2024-01-29  7:52 ` [PATCH v3 5/5] block: remove gfp_flags from blkdev_zone_mgmt Johannes Thumshirn
2024-01-29 23:29   ` Damien Le Moal
2024-01-30 20:49   ` Mike Snitzer
2024-02-12  8:00 ` [PATCH v3 0/5] block: remove gfp_mask for blkdev_zone_mgmt() Johannes Thumshirn
2024-02-12 15:41 ` Jens Axboe
2024-03-18 20:45 ` [f2fs-dev] " patchwork-bot+f2fs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240128-zonefs_nofs-v3-4-ae3b7c8def61@wdc.com \
    --to=johannes.thumshirn@wdc.com \
    --cc=agk@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=chao@kernel.org \
    --cc=clm@fb.com \
    --cc=dlemoal@kernel.org \
    --cc=dm-devel@lists.linux.dev \
    --cc=dsterba@suse.com \
    --cc=hch@lst.de \
    --cc=jaegeuk@kernel.org \
    --cc=josef@toxicpanda.com \
    --cc=jth@kernel.org \
    --cc=kch@nvidia.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=mpatocka@redhat.com \
    --cc=naohiro.aota@wdc.com \
    --cc=sagi@grimberg.me \
    --cc=snitzer@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).