Use the WRITE define when referencing part_stat_read rather than hardcoding entry 1. No functional change but it's cleaner. Sign-off-by: Michael Callahan <michaelcallahan@xxxxxx> --- diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 304c712..5e90934 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -3182,7 +3182,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) sbi->s_sb_block = sb_block; if (sb->s_bdev->bd_part) sbi->s_sectors_written_start = - part_stat_read(sb->s_bdev->bd_part, sectors[1]); + part_stat_read(sb->s_bdev->bd_part, sectors[WRITE]); /* Cleanup superblock name */ strreplace(sb->s_id, '/', '!'); @@ -4359,7 +4359,7 @@ static int ext4_commit_super(struct super_block *sb, int sync) if (sb->s_bdev->bd_part) es->s_kbytes_written = cpu_to_le64(EXT4_SB(sb)->s_kbytes_written + - ((part_stat_read(sb->s_bdev->bd_part, sectors[1]) - + ((part_stat_read(sb->s_bdev->bd_part, sectors[WRITE]) - EXT4_SB(sb)->s_sectors_written_start) >> 1)); else es->s_kbytes_written = diff --git a/fs/ext4/sysfs.c b/fs/ext4/sysfs.c index 1420a3c..7254239 100644 --- a/fs/ext4/sysfs.c +++ b/fs/ext4/sysfs.c @@ -55,7 +55,7 @@ static ssize_t session_write_kbytes_show(struct ext4_attr *a, if (!sb->s_bdev->bd_part) return snprintf(buf, PAGE_SIZE, "0\n"); return snprintf(buf, PAGE_SIZE, "%lu\n", - (part_stat_read(sb->s_bdev->bd_part, sectors[1]) - + (part_stat_read(sb->s_bdev->bd_part, sectors[WRITE]) - sbi->s_sectors_written_start) >> 1); } @@ -68,7 +68,7 @@ static ssize_t lifetime_write_kbytes_show(struct ext4_attr *a, return snprintf(buf, PAGE_SIZE, "0\n"); return snprintf(buf, PAGE_SIZE, "%llu\n", (unsigned long long)(sbi->s_kbytes_written + - ((part_stat_read(sb->s_bdev->bd_part, sectors[1]) - + ((part_stat_read(sb->s_bdev->bd_part, sectors[WRITE]) - EXT4_SB(sb)->s_sectors_written_start) >> 1))); } diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 7a4558d..c5fe6ff 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -808,7 +808,7 @@ struct f2fs_sb_info { * and the return value is in kbytes. s is of struct f2fs_sb_info. */ #define BD_PART_WRITTEN(s) \ -(((u64)part_stat_read(s->sb->s_bdev->bd_part, sectors[1]) - \ +(((u64)part_stat_read(s->sb->s_bdev->bd_part, sectors[WRITE]) - \ s->sectors_written_start) >> 1) static inline void f2fs_update_time(struct f2fs_sb_info *sbi, int type) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 006f87d..c7f1443 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -1464,7 +1464,7 @@ try_onemore: /* For write statistics */ if (sb->s_bdev->bd_part) sbi->sectors_written_start = - (u64)part_stat_read(sb->s_bdev->bd_part, sectors[1]); + (u64)part_stat_read(sb->s_bdev->bd_part, sectors[WRITE]); /* Read accumulated write IO statistics if exists */ seg_i = CURSEG_I(sbi, CURSEG_HOT_NODE); -- To unsubscribe from this list: send the line "unsubscribe linux-block" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html