f2fs: clean up w/ sbi->log_sectors_per_block
Use sbi->log_sectors_per_block to clean up below calculated one: unsigned int log_sectors_per_block = sbi->log_blocksize - SECTOR_SHIFT; Signed-off-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
90b7c4b748
commit
bfd4766239
|
@ -4768,17 +4768,17 @@ static int check_zone_write_pointer(struct f2fs_sb_info *sbi,
|
|||
{
|
||||
unsigned int wp_segno, wp_blkoff, zone_secno, zone_segno, segno;
|
||||
block_t zone_block, wp_block, last_valid_block;
|
||||
unsigned int log_sectors_per_block = sbi->log_blocksize - SECTOR_SHIFT;
|
||||
int i, s, b, ret;
|
||||
struct seg_entry *se;
|
||||
|
||||
if (zone->type != BLK_ZONE_TYPE_SEQWRITE_REQ)
|
||||
return 0;
|
||||
|
||||
wp_block = fdev->start_blk + (zone->wp >> log_sectors_per_block);
|
||||
wp_block = fdev->start_blk + (zone->wp >> sbi->log_sectors_per_block);
|
||||
wp_segno = GET_SEGNO(sbi, wp_block);
|
||||
wp_blkoff = wp_block - START_BLOCK(sbi, wp_segno);
|
||||
zone_block = fdev->start_blk + (zone->start >> log_sectors_per_block);
|
||||
zone_block = fdev->start_blk + (zone->start >>
|
||||
sbi->log_sectors_per_block);
|
||||
zone_segno = GET_SEGNO(sbi, zone_block);
|
||||
zone_secno = GET_SEC_FROM_SEG(sbi, zone_segno);
|
||||
|
||||
|
@ -4824,7 +4824,7 @@ static int check_zone_write_pointer(struct f2fs_sb_info *sbi,
|
|||
"pointer. Reset the write pointer: wp[0x%x,0x%x]",
|
||||
wp_segno, wp_blkoff);
|
||||
ret = __f2fs_issue_discard_zone(sbi, fdev->bdev, zone_block,
|
||||
zone->len >> log_sectors_per_block);
|
||||
zone->len >> sbi->log_sectors_per_block);
|
||||
if (ret)
|
||||
f2fs_err(sbi, "Discard zone failed: %s (errno=%d)",
|
||||
fdev->path, ret);
|
||||
|
@ -4885,7 +4885,6 @@ static int fix_curseg_write_pointer(struct f2fs_sb_info *sbi, int type)
|
|||
struct blk_zone zone;
|
||||
unsigned int cs_section, wp_segno, wp_blkoff, wp_sector_off;
|
||||
block_t cs_zone_block, wp_block;
|
||||
unsigned int log_sectors_per_block = sbi->log_blocksize - SECTOR_SHIFT;
|
||||
sector_t zone_sector;
|
||||
int err;
|
||||
|
||||
|
@ -4897,8 +4896,8 @@ static int fix_curseg_write_pointer(struct f2fs_sb_info *sbi, int type)
|
|||
return 0;
|
||||
|
||||
/* report zone for the sector the curseg points to */
|
||||
zone_sector = (sector_t)(cs_zone_block - zbd->start_blk)
|
||||
<< log_sectors_per_block;
|
||||
zone_sector = (sector_t)(cs_zone_block - zbd->start_blk) <<
|
||||
sbi->log_sectors_per_block;
|
||||
err = blkdev_report_zones(zbd->bdev, zone_sector, 1,
|
||||
report_one_zone_cb, &zone);
|
||||
if (err != 1) {
|
||||
|
@ -4910,10 +4909,10 @@ static int fix_curseg_write_pointer(struct f2fs_sb_info *sbi, int type)
|
|||
if (zone.type != BLK_ZONE_TYPE_SEQWRITE_REQ)
|
||||
return 0;
|
||||
|
||||
wp_block = zbd->start_blk + (zone.wp >> log_sectors_per_block);
|
||||
wp_block = zbd->start_blk + (zone.wp >> sbi->log_sectors_per_block);
|
||||
wp_segno = GET_SEGNO(sbi, wp_block);
|
||||
wp_blkoff = wp_block - START_BLOCK(sbi, wp_segno);
|
||||
wp_sector_off = zone.wp & GENMASK(log_sectors_per_block - 1, 0);
|
||||
wp_sector_off = zone.wp & GENMASK(sbi->log_sectors_per_block - 1, 0);
|
||||
|
||||
if (cs->segno == wp_segno && cs->next_blkoff == wp_blkoff &&
|
||||
wp_sector_off == 0)
|
||||
|
@ -4940,8 +4939,8 @@ static int fix_curseg_write_pointer(struct f2fs_sb_info *sbi, int type)
|
|||
if (!zbd)
|
||||
return 0;
|
||||
|
||||
zone_sector = (sector_t)(cs_zone_block - zbd->start_blk)
|
||||
<< log_sectors_per_block;
|
||||
zone_sector = (sector_t)(cs_zone_block - zbd->start_blk) <<
|
||||
sbi->log_sectors_per_block;
|
||||
err = blkdev_report_zones(zbd->bdev, zone_sector, 1,
|
||||
report_one_zone_cb, &zone);
|
||||
if (err != 1) {
|
||||
|
@ -4959,7 +4958,7 @@ static int fix_curseg_write_pointer(struct f2fs_sb_info *sbi, int type)
|
|||
"Reset the zone: curseg[0x%x,0x%x]",
|
||||
type, cs->segno, cs->next_blkoff);
|
||||
err = __f2fs_issue_discard_zone(sbi, zbd->bdev, cs_zone_block,
|
||||
zone.len >> log_sectors_per_block);
|
||||
zone.len >> sbi->log_sectors_per_block);
|
||||
if (err) {
|
||||
f2fs_err(sbi, "Discard zone failed: %s (errno=%d)",
|
||||
zbd->path, err);
|
||||
|
|
Loading…
Reference in New Issue