From patchwork Mon Mar 19 00:36:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Lyle X-Patchwork-Id: 10291467 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D0A7260291 for ; Mon, 19 Mar 2018 00:36:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C372628EDF for ; Mon, 19 Mar 2018 00:36:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B812228F56; Mon, 19 Mar 2018 00:36:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4005328EDF for ; Mon, 19 Mar 2018 00:36:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754809AbeCSAgy (ORCPT ); Sun, 18 Mar 2018 20:36:54 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:46525 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754781AbeCSAgt (ORCPT ); Sun, 18 Mar 2018 20:36:49 -0400 Received: by mail-pl0-f68.google.com with SMTP id f5-v6so9199629plj.13 for ; Sun, 18 Mar 2018 17:36:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lyle-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=QFDsBEkZAB0XnoQgwf6wn63S7eUKt3eP09b2lRSnVXs=; b=zTO5SgGt8zC8MX7T/VneMVtDoCxUQ9lMt90QbZAbMROJtK+Zybbs8EGUSzpH/pcahY 84UhC6di2+hywgaOnuxHCTe4pueOg20/ChH0esRsOE6FMCbv8wOlplE1U+rq5SPr5+X7 AxQMiegElGmBR/gI/vWd6JLwa2woENxw1Ni3IaZz6SSJ1OzGLR30eFEkaUDcOaebu9Mo mE8JjysFb/nv/Xm20ePhVEy48duJyDW3cixZaJpBtVA3Ykxzd9c1AbWqk1oNg5mnA5lm ZFEbhx4JspH4ut3pObL+YSPqljrvuxa16ZXZYfcAAs0PxUcVe4Z2g2tr+OCDes9MQ+xj d6fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=QFDsBEkZAB0XnoQgwf6wn63S7eUKt3eP09b2lRSnVXs=; b=fBiLd0U8cZEe3aKDF9ogMH+ayFANbMqkELPfYDcp4Yn1WzHEu1QuhNrnj/72ABWns1 pNhtLawI5CwOp44I2x4CCx0lnEECLXCw0Brk/XRl7t7RKE18ZFvxPdIhSDdVx6jXssB7 CR+GhAm7zplvyDHQPq+9+ns34CGFd1Km5rQNbXYGVnaYW7krT8Rggri1t5vMB7t/s3YD bJb2G3+SdtQbL7ofUmUkuH3TgCeyXhvi/amtSRH0kfcAyoGJAzFtilDaqvruMZrSnmut +cCnQKWTy/oW+4Jq/W+KDbJWuZhz8OSHVUTcnbc7Wnz5Yv0vTMeUo/FaRipKjF2EnMsd wJ7w== X-Gm-Message-State: AElRT7E5Rk6j/Z7jfAR+iOO4f9D4m9PfgRN7tbng5Dmuz8qvHEkn9UmH JfKpCAbhDHErVGxYglDmH1j1QA== X-Google-Smtp-Source: AG47ELu8qY6ToyKpeZUTh2e+xyZ0ewpUvasSBKPM+7z/KgQ4tF8/wNPdJ5nAY4mg+YE63v7CTdMZYw== X-Received: by 2002:a17:902:322:: with SMTP id 31-v6mr10513732pld.122.1521419808685; Sun, 18 Mar 2018 17:36:48 -0700 (PDT) Received: from midnight.lan (2600-6c52-6200-09b7-0000-0000-0000-0d66.dhcp6.chtrptr.net. [2600:6c52:6200:9b7::d66]) by smtp.gmail.com with ESMTPSA id a17sm27674857pfc.122.2018.03.18.17.36.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Mar 2018 17:36:48 -0700 (PDT) From: Michael Lyle To: linux-bcache@vger.kernel.org, linux-block@vger.kernel.org Cc: axboe@fb.com, Tang Junhui Subject: [for-4.17 07/20] bcache: fix incorrect sysfs output value of strip size Date: Sun, 18 Mar 2018 17:36:20 -0700 Message-Id: <20180319003633.27225-8-mlyle@lyle.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180319003633.27225-1-mlyle@lyle.org> References: <20180319003633.27225-1-mlyle@lyle.org> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Tang Junhui Stripe size is shown as zero when no strip in back end device: [root@ceph132 ~]# cat /sys/block/sdd/bcache/stripe_size 0.0k Actually it should be 1T Bytes (1 << 31 sectors), but in sysfs interface, stripe_size was changed from sectors to bytes, and move 9 bits left, so the 32 bits variable overflows. This patch change the variable to a 64 bits type before moving bits. Signed-off-by: Tang Junhui Reviewed-by: Michael Lyle --- drivers/md/bcache/sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c index 414129f7c49f..8c3fd05db87a 100644 --- a/drivers/md/bcache/sysfs.c +++ b/drivers/md/bcache/sysfs.c @@ -181,7 +181,7 @@ SHOW(__bch_cached_dev) sysfs_hprint(dirty_data, bcache_dev_sectors_dirty(&dc->disk) << 9); - sysfs_hprint(stripe_size, dc->disk.stripe_size << 9); + sysfs_hprint(stripe_size, ((uint64_t)dc->disk.stripe_size) << 9); var_printf(partial_stripes_expensive, "%u"); var_hprint(sequential_cutoff);