Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Chi Zhiling and committed by
Namjae Jeon
a2999001 6ed88c94

+6 -12
+6 -12
fs/exfat/balloc.c
··· 74 74 struct exfat_dentry *ep) 75 75 { 76 76 struct exfat_sb_info *sbi = EXFAT_SB(sb); 77 - struct blk_plug plug; 78 77 long long map_size; 79 78 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; 82 81 83 82 sbi->map_clu = le32_to_cpu(ep->dentry.bitmap.start_clu); 84 83 map_size = le64_to_cpu(ep->dentry.bitmap.size); ··· 99 100 if (!sbi->vol_amap) 100 101 return -ENOMEM; 101 102 102 - sector = exfat_cluster_to_sector(sbi, sbi->map_clu); 103 - max_ra_count = min(sb->s_bdi->ra_pages, sb->s_bdi->io_pages) << 104 - (PAGE_SHIFT - sb->s_blocksize_bits); 103 + sector = ra = exfat_cluster_to_sector(sbi, sbi->map_clu); 104 + end = sector + sbi->map_sectors - 1; 105 + 105 106 for (i = 0; i < sbi->map_sectors; i++) { 106 107 /* Trigger the next readahead in advance. */ 107 - if (max_ra_count && 0 == (i % max_ra_count)) { 108 - blk_start_plug(&plug); 109 - for (j = i; j < min(max_ra_count, sbi->map_sectors - i) + i; j++) 110 - sb_breadahead(sb, sector + j); 111 - blk_finish_plug(&plug); 112 - } 108 + exfat_blk_readahead(sb, sector + i, &ra, &ra_cnt, end); 113 109 114 110 sbi->vol_amap[i] = sb_bread(sb, sector + i); 115 111 if (!sbi->vol_amap[i])