Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4719499ybv; Wed, 26 Feb 2020 01:57:59 -0800 (PST) X-Google-Smtp-Source: APXvYqyjZ/RxGqQgykcr9PMrQQgVG0rPGKWbSVACZrXO15cRvH6odOJVSQzru4IYwbVkiqTEa7KM X-Received: by 2002:a9d:7590:: with SMTP id s16mr2166357otk.89.1582711079565; Wed, 26 Feb 2020 01:57:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582711079; cv=none; d=google.com; s=arc-20160816; b=vWgHAn3QBXDQNmpxILBwxdhvxZVjcLwbFv2ENh71uep6JSIQfb71KDdJ8RKfwDYFzz xajCazKDxLEDP1XFwnP5j4cZQAm21+wKO8+/UOVYg0VwSy2sxdJVUMQgtgHBlW0UgzK7 29uLirkel9Z4ssuhVq2oDv/M00t82bbl4O+ZjJ/nSAG+yE6x7RI3EpLmyPy89W8W0Gko XJzg5s6gxEaXunnySv6yIdWvV8HNSA7EgkujVwcQjpcJe+JYlp6Hs8y16i/BH+GNV21Q kOyRIViUJg+8wrlsK3d6PL0mkkfpA7rtWPRn/68sNGF7/UUbvoSlxI/cbXk5noCJjrGG bJSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:references:in-reply-to:date:subject:cc:to:from; bh=qcWdjZzYwqsTgu/oicRIidJq+5yzQmRTWuC5ELFmR6c=; b=UiMEQ3f4270c2Voj81cbw3fXuFE47fnkZLTQA5D5mjqEZ0s4klglRuP7mI4rkrPR0N NMqAm8/UWGuSNCS+MzivgWjB/q7jp8FIRaNtHsmqM9W4R0iiOGP7I2AJr0N6RsVc5Hs0 YHQmnL1JDjOiSJtGu4fhhl9VrUV69dKdEyiGpOxaEnN1TTkBlv8i5L/C6FoQNAOFXvVH UpFmJyjAwQq0kjfw9XuzHgCW0aKy3Bjqj7nFmyXPkX3ZEy1BrG3Fja56c82kQ1HrYa+d 5oKma/MsGD7qXLF+KsMB+ETFk6LWk3l89rJq++dDIvw0AZE2g+py+qlBaoBmy/HDbvdW AyTQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b8si956876otf.32.2020.02.26.01.57.49; Wed, 26 Feb 2020 01:57:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-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-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727913AbgBZJ5i (ORCPT + 99 others); Wed, 26 Feb 2020 04:57:38 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:50916 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727883AbgBZJ5i (ORCPT ); Wed, 26 Feb 2020 04:57:38 -0500 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 01Q9nlUO063494 for ; Wed, 26 Feb 2020 04:57:37 -0500 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ydcp4gd0q-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 26 Feb 2020 04:57:37 -0500 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 26 Feb 2020 09:57:34 -0000 Received: from b06avi18626390.portsmouth.uk.ibm.com (9.149.26.192) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 26 Feb 2020 09:57:31 -0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 01Q9uXfw47645044 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Feb 2020 09:56:33 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2D9044203F; Wed, 26 Feb 2020 09:57:30 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C0EAB4204F; Wed, 26 Feb 2020 09:57:27 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.199.47.18]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 26 Feb 2020 09:57:27 +0000 (GMT) From: Ritesh Harjani To: jack@suse.cz, tytso@mit.edu, linux-ext4@vger.kernel.org Cc: adilger.kernel@dilger.ca, linux-fsdevel@vger.kernel.org, darrick.wong@oracle.com, hch@infradead.org, cmaiolino@redhat.com, Ritesh Harjani Subject: [PATCHv3 4/6] ext4: Make ext4_ind_map_blocks work with fiemap Date: Wed, 26 Feb 2020 15:27:06 +0530 X-Mailer: git-send-email 2.21.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 20022609-0020-0000-0000-000003ADB3C6 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20022609-0021-0000-0000-00002205CDED Message-Id: <56fc8d3802c578d27d49270600946a0737cef119.1582702694.git.riteshh@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-02-26_02:2020-02-25,2020-02-26 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 clxscore=1015 adultscore=0 bulkscore=0 mlxscore=0 phishscore=0 impostorscore=0 lowpriorityscore=0 suspectscore=0 mlxlogscore=919 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002260074 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org For indirect block mapping if the i_block > max supported block in inode then ext4_ind_map_blocks may return a -EIO error. But in case of fiemap this could be a valid query to ext4_map_blocks. So in case if !create then return 0. This also makes ext4_warning to ext4_debug in ext4_block_to_path() for the same reason. Signed-off-by: Ritesh Harjani --- fs/ext4/indirect.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c index 3a4ab70fe9e0..e1ab495dd900 100644 --- a/fs/ext4/indirect.c +++ b/fs/ext4/indirect.c @@ -102,7 +102,11 @@ static int ext4_block_to_path(struct inode *inode, offsets[n++] = i_block & (ptrs - 1); final = ptrs; } else { - ext4_warning(inode->i_sb, "block %lu > max in inode %lu", + /* + * It's not yet an error to just query beyond max + * block in inode. Fiemap callers may do so. + */ + ext4_debug("block %lu > max in inode %lu", i_block + direct_blocks + indirect_blocks + double_blocks, inode->i_ino); } @@ -537,8 +541,11 @@ int ext4_ind_map_blocks(handle_t *handle, struct inode *inode, depth = ext4_block_to_path(inode, map->m_lblk, offsets, &blocks_to_boundary); - if (depth == 0) + if (depth == 0) { + if (!(flags & EXT4_GET_BLOCKS_CREATE)) + err = 0; goto out; + } partial = ext4_get_branch(inode, depth, offsets, chain, &err); -- 2.21.0