From patchwork Tue May 3 15:49:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Callahan X-Patchwork-Id: 9005471 Return-Path: X-Original-To: patchwork-linux-block@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 81D989F1D3 for ; Tue, 3 May 2016 15:50:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8D5B6201F5 for ; Tue, 3 May 2016 15:50:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7D981202B8 for ; Tue, 3 May 2016 15:50:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756103AbcECPuP (ORCPT ); Tue, 3 May 2016 11:50:15 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:56061 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756093AbcECPuO (ORCPT ); Tue, 3 May 2016 11:50:14 -0400 Received: from pps.filterd (m0044008.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u43FjiAB025680 for ; Tue, 3 May 2016 08:50:14 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=from : to : subject : date : message-id : mime-version : content-type; s=facebook; bh=+gYnSxynz4kwRjiEI9u/zh0OnXulhaBWrfcCd1hWADk=; b=L3Ko6+zRbsisCxU+BI8RvxvE0ICOKSPAWHROokXlrOPeExjMTT7GeV5EAgnNL/GzJhxZ j3JHjF2F9qm7ycG9+I5bIBwKkgmyEbHKRJUkvQyJCF7MMWnw06GLTXXI8dy3VOim4PTU RU0tyVqx1NkyMOk8dHjt7VhCTv8JUJU7XDw= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0a-00082601.pphosted.com with ESMTP id 22ptcw9vxk-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Tue, 03 May 2016 08:50:14 -0700 Received: from vmbox.dyndns.org (192.168.52.123) by PRN-CHUB09.TheFacebook.com (192.168.16.19) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 3 May 2016 08:50:12 -0700 From: Michael Callahan To: Subject: [PATCH 1/1] block: Use WRITE for part_stat_read references. Date: Tue, 3 May 2016 11:49:59 -0400 Message-ID: MIME-Version: 1.0 X-Originating-IP: [192.168.52.123] X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-05-03_06:, , signatures=0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- -- To unsubscribe from this list: send the line "unsubscribe linux-block" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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);