From patchwork Mon Jan 25 15:34:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101129 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp1428221lbb; Mon, 25 Jan 2016 07:35:48 -0800 (PST) X-Received: by 10.66.119.71 with SMTP id ks7mr500377pab.151.1453736147935; Mon, 25 Jan 2016 07:35:47 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w70si34323434pfa.98.2016.01.25.07.35.47; Mon, 25 Jan 2016 07:35:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757426AbcAYPfp (ORCPT + 30 others); Mon, 25 Jan 2016 10:35:45 -0500 Received: from mout.kundenserver.de ([212.227.126.134]:56761 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751913AbcAYPfm (ORCPT ); Mon, 25 Jan 2016 10:35:42 -0500 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue003) with ESMTPA (Nemesis) id 0Mb5Kx-1ahC7x07bv-00Kdht; Mon, 25 Jan 2016 16:35:10 +0100 From: Arnd Bergmann To: Trond Myklebust , Anna Schumaker Cc: linux-arm-kernel@lists.infradead.org, Arnd Bergmann , linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] nfs: blocklayout: avoid warnings on 32-bit sector_t Date: Mon, 25 Jan 2016 16:34:53 +0100 Message-Id: <1453736106-1958809-1-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 X-Provags-ID: V03:K0:CF41YCGIVRZdNylrgj5qsXecF2R19CnsTqPnfoAouENWCo/clPz NTVs3YwnO7exl9J05gzW9aEgzq/HhjvaoDYGCcWWs1XyEUOE4usc8bw9L0NUsFsBn9WqDS+ quHQj1j6KfP/FnCpE69HHjNUDnuozGFRcdb5tU3o+E3f30t6qQcXi/WEPhBwuaA6lMHl0m0 9fXFFeREBsIb0ydaFNIgg== X-UI-Out-Filterresults: notjunk:1; V01:K0:aBYQTpHJ/UE=:mYAADzQFd4t5q1rzNeq8P+ p9aRLz4ONBy1bN3mHPg+JBuqzD+/VBiaKyP9GWN4Yc9Yo01Q2BiSbD7mGllSgljqnqc/h9Cqc o5u7NYg/Z1e+EO+K7T9FPNYYglK6i1hEk2r9V6bCIt46IqOMHVbcKKtHCLUnb4IcyO7C4sttH pklOaUOu5VFG9dERK2C1RMx74psI+xrq1BM+Ku1HwH5LziQI/+1osdjNG9a/CVJbHQAvUUxZw MSvreWIi0EIdpZC9XZZrldH9cpL8ry8zIxFlM+PTi658GUD8O3yLjYiUsVxEoxESb4avZfswa RTgFcTN1+SlBpv0LL+ur0P1EvMhIUP7ea5jgAMLfD7R1JZ3ji64YaUsOlxBQnJe827/3zxrmD P4umlnFuyrAmEtLIEq8P+7iZnXeMsszI22bGONx3pGj/r+tMgKD5msHHSiUU1Zyrr9moyOws6 fCzypftUgtFdG/OlzyXbmQzuiAe9F0x3+MeRsF2WJRD5oIWSNO42xXcAXda26qXNB27FexqZR jdf4XYL01YtceOdnXTNuxkBv7HSrJ61oFn1gva4fAOnVMWkclKeWPZHU+WePE442UNT4EuHfw yuP2GkYXO2dB3QcccwQDsCNff+LsnPEGSTXBFV0yR/FD/Vd35jMnv289gnzOREo6VjU2pwI+X apfYJRK/yIGGckiL/LcBMmhGhFcVrfXExwUUxdKo7mTvqxpmEKoXfP+9+71EksiYS/lw= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org sector_t can be either 32-bit or 64-bit wide, but in the former case, the NFS blocklayout code produces a couple of warnings: blocklayout.c: In function 'bl_read_pagelist': blocklayout.c:225:45: error: large integer implicitly truncated to unsigned type [-Werror=overflow] struct pnfs_block_dev_map map = { .start = NFS4_MAX_UINT64 }; ^ blocklayout.c:282:16: error: large integer implicitly truncated to unsigned type [-Werror=overflow] map.start = NFS4_MAX_UINT64; ^ blocklayout.c: In function 'bl_write_pagelist': blocklayout.c:368:45: error: large integer implicitly truncated to unsigned type [-Werror=overflow] struct pnfs_block_dev_map map = { .start = NFS4_MAX_UINT64 }; ^ blocklayout.c: In function 'bl_free_layout_hdr': blocklayout.c:443:37: error: large integer implicitly truncated to unsigned type [-Werror=overflow] err = ext_tree_remove(bl, true, 0, LLONG_MAX); ^ blocklayout.c: In function 'bl_return_range': blocklayout.c:708:9: error: large integer implicitly truncated to unsigned type [-Werror=overflow] end = round_down(NFS4_MAX_UINT64, PAGE_SIZE); In all instances, NFS4_MAX_UINT64 is meant to just refer to the largest representable unsigned integer, and the warning is for the implicit type conversiont to a smaller type. As the conversion is ok, we can use an explict cast to stop the warning. Signed-off-by: Arnd Bergmann --- fs/nfs/blocklayout/blocklayout.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) -- 2.7.0 diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c index ddd0138f410c..94b2f9e272c5 100644 --- a/fs/nfs/blocklayout/blocklayout.c +++ b/fs/nfs/blocklayout/blocklayout.c @@ -222,7 +222,7 @@ static enum pnfs_try_status bl_read_pagelist(struct nfs_pgio_header *header) { struct pnfs_block_layout *bl = BLK_LSEG2EXT(header->lseg); - struct pnfs_block_dev_map map = { .start = NFS4_MAX_UINT64 }; + struct pnfs_block_dev_map map = { .start = (sector_t)NFS4_MAX_UINT64 }; struct bio *bio = NULL; struct pnfs_block_extent be; sector_t isect, extent_length = 0; @@ -279,7 +279,7 @@ bl_read_pagelist(struct nfs_pgio_header *header) zero_user_segment(pages[i], pg_offset, pg_len); /* invalidate map */ - map.start = NFS4_MAX_UINT64; + map.start = (sector_t)NFS4_MAX_UINT64; } else { bio = do_add_page_to_bio(bio, header->page_array.npages - i, @@ -365,7 +365,7 @@ static enum pnfs_try_status bl_write_pagelist(struct nfs_pgio_header *header, int sync) { struct pnfs_block_layout *bl = BLK_LSEG2EXT(header->lseg); - struct pnfs_block_dev_map map = { .start = NFS4_MAX_UINT64 }; + struct pnfs_block_dev_map map = { .start = (sector_t)NFS4_MAX_UINT64 }; struct bio *bio = NULL; struct pnfs_block_extent be; sector_t isect, extent_length = 0; @@ -440,7 +440,7 @@ static void bl_free_layout_hdr(struct pnfs_layout_hdr *lo) dprintk("%s enter\n", __func__); - err = ext_tree_remove(bl, true, 0, LLONG_MAX); + err = ext_tree_remove(bl, true, 0, (sector_t)LLONG_MAX); WARN_ON(err); kfree(bl); @@ -705,7 +705,7 @@ bl_return_range(struct pnfs_layout_hdr *lo, end = offset + (range->length >> SECTOR_SHIFT); } else { - end = round_down(NFS4_MAX_UINT64, PAGE_SIZE); + end = round_down((sector_t)NFS4_MAX_UINT64, PAGE_SIZE); } ext_tree_remove(bl, range->iomode & IOMODE_RW, offset, end);