From patchwork Fri Dec 2 21:19:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 9459215 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 4E66560585 for ; Fri, 2 Dec 2016 21:20:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C089285AC for ; Fri, 2 Dec 2016 21:20:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2F0E5285B0; Fri, 2 Dec 2016 21:20:43 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 928DB285AC for ; Fri, 2 Dec 2016 21:20:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751033AbcLBVUl (ORCPT ); Fri, 2 Dec 2016 16:20:41 -0500 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:54907 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750856AbcLBVUj (ORCPT ); Fri, 2 Dec 2016 16:20:39 -0500 Received: from pps.filterd (m0044012.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id uB2L9KOF013701; Fri, 2 Dec 2016 13:19:20 -0800 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=PzRn9aCUcl2W3yWbGz3CRdTguKWNJap2fTIrXAiQcs0=; b=JnEwnwRXWnRD2Meow2ubaN4HFFxeDRC/7b7zCQQwZ8LBGVyGJmae81KP5G38TD98gVai aa6BzcAKLQGanEn8zfpo+DqUQhYEPIGdMckSt92k32Qp8F6Faqajmd+6BtS5aawYfvvh q+r7jR8s3xlQMhlooryyO6JRR4WcahNZy6A= Received: from maileast.thefacebook.com ([199.201.65.23]) by mx0a-00082601.pphosted.com with ESMTP id 273ekv93n3-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 02 Dec 2016 13:19:20 -0800 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (192.168.183.28) by o365-in.thefacebook.com (192.168.177.31) with Microsoft SMTP Server (TLS) id 14.3.294.0; Fri, 2 Dec 2016 16:19:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.onmicrosoft.com; s=selector1-fb-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=2hz3lhzBw2tq1R9xKRa3gIsl4rNTiYwvONAySR5du48=; b=BQn4iCxhPRJshCgyRG0RZo8MTmQfvukSyH0aulj1IURq/RJkJ8ApgBcr5z1oXhJgihrUjqj6NRjBhLWjTNYy4CWr2KsTLhBZXfA7mF7OdlcWbUzHQR8gsk+7ZKu3zzZugtDXcVfPKby6OiWYtHuImu40OplKsB9ig08jpTaQtcg= Received: from localhost (2620:10d:c091:180::1:b7f5) by DM5PR15MB1321.namprd15.prod.outlook.com (10.173.210.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.761.9; Fri, 2 Dec 2016 21:19:15 +0000 From: Josef Bacik To: , , , Subject: [PATCH] nbd: use loff_t for blocksize and nbd_set_size args Date: Fri, 2 Dec 2016 16:19:12 -0500 Message-ID: <1480713552-3535-1-git-send-email-jbacik@fb.com> X-Mailer: git-send-email 2.5.5 MIME-Version: 1.0 X-Originating-IP: [2620:10d:c091:180::1:b7f5] X-ClientProxiedBy: DM5PR08CA0024.namprd08.prod.outlook.com (10.175.218.34) To DM5PR15MB1321.namprd15.prod.outlook.com (10.173.210.11) X-MS-Office365-Filtering-Correlation-Id: 2ec4ef39-6ea3-43d4-5e14-08d41af8df0a X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:DM5PR15MB1321; X-Microsoft-Exchange-Diagnostics: 1; DM5PR15MB1321; 3:SQkmRmE+tJ5fvNlk1/TqBb2rjrEAfmrWzsHQK5M1rAoVyt7sYyEObGmdIliweUh/737k2WBk7jsQmXyyPLIpD1kuX8LfjlaUn8jsQSbIGBbCrRhJxUQYeQUax8rIJUMOXWaRW4jN+XTaa4STZRXhQjJJ8/MGJ1wbdRhsmM5wHueaZgAEPiCxJ0Cx6NEVS37km6Q1gHzk3pcYhwQxE+ka9tmUKqRLsYDhjo2QpP0m7mcdmhiLyp/0acYsBMEqMoKpCcB6iYl7jZGWW8yTKTuz9g== X-Microsoft-Exchange-Diagnostics: 1; DM5PR15MB1321; 25:xAgCiMy+0mKdhk7Is0Wk2WP4rONQsz3PULr5Jmkq6WVaic1reLPKacOi6gAeB/Z1M27HgGN/PyUKyI1ooFQl5bpBzVHCghkdDauI1PR2imhXctrhGqEuKlODlFpBs669IyJhnwbp2ti6F5e6nXhi97HssindQEmA2C9658EePFvkQASdjbfxUX2tvnn0PtS51/KhfBnFIAaE+Rkj54HKxhRjH3axpcgfqLlykHZv134I4qtER9NyLK4fDX6DSDbdlW1EO45TtVCKueXHQH1fnpS4AiAr0UFjhRV2govLOZKbJ4AOAXn/OHOeYfHyTyGmt/j9LjUievIb3dLUZtlmCHxvPHS2I7uK4QUq52gKe6aQwc1XFSJNoECNdpHRSOZYFf7pbeF6s+WuxuNKv61YvUTyQjw6xlQfWvGlP8TZHyRnakkl3fSSp0tzfBM+KLaSD8vprZsKQpHjYdxV3VlpM2kbLBDBFjG8fEYfNbf+dXCMHylvztPaui7q3YbMX+PJMMtuOOi3N9EaUAXhrECFXibmudZ7v18Qx9QeSEcu3IQT3yi/gU98EI55jWms1zsP4/LI9Cn91BnAArv80qc73E5TF3rTFJMykiT9DWT52fQNVaLDTdb003J0qM6tusBKPn1gjVYkoyJF7YSSFhVHWeyKpBzhv/5oVPR3uxI5z/Gw9WCZhxsCEaLJdpGj0TbKOFwzlqHj8DPV0JePl1a88gZ6HvYUXAVQMmHmVPT8XAWRP0r9TMyLSIXb+LTzz9sqP59ETNj/2Zb7tVBIJKWvjX3/PYcEe2lYlcAqvPvZiOg= X-Microsoft-Exchange-Diagnostics: 1; DM5PR15MB1321; 31:TDXJpdOCWgBQSfFO7yG7sGAsw2z6JBdAbX1i85QscGSydZnG8tf4xS15hoqAa21i+zM3pF0szepUQa3Lt96kjQ38SGPub3CXQFDA4dg4vq5Kagie1awPxQbjvYWynkBN+H55LkRPKLfqJbZ76ihjxxs2jkwI9BwxGGDctsSFHAZDzAp33kS4qgwrlYAZDXmmUSN3SZmj6jMak/mCFcuweOGUnz6dabIkJXefHWeZoYrrX3Cpr9WfnQ6/IWFFRBZMKYlTSv1+MTMA349ZglOP3A==; 20:aZTUpNiaDnntYliaP4VgbDFXB6aoZnEhkymRdKbE0EEf7f8cMRYKQA/HCOLPmF4gHlca8tN1rXS4qPgZKNNXtAlboNnnPdf9du3gwGoWDwC6djGU8+Vd210VmwBZiQR2C4/vaAu/RITVhmtQcB3OaPA5okGRb3efeBUFo+/xbOSxE/u97nko5CwYiQ7QxigHYomzlfslraybwt6uuy+L3HoSlklJiODIElEZMzBYMJLOdAwUCJdH3fKOG9jCou+L X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(67672495146484); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6041248)(20161123564025)(20161123562025)(20161123555025)(20161123560025)(6072148); SRVR:DM5PR15MB1321; BCL:0; PCL:0; RULEID:; SRVR:DM5PR15MB1321; X-Microsoft-Exchange-Diagnostics: 1; DM5PR15MB1321; 4:TTUmEE9zyLTcifJrCGDfcnlxj7my5gaJuc9ivqjxw+qeOLq9UNZP9pVBwE62ZGUgj/Am9oXMbvsaq7r/ophtaGpzCJQSlTl4l84wfSB0DJi8FGx/wMh4w5IvmqLvdFX4lqaSn3AWR6xj11M1eOIY8ci6YzmyQso0bzzk7TRb+ESGjwn1JgOror/dPeN6u5XvJcEatJ9hyU15v6/Qg7ULYlXt/sheqzf992I8z6gDVkfBtOnIv8v1VNkqkhfixnfnBxiT4rDn0S/v1Cuvj7ukMPiyX+OADnH6Q2aGCMXyk6aL+aijdtRHxy6I2YRt3q5ZeeDln7640whVSWJX1hP5UBFcg0YIBSvN53lIs8eDxMcFwWZ+O3dnYtht/9NQV3hYrFCg0BbYfpGkIxV2iyz8cA42R9AsVz2CxSeMJkp8IUuelMoLESP/+M35ZnV5CatEKtb6rCFXXGwaJGjtJ+Um02IXvqh0pyEsjQMOQW27dPTH2we7OnBJlFiQHUliTgcLZFX14LeezB5NZvhehk9ZdUW16d6JnMXPeTncc5ABrJzn8+Ak0Aw9MTZChmcHq+CPxgYrjWk+VtyO07ej49tbW/vZI8ypMoCc4aL/y101oy/uj2EZD7WYAFMMk8ZilNWk X-Forefront-PRVS: 0144B30E41 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(6069001)(7916002)(189002)(199003)(6666003)(50986999)(6636002)(6496003)(733004)(6486002)(86362001)(39450400002)(92566002)(39410400001)(68736007)(38730400001)(8676002)(189998001)(106356001)(50226002)(6116002)(105586002)(81156014)(2201001)(2906002)(81166006)(7736002)(50466002)(107886002)(42186005)(101416001)(33646002)(305945005)(47776003)(5660300001)(97736004)(48376002)(5001770100001)(76506005)(7846002)(36756003)(5003940100001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR15MB1321; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: fb.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR15MB1321; 23:4Q6lKHCQBwYFN/A5F9O+2WSUGS5jl6n5VxLzSgC/E?= =?us-ascii?Q?oaAxvS0zChg2BCe0pYIRJcQisDzMlDDssJDQksMnmG7HGU6RH3Zyt8M9pOfm?= =?us-ascii?Q?ac7pboUJ1kNyvbwxdrqVm5+k26++EGE3GuvXB+dB6wdT/+sIlq3WjI0pgBad?= =?us-ascii?Q?KAdJMDFJkDtczGOuPsXn0scZri5nTvEHJtR3PAGfyBnaCLBhZcy18hlaW7Ee?= =?us-ascii?Q?pyYPLZvML0RulqsnpxgoW/3h+/lXYGCzONXj76prU1NCoTlFRo044hcsx/pn?= =?us-ascii?Q?OIyPedyGtXtKJXaQmDChemlqcgJ/a86xIzkYajpDETy8FiRvplNRF3xLBL6Z?= =?us-ascii?Q?i09t0+y3NxvrJAfz8SrV7yzJqQ1NnCTFe1OvIr1rXW2lJzH6izkd2RUS7h+R?= =?us-ascii?Q?GqBKqoDPK4b6wKq86he2nnY4xMSvjcch2aUL4ebBHrxv5+3oVRPVL/YdUfAl?= =?us-ascii?Q?0m8Wo7kui7mgFLnRsxgX+Enbk2Ng2w9iKQuTqRi2KrSOrpC4DMs8GS+G1XtD?= =?us-ascii?Q?3mg9EiGpSYXVDNJaWqI1MN7j/QV4ARLejrXoNcD+80Zaj1kumoQLzkqEC/J1?= =?us-ascii?Q?uYDvSWqKW4ieq/Vt3B6u3suGCsmqYkeGyCilmaAZLkEbkpGnbDUJn1Wy2lok?= =?us-ascii?Q?S3Hh3JSMAjpn0rcPKyuQpiWVrlXmxS2M2qtecsOE9ud9PY+ZCEIRjY2Obn47?= =?us-ascii?Q?hCFhSEAdkPiE5HvlmZrQ+xethcYDSSUYbDyenzwBk6or1gk1oQBtC+fhJekH?= =?us-ascii?Q?X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IeYcAWAQ==; 24:cshCD+EXHHt9cXz0LQXbZUwVZ2gXyXKFagrl01v4oqEAOfqf+TfqOVcPbKm4hZHvmMyRVwADQunww33QdOWZ4SJET90zg3z1BbdSphGc0vo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR15MB1321; 7:K/naPpaXH3+VL67MNpNjEOqfXIR4gev9mg6RpyxgMY7ZIV1YjMO6NWFFPD7eGWdW4QVi3f+3wHxGde2Qc2wDmWKgZIdu83yoWqhZKMUXXNiOvepfvDpcluRQm2s1sWlo9173m2wQmXvYAFCpzA4Ffd5D5LB+Rp+7u3tjD4IerNZbr6dZVaZlhbJPfzZm2BpGCo1bX5X65/oM/KeXK4VcmXoVvANimdpAQclH88XW6h1Nhv49gAyERPA7uWboV03xPR6o7fI/fzvci5NYOCO3VTfyXJl2NRj9urmqh276zrgVrjiJ49QhE+/qen5f90nQ0jvowFrAFIjayQHxr/XFqFHfVVvAncz1l4B9b+UAO1I4rLHm39Bu4vIo69DuM5v0jaDR5DNRKfJ0GvET8Oh/fZwAlH/sq8qilyWuIICSjO8jkteUZ18rbbArl9T55Utx18znuecN6kT7isDEYpBHTA==; 20:6+NUF8tvei36+8gTpuTPxVQs1ByKcSaTl7555oVjWSx0JCoRFhr3iq9R5Y/qv1DxVnAiZhVEgavSbiS7nPO583eMNQFrpCw7wAy4N/ZCv2I9szrOzq1GxkCXU0lyRHryeYMO194kuwFJIduM3xw2L3fpgB3R/rrO5NkWIS2iUCY= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Dec 2016 21:19:15.9770 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR15MB1321 X-OriginatorOrg: fb.com X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-12-02_14:, , signatures=0 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 If we have large devices (say like the 40t drive I was trying to test with) we will end up overflowing the int arguments to nbd_set_size and not get the right size for our device. Fix this by using loff_t everywhere so I don't have to think about this again. Thanks, Signed-off-by: Josef Bacik --- drivers/block/nbd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index dc722a7..92f5400 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -64,7 +64,7 @@ struct nbd_device { int num_connections; atomic_t recv_threads; wait_queue_head_t recv_wq; - int blksize; + loff_t blksize; loff_t bytesize; struct task_struct *task_recv; @@ -134,7 +134,7 @@ static void nbd_size_update(struct nbd_device *nbd, struct block_device *bdev) } static int nbd_size_set(struct nbd_device *nbd, struct block_device *bdev, - int blocksize, int nr_blocks) + loff_t blocksize, loff_t nr_blocks) { int ret; @@ -143,7 +143,7 @@ static int nbd_size_set(struct nbd_device *nbd, struct block_device *bdev, return ret; nbd->blksize = blocksize; - nbd->bytesize = (loff_t)blocksize * (loff_t)nr_blocks; + nbd->bytesize = blocksize * nr_blocks; nbd_size_update(nbd, bdev); @@ -930,7 +930,7 @@ static int nbd_dev_dbg_init(struct nbd_device *nbd) debugfs_create_file("tasks", 0444, dir, nbd, &nbd_dbg_tasks_ops); debugfs_create_u64("size_bytes", 0444, dir, &nbd->bytesize); debugfs_create_u32("timeout", 0444, dir, &nbd->tag_set.timeout); - debugfs_create_u32("blocksize", 0444, dir, &nbd->blksize); + debugfs_create_u64("blocksize", 0444, dir, &nbd->blksize); debugfs_create_file("flags", 0444, dir, nbd, &nbd_dbg_flags_ops); return 0;