Skip to content
/ linux Public
forked from torvalds/linux

Commit

Permalink
f2fs: guard blkdev_zone_mgmt with nofs scope
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Damien Le Moal <[email protected]>
Reviewed-by: Chao Yu <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
morbidrsa authored and axboe committed Feb 12, 2024
1 parent d9d5567 commit 147ec1c
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions fs/f2fs/segment.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 147ec1c

Please sign in to comment.