f2fs: zone: introduce first_zoned_segno in f2fs_sb_info
[ Upstream commit 5bc5aae843128aefb1c55d769d057c92dd8a32c9 ] first_zoned_segno() returns a fixed value, let's cache it in structure f2fs_sb_info to avoid redundant calculation. Signed-off-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> Stable-dep-of: dc6d9ef57fcf ("f2fs: zone: fix to calculate first_zoned_segno correctly") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
5833026221
commit
ffbbe11577
@@ -1762,6 +1762,7 @@ struct f2fs_sb_info {
|
|||||||
unsigned int dirty_device; /* for checkpoint data flush */
|
unsigned int dirty_device; /* for checkpoint data flush */
|
||||||
spinlock_t dev_lock; /* protect dirty_device */
|
spinlock_t dev_lock; /* protect dirty_device */
|
||||||
bool aligned_blksize; /* all devices has the same logical blksize */
|
bool aligned_blksize; /* all devices has the same logical blksize */
|
||||||
|
unsigned int first_zoned_segno; /* first zoned segno */
|
||||||
|
|
||||||
/* For write statistics */
|
/* For write statistics */
|
||||||
u64 sectors_written_start;
|
u64 sectors_written_start;
|
||||||
|
|||||||
+2
-2
@@ -2719,7 +2719,7 @@ static int get_new_segment(struct f2fs_sb_info *sbi,
|
|||||||
if (sbi->blkzone_alloc_policy == BLKZONE_ALLOC_PRIOR_CONV || pinning)
|
if (sbi->blkzone_alloc_policy == BLKZONE_ALLOC_PRIOR_CONV || pinning)
|
||||||
segno = 0;
|
segno = 0;
|
||||||
else
|
else
|
||||||
segno = max(first_zoned_segno(sbi), *newseg);
|
segno = max(sbi->first_zoned_segno, *newseg);
|
||||||
hint = GET_SEC_FROM_SEG(sbi, segno);
|
hint = GET_SEC_FROM_SEG(sbi, segno);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -2731,7 +2731,7 @@ find_other_zone:
|
|||||||
if (secno >= MAIN_SECS(sbi) && f2fs_sb_has_blkzoned(sbi)) {
|
if (secno >= MAIN_SECS(sbi) && f2fs_sb_has_blkzoned(sbi)) {
|
||||||
/* Write only to sequential zones */
|
/* Write only to sequential zones */
|
||||||
if (sbi->blkzone_alloc_policy == BLKZONE_ALLOC_ONLY_SEQ) {
|
if (sbi->blkzone_alloc_policy == BLKZONE_ALLOC_ONLY_SEQ) {
|
||||||
hint = GET_SEC_FROM_SEG(sbi, first_zoned_segno(sbi));
|
hint = GET_SEC_FROM_SEG(sbi, sbi->first_zoned_segno);
|
||||||
secno = find_next_zero_bit(free_i->free_secmap, MAIN_SECS(sbi), hint);
|
secno = find_next_zero_bit(free_i->free_secmap, MAIN_SECS(sbi), hint);
|
||||||
} else
|
} else
|
||||||
secno = find_first_zero_bit(free_i->free_secmap,
|
secno = find_first_zero_bit(free_i->free_secmap,
|
||||||
|
|||||||
@@ -992,13 +992,3 @@ wake_up:
|
|||||||
dcc->discard_wake = true;
|
dcc->discard_wake = true;
|
||||||
wake_up_interruptible_all(&dcc->discard_wait_queue);
|
wake_up_interruptible_all(&dcc->discard_wait_queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned int first_zoned_segno(struct f2fs_sb_info *sbi)
|
|
||||||
{
|
|
||||||
int devi;
|
|
||||||
|
|
||||||
for (devi = 0; devi < sbi->s_ndevs; devi++)
|
|
||||||
if (bdev_is_zoned(FDEV(devi).bdev))
|
|
||||||
return GET_SEGNO(sbi, FDEV(devi).start_blk);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -4260,6 +4260,16 @@ static void f2fs_record_error_work(struct work_struct *work)
|
|||||||
f2fs_record_stop_reason(sbi);
|
f2fs_record_stop_reason(sbi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline unsigned int get_first_zoned_segno(struct f2fs_sb_info *sbi)
|
||||||
|
{
|
||||||
|
int devi;
|
||||||
|
|
||||||
|
for (devi = 0; devi < sbi->s_ndevs; devi++)
|
||||||
|
if (bdev_is_zoned(FDEV(devi).bdev))
|
||||||
|
return GET_SEGNO(sbi, FDEV(devi).start_blk);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int f2fs_scan_devices(struct f2fs_sb_info *sbi)
|
static int f2fs_scan_devices(struct f2fs_sb_info *sbi)
|
||||||
{
|
{
|
||||||
struct f2fs_super_block *raw_super = F2FS_RAW_SUPER(sbi);
|
struct f2fs_super_block *raw_super = F2FS_RAW_SUPER(sbi);
|
||||||
@@ -4660,6 +4670,9 @@ try_onemore:
|
|||||||
/* For write statistics */
|
/* For write statistics */
|
||||||
sbi->sectors_written_start = f2fs_get_sectors_written(sbi);
|
sbi->sectors_written_start = f2fs_get_sectors_written(sbi);
|
||||||
|
|
||||||
|
/* get segno of first zoned block device */
|
||||||
|
sbi->first_zoned_segno = get_first_zoned_segno(sbi);
|
||||||
|
|
||||||
/* Read accumulated write IO statistics if exists */
|
/* Read accumulated write IO statistics if exists */
|
||||||
seg_i = CURSEG_I(sbi, CURSEG_HOT_NODE);
|
seg_i = CURSEG_I(sbi, CURSEG_HOT_NODE);
|
||||||
if (__exist_node_summaries(sbi))
|
if (__exist_node_summaries(sbi))
|
||||||
|
|||||||
Reference in New Issue
Block a user