Skip to content

Commit a299900

Browse files
Chi Zhilingnamjaejeon
authored andcommitted
exfat: use readahead helper in exfat_allocate_bitmap
Use the newly added exfat_blk_readahead() helper in exfat_allocate_bitmap() to simplify the code. This eliminates the duplicate inline readahead logic and uses the unified readahead interface. Signed-off-by: Chi Zhiling <chizhiling@kylinos.cn> Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
1 parent 6ed88c9 commit a299900

1 file changed

Lines changed: 6 additions & 12 deletions

File tree

fs/exfat/balloc.c

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,10 @@ static int exfat_allocate_bitmap(struct super_block *sb,
7474
struct exfat_dentry *ep)
7575
{
7676
struct exfat_sb_info *sbi = EXFAT_SB(sb);
77-
struct blk_plug plug;
7877
long long map_size;
7978
unsigned int i, j, need_map_size;
80-
sector_t sector;
81-
unsigned int max_ra_count;
79+
sector_t sector, end, ra;
80+
blkcnt_t ra_cnt = 0;
8281

8382
sbi->map_clu = le32_to_cpu(ep->dentry.bitmap.start_clu);
8483
map_size = le64_to_cpu(ep->dentry.bitmap.size);
@@ -100,17 +99,12 @@ static int exfat_allocate_bitmap(struct super_block *sb,
10099
if (!sbi->vol_amap)
101100
return -ENOMEM;
102101

103-
sector = exfat_cluster_to_sector(sbi, sbi->map_clu);
104-
max_ra_count = min(sb->s_bdi->ra_pages, sb->s_bdi->io_pages) <<
105-
(PAGE_SHIFT - sb->s_blocksize_bits);
102+
sector = ra = exfat_cluster_to_sector(sbi, sbi->map_clu);
103+
end = sector + sbi->map_sectors - 1;
104+
106105
for (i = 0; i < sbi->map_sectors; i++) {
107106
/* Trigger the next readahead in advance. */
108-
if (max_ra_count && 0 == (i % max_ra_count)) {
109-
blk_start_plug(&plug);
110-
for (j = i; j < min(max_ra_count, sbi->map_sectors - i) + i; j++)
111-
sb_breadahead(sb, sector + j);
112-
blk_finish_plug(&plug);
113-
}
107+
exfat_blk_readahead(sb, sector + i, &ra, &ra_cnt, end);
114108

115109
sbi->vol_amap[i] = sb_bread(sb, sector + i);
116110
if (!sbi->vol_amap[i])

0 commit comments

Comments
 (0)