From patchwork Sun Oct 4 18:04:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 11815795 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1E5F51580 for ; Sun, 4 Oct 2020 18:07:44 +0000 (UTC) Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E0A7B206B6 for ; Sun, 4 Oct 2020 18:07:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E0A7B206B6 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=ocfs2-devel-bounces@oss.oracle.com Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 094I4ggb081665; Sun, 4 Oct 2020 18:07:37 GMT Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2120.oracle.com with ESMTP id 33xh8kjtya-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 04 Oct 2020 18:07:37 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 094I02SM076463; Sun, 4 Oct 2020 18:05:36 GMT Received: from oss.oracle.com (oss-old-reserved.oracle.com [137.254.22.2]) by userp3030.oracle.com with ESMTP id 33y37u7vt7-1 (version=TLSv1 cipher=AES256-SHA bits=256 verify=NO); Sun, 04 Oct 2020 18:05:36 +0000 Received: from localhost ([127.0.0.1] helo=lb-oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1kP8O7-0000WQ-MR; Sun, 04 Oct 2020 11:05:35 -0700 Received: from aserp3020.oracle.com ([141.146.126.70]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1kP8NV-0000Th-B6 for ocfs2-devel@oss.oracle.com; Sun, 04 Oct 2020 11:04:57 -0700 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 094I4eAk156109 for ; Sun, 4 Oct 2020 18:04:57 GMT Received: from userp2030.oracle.com (userp2030.oracle.com [156.151.31.89]) by aserp3020.oracle.com with ESMTP id 33y36vq8n9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 04 Oct 2020 18:04:57 +0000 Received: from pps.filterd (userp2030.oracle.com [127.0.0.1]) by userp2030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 094I4QbU016960 for ; Sun, 4 Oct 2020 18:04:56 GMT Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by userp2030.oracle.com with ESMTP id 33xfbg7bxx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Sun, 04 Oct 2020 18:04:54 +0000 Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kP8N6-0003mo-1t; Sun, 04 Oct 2020 18:04:32 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Date: Sun, 4 Oct 2020 19:04:26 +0100 Message-Id: <20201004180428.14494-6-willy@infradead.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20201004180428.14494-1-willy@infradead.org> References: <20201004180428.14494-1-willy@infradead.org> MIME-Version: 1.0 X-PDR: PASS X-Source-IP: 90.155.50.34 X-ServerName: casper.infradead.org X-Proofpoint-SPF-Result: None X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9764 signatures=668680 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 spamscore=0 mlxscore=0 clxscore=322 impostorscore=0 lowpriorityscore=0 priorityscore=132 adultscore=0 bulkscore=0 malwarescore=0 suspectscore=3 phishscore=0 mlxlogscore=461 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010040140 X-Spam: Clean Cc: lucho@ionkov.net, stable@vger.kernel.org, clm@fb.com, ericvh@gmail.com, linux-btrfs@vger.kernel.org, jlayton@kernel.org, linux-kernel@vger.kernel.org, josef@toxicpanda.com, viro@zeniv.linux.org.uk, dsterba@suse.com, v9fs-developer@lists.sourceforge.net, idryomov@gmail.com, ceph-devel@vger.kernel.org, ocfs2-devel@oss.oracle.com Subject: [Ocfs2-devel] [PATCH 5/7] btrfs: Promote to unsigned long long before shifting X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9764 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 malwarescore=0 suspectscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010040139 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9764 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 clxscore=1034 phishscore=0 malwarescore=0 spamscore=0 bulkscore=0 lowpriorityscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010040140 On 32-bit systems, this shift will overflow for files larger than 4GB. Cc: stable@vger.kernel.org Fixes: df480633b891 ("btrfs: extent-tree: Switch to new delalloc space reserve and release") Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Josef Bacik --- fs/btrfs/ioctl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index ac45f022b495..4d3b7e4ae53a 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -1277,7 +1277,7 @@ static int cluster_pages_for_defrag(struct inode *inode, page_cnt = min_t(u64, (u64)num_pages, (u64)file_end - start_index + 1); ret = btrfs_delalloc_reserve_space(BTRFS_I(inode), &data_reserved, - start_index << PAGE_SHIFT, + (loff_t)start_index << PAGE_SHIFT, page_cnt << PAGE_SHIFT); if (ret) return ret; @@ -1367,7 +1367,7 @@ static int cluster_pages_for_defrag(struct inode *inode, btrfs_mod_outstanding_extents(BTRFS_I(inode), 1); spin_unlock(&BTRFS_I(inode)->lock); btrfs_delalloc_release_space(BTRFS_I(inode), data_reserved, - start_index << PAGE_SHIFT, + (loff_t)start_index << PAGE_SHIFT, (page_cnt - i_done) << PAGE_SHIFT, true); } @@ -1395,7 +1395,7 @@ static int cluster_pages_for_defrag(struct inode *inode, put_page(pages[i]); } btrfs_delalloc_release_space(BTRFS_I(inode), data_reserved, - start_index << PAGE_SHIFT, + (loff_t)start_index << PAGE_SHIFT, page_cnt << PAGE_SHIFT, true); btrfs_delalloc_release_extents(BTRFS_I(inode), page_cnt << PAGE_SHIFT); extent_changeset_free(data_reserved);