[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <1543570361-3168-2-git-send-email-huijin.park@samsung.com>
Date: Fri, 30 Nov 2018 04:32:41 -0500
From: Huijin Park <huijin.park@...sung.com>
To: Andreas Dilger <adilger.kernel@...ger.ca>,
Michael Callahan <michaelcallahan@...com>
Cc: Omar Sandoval <osandov@...com>, js07.lee@...sung.com,
Huijin Park <huijin.park@...sung.com>,
Huijin Park <bbanghj.park@...il.com>,
linux-block@...r.kernel.org, linux-ext4@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH,2/2] ext4: change type to same as sectors in disk_stats
From: "huijin.park" <huijin.park@...sung.com>
This patch changes the 's_sectors_written_start' type to u64
same as the 'sectors' type in disk_stats.
Because if the 'sectors' has more than about 2TiB,
the 's_sectors_written_start' will overflow in 32 bit system.
And it makes invalid statistics([session|lifetime]_write_kbytes).
Signed-off-by: huijin.park <huijin.park@...sung.com>
---
fs/ext4/ext4.h | 2 +-
fs/ext4/sysfs.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 3f89d0a..d3a08b2 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1457,7 +1457,7 @@ struct ext4_sb_info {
struct ext4_locality_group __percpu *s_locality_groups;
/* for write statistics */
- unsigned long s_sectors_written_start;
+ u64 s_sectors_written_start;
u64 s_kbytes_written;
/* the size of zero-out chunk */
diff --git a/fs/ext4/sysfs.c b/fs/ext4/sysfs.c
index 9212a02..59ac5cf 100644
--- a/fs/ext4/sysfs.c
+++ b/fs/ext4/sysfs.c
@@ -57,7 +57,7 @@ static ssize_t session_write_kbytes_show(struct ext4_sb_info *sbi, char *buf)
if (!sb->s_bdev->bd_part)
return snprintf(buf, PAGE_SIZE, "0\n");
- return snprintf(buf, PAGE_SIZE, "%lu\n",
+ return snprintf(buf, PAGE_SIZE, "%llu\n",
(part_stat_read(sb->s_bdev->bd_part,
sectors[STAT_WRITE]) -
sbi->s_sectors_written_start) >> 1);
--
1.7.9.5
Powered by blists - more mailing lists