From: Johannes Thumshirn <johannes.thumshirn@wdc.com> To: Damien Le Moal <dlemoal@kernel.org>, Naohiro Aota <naohiro.aota@wdc.com>, Mike Snitzer <snitzer@kernel.org>, 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>, "Matthew Wilcox (Oracle)" <willy@infradead.org> Subject: [PATCH 3/5] btrfs: zoned: call blkdev_zone_mgmt in nofs scope Date: Tue, 23 Jan 2024 01:43:44 -0800 [thread overview] Message-ID: <20240123-zonefs_nofs-v1-3-cc0b0308ef25@wdc.com> (raw) In-Reply-To: <20240123-zonefs_nofs-v1-0-cc0b0308ef25@wdc.com> Add a memalloc_nofs scope around all calls to blkdev_zone_mgmt(). This allows us to further get rid of the GFP_NOFS argument for blkdev_zone_mgmt(). Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> --- fs/btrfs/zoned.c | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c index 168af9d000d1..05640d61e435 100644 --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -824,11 +824,15 @@ static int sb_log_location(struct block_device *bdev, struct blk_zone *zones, reset = &zones[1]; if (reset && reset->cond != BLK_ZONE_COND_EMPTY) { + unsigned int nofs_flags; + ASSERT(sb_zone_is_full(reset)); + nofs_flags = memalloc_nofs_save(); ret = blkdev_zone_mgmt(bdev, REQ_OP_ZONE_RESET, reset->start, reset->len, - GFP_NOFS); + GFP_KERNEL); + memalloc_nofs_restore(nofs_flags); if (ret) return ret; @@ -974,11 +978,14 @@ int btrfs_advance_sb_log(struct btrfs_device *device, int mirror) * explicit ZONE_FINISH is not necessary. */ if (zone->wp != zone->start + zone->capacity) { + unsigned int nofs_flags; int ret; + nofs_flags = memalloc_nofs_save(); ret = blkdev_zone_mgmt(device->bdev, REQ_OP_ZONE_FINISH, zone->start, - zone->len, GFP_NOFS); + zone->len, GFP_KERNEL); + memalloc_nofs_restore(nofs_flags); if (ret) return ret; } @@ -996,11 +1003,13 @@ int btrfs_advance_sb_log(struct btrfs_device *device, int mirror) int btrfs_reset_sb_log_zones(struct block_device *bdev, int mirror) { + unsigned int nofs_flags; sector_t zone_sectors; sector_t nr_sectors; u8 zone_sectors_shift; u32 sb_zone; u32 nr_zones; + int ret; zone_sectors = bdev_zone_sectors(bdev); zone_sectors_shift = ilog2(zone_sectors); @@ -1011,9 +1020,13 @@ int btrfs_reset_sb_log_zones(struct block_device *bdev, int mirror) if (sb_zone + 1 >= nr_zones) return -ENOENT; - return blkdev_zone_mgmt(bdev, REQ_OP_ZONE_RESET, - zone_start_sector(sb_zone, bdev), - zone_sectors * BTRFS_NR_SB_LOG_ZONES, GFP_NOFS); + nofs_flags = memalloc_nofs_save(); + ret = blkdev_zone_mgmt(bdev, REQ_OP_ZONE_RESET, + zone_start_sector(sb_zone, bdev), + zone_sectors * BTRFS_NR_SB_LOG_ZONES, + GFP_KERNEL); + memalloc_nofs_restore(nofs_flags); + return ret; } /* @@ -1124,12 +1137,15 @@ static void btrfs_dev_clear_active_zone(struct btrfs_device *device, u64 pos) int btrfs_reset_device_zone(struct btrfs_device *device, u64 physical, u64 length, u64 *bytes) { + unsigned int nofs_flags; int ret; *bytes = 0; + nofs_flags = memalloc_nofs_save(); ret = blkdev_zone_mgmt(device->bdev, REQ_OP_ZONE_RESET, physical >> SECTOR_SHIFT, length >> SECTOR_SHIFT, - GFP_NOFS); + GFP_KERNEL); + memalloc_nofs_restore(nofs_flags); if (ret) return ret; @@ -2234,14 +2250,17 @@ static int do_zone_finish(struct btrfs_block_group *block_group, bool fully_writ struct btrfs_device *device = map->stripes[i].dev; const u64 physical = map->stripes[i].physical; struct btrfs_zoned_device_info *zinfo = device->zone_info; + unsigned int nofs_flags; if (zinfo->max_active_zones == 0) continue; + nofs_flags = memalloc_nofs_save(); ret = blkdev_zone_mgmt(device->bdev, REQ_OP_ZONE_FINISH, physical >> SECTOR_SHIFT, zinfo->zone_size >> SECTOR_SHIFT, - GFP_NOFS); + GFP_KERNEL); + memalloc_nofs_restore(nofs_flags); if (ret) return ret; -- 2.43.0
WARNING: multiple messages have this Message-ID (diff)
From: Johannes Thumshirn via Linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net> To: Damien Le Moal <dlemoal@kernel.org>, Naohiro Aota <naohiro.aota@wdc.com>, Mike Snitzer <snitzer@kernel.org>, 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: Johannes Thumshirn <johannes.thumshirn@wdc.com>, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-f2fs-devel@lists.sourceforge.net, linux-block@vger.kernel.org, "Matthew Wilcox \(Oracle\)" <willy@infradead.org>, linux-fsdevel@vger.kernel.org, linux-btrfs@vger.kernel.org Subject: [f2fs-dev] [PATCH 3/5] btrfs: zoned: call blkdev_zone_mgmt in nofs scope Date: Tue, 23 Jan 2024 01:43:44 -0800 [thread overview] Message-ID: <20240123-zonefs_nofs-v1-3-cc0b0308ef25@wdc.com> (raw) In-Reply-To: <20240123-zonefs_nofs-v1-0-cc0b0308ef25@wdc.com> Add a memalloc_nofs scope around all calls to blkdev_zone_mgmt(). This allows us to further get rid of the GFP_NOFS argument for blkdev_zone_mgmt(). Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> --- fs/btrfs/zoned.c | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c index 168af9d000d1..05640d61e435 100644 --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -824,11 +824,15 @@ static int sb_log_location(struct block_device *bdev, struct blk_zone *zones, reset = &zones[1]; if (reset && reset->cond != BLK_ZONE_COND_EMPTY) { + unsigned int nofs_flags; + ASSERT(sb_zone_is_full(reset)); + nofs_flags = memalloc_nofs_save(); ret = blkdev_zone_mgmt(bdev, REQ_OP_ZONE_RESET, reset->start, reset->len, - GFP_NOFS); + GFP_KERNEL); + memalloc_nofs_restore(nofs_flags); if (ret) return ret; @@ -974,11 +978,14 @@ int btrfs_advance_sb_log(struct btrfs_device *device, int mirror) * explicit ZONE_FINISH is not necessary. */ if (zone->wp != zone->start + zone->capacity) { + unsigned int nofs_flags; int ret; + nofs_flags = memalloc_nofs_save(); ret = blkdev_zone_mgmt(device->bdev, REQ_OP_ZONE_FINISH, zone->start, - zone->len, GFP_NOFS); + zone->len, GFP_KERNEL); + memalloc_nofs_restore(nofs_flags); if (ret) return ret; } @@ -996,11 +1003,13 @@ int btrfs_advance_sb_log(struct btrfs_device *device, int mirror) int btrfs_reset_sb_log_zones(struct block_device *bdev, int mirror) { + unsigned int nofs_flags; sector_t zone_sectors; sector_t nr_sectors; u8 zone_sectors_shift; u32 sb_zone; u32 nr_zones; + int ret; zone_sectors = bdev_zone_sectors(bdev); zone_sectors_shift = ilog2(zone_sectors); @@ -1011,9 +1020,13 @@ int btrfs_reset_sb_log_zones(struct block_device *bdev, int mirror) if (sb_zone + 1 >= nr_zones) return -ENOENT; - return blkdev_zone_mgmt(bdev, REQ_OP_ZONE_RESET, - zone_start_sector(sb_zone, bdev), - zone_sectors * BTRFS_NR_SB_LOG_ZONES, GFP_NOFS); + nofs_flags = memalloc_nofs_save(); + ret = blkdev_zone_mgmt(bdev, REQ_OP_ZONE_RESET, + zone_start_sector(sb_zone, bdev), + zone_sectors * BTRFS_NR_SB_LOG_ZONES, + GFP_KERNEL); + memalloc_nofs_restore(nofs_flags); + return ret; } /* @@ -1124,12 +1137,15 @@ static void btrfs_dev_clear_active_zone(struct btrfs_device *device, u64 pos) int btrfs_reset_device_zone(struct btrfs_device *device, u64 physical, u64 length, u64 *bytes) { + unsigned int nofs_flags; int ret; *bytes = 0; + nofs_flags = memalloc_nofs_save(); ret = blkdev_zone_mgmt(device->bdev, REQ_OP_ZONE_RESET, physical >> SECTOR_SHIFT, length >> SECTOR_SHIFT, - GFP_NOFS); + GFP_KERNEL); + memalloc_nofs_restore(nofs_flags); if (ret) return ret; @@ -2234,14 +2250,17 @@ static int do_zone_finish(struct btrfs_block_group *block_group, bool fully_writ struct btrfs_device *device = map->stripes[i].dev; const u64 physical = map->stripes[i].physical; struct btrfs_zoned_device_info *zinfo = device->zone_info; + unsigned int nofs_flags; if (zinfo->max_active_zones == 0) continue; + nofs_flags = memalloc_nofs_save(); ret = blkdev_zone_mgmt(device->bdev, REQ_OP_ZONE_FINISH, physical >> SECTOR_SHIFT, zinfo->zone_size >> SECTOR_SHIFT, - GFP_NOFS); + GFP_KERNEL); + memalloc_nofs_restore(nofs_flags); if (ret) return ret; -- 2.43.0 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next prev parent reply other threads:[~2024-01-23 9:44 UTC|newest] Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-01-23 9:43 [PATCH 0/5] block: remove gfp_mask for blkdev_zone_mgmt() Johannes Thumshirn 2024-01-23 9:43 ` [f2fs-dev] " Johannes Thumshirn via Linux-f2fs-devel 2024-01-23 9:43 ` [PATCH 1/5] zonefs: pass GFP_KERNEL to blkdev_zone_mgmt() call Johannes Thumshirn 2024-01-23 9:43 ` [f2fs-dev] " Johannes Thumshirn via Linux-f2fs-devel 2024-01-23 20:39 ` Mikulas Patocka 2024-01-23 20:39 ` [f2fs-dev] " Mikulas Patocka 2024-01-23 23:21 ` Dave Chinner 2024-01-23 23:21 ` [f2fs-dev] " Dave Chinner via Linux-f2fs-devel 2024-01-23 23:31 ` Damien Le Moal 2024-01-23 23:31 ` [f2fs-dev] " Damien Le Moal 2024-01-23 9:43 ` [PATCH 2/5] dm: dm-zoned: pass GFP_KERNEL to blkdev_zone_mgmt Johannes Thumshirn 2024-01-23 9:43 ` [f2fs-dev] " Johannes Thumshirn via Linux-f2fs-devel 2024-01-23 20:18 ` Mikulas Patocka 2024-01-23 20:18 ` [f2fs-dev] " Mikulas Patocka 2024-01-23 9:43 ` Johannes Thumshirn [this message] 2024-01-23 9:43 ` [f2fs-dev] [PATCH 3/5] btrfs: zoned: call blkdev_zone_mgmt in nofs scope Johannes Thumshirn via Linux-f2fs-devel 2024-01-23 9:43 ` [PATCH 4/5] f2fs: guard blkdev_zone_mgmt with " Johannes Thumshirn 2024-01-23 9:43 ` [f2fs-dev] " Johannes Thumshirn via Linux-f2fs-devel 2024-01-23 9:43 ` [PATCH 5/5] block: remove gfp_flags from blkdev_zone_mgmt Johannes Thumshirn 2024-01-23 9:43 ` [f2fs-dev] " Johannes Thumshirn via Linux-f2fs-devel 2024-01-26 22:03 ` kernel test robot 2024-01-26 22:03 ` [f2fs-dev] " kernel test robot 2024-01-27 9:57 ` kernel test robot 2024-01-27 9:57 ` [f2fs-dev] " kernel test robot
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=20240123-zonefs_nofs-v1-3-cc0b0308ef25@wdc.com \ --to=johannes.thumshirn@wdc.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=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=naohiro.aota@wdc.com \ --cc=sagi@grimberg.me \ --cc=snitzer@kernel.org \ --cc=willy@infradead.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.