Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4887117ybv; Wed, 26 Feb 2020 04:48:00 -0800 (PST) X-Google-Smtp-Source: APXvYqy4vnVeixP2KxEu7n2KAfNPU7ilniwS+Hyeh+H8ITfu4a0WBRCzpSJg7leat8z3AZI/H5ZU X-Received: by 2002:aca:5a04:: with SMTP id o4mr2924205oib.71.1582721279830; Wed, 26 Feb 2020 04:47:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582721279; cv=none; d=google.com; s=arc-20160816; b=cTOXPifUfz+DHjGE7PfpLhSeHhOfxnWfF6N5wPaXYjgGJ9PMY6ghFQfpnjO9/fnhpK eZ+7GgMiBNn/bisyVgBbGmnwHl68zDsUfrI/wLlyas2iJUUTT0+Ul7Jj1VKnkkGP98AY twdIC0vy3MKdi9G1h26UpO2RokZ9BID0mmu8k6vFKbGowfbaZr1wtRJtDIMIPCOyWuJm TGMdei8vtIwaEYCksHTJsiP+pJQr4WCSQ+cyYsgFMXOdNUHeda5scomqnRMT75BlB4bS UZChcC95dymbmz1t4H9tlx2poNc501aOhTMsxYGILYx45+Z0cHb/GEW3DEcIgIJe2j+u 4FJg== 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 :content-language:in-reply-to:mime-version:user-agent:date:from :references:cc:to:subject; bh=jp0nm1PwU/afJIuoBNMOHJEn3ln/6s9+fGGuvw7pCng=; b=W8qRrrrOuGYWbj7inxo0BhfhMdxvbgqmDgg9wjMQ/RzXtBGiMpAOS3AaG4SE5ThDwD e+PCSIfeEq2HdL64+MfqYVN6ffqDBF7oX9aSWRBGSoLcnjs11o/a9jl9sBwHFTjxfHl6 LB63A5D96lRcE2mw4BFUtdwobuNDaezol4TmHT1v5A2SF519ecr4iLBmxWyKeJCdW9t/ r+T0jPl/vPqM2uobLsRFRC3kLy0V8FnXP8lg9BPr3ghFcOuvVPwy58f7oRN2N/8/6Rrv Brj5Flvsd8c0b8SHU+r2MgvQaMgt1sBh+5586S3xCm+XbHI07axgdYU0s31oIGNUh4rE HojA== 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 d8si1245244otp.295.2020.02.26.04.47.47; Wed, 26 Feb 2020 04:47: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 S1726536AbgBZMrb (ORCPT + 99 others); Wed, 26 Feb 2020 07:47:31 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:59980 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726272AbgBZMrb (ORCPT ); Wed, 26 Feb 2020 07:47:31 -0500 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 01QCi2Wo054792 for ; Wed, 26 Feb 2020 07:47:29 -0500 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ydqfuk9mx-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 26 Feb 2020 07:47:29 -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 12:47:27 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) 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 12:47:24 -0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 01QClOpU65798308 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Feb 2020 12:47:24 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E9BC952051; Wed, 26 Feb 2020 12:47:23 +0000 (GMT) Received: from localhost.localdomain (unknown [9.199.58.45]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 278C852050; Wed, 26 Feb 2020 12:47:21 +0000 (GMT) Subject: Re: [PATCHv3 4/6] ext4: Make ext4_ind_map_blocks work with fiemap To: Jan Kara Cc: tytso@mit.edu, linux-ext4@vger.kernel.org, adilger.kernel@dilger.ca, linux-fsdevel@vger.kernel.org, darrick.wong@oracle.com, hch@infradead.org, cmaiolino@redhat.com References: <56fc8d3802c578d27d49270600946a0737cef119.1582702694.git.riteshh@linux.ibm.com> <20200226123940.GP10728@quack2.suse.cz> From: Ritesh Harjani Date: Wed, 26 Feb 2020 18:17:21 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20200226123940.GP10728@quack2.suse.cz> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 20022612-0020-0000-0000-000003ADC29D X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20022612-0021-0000-0000-00002205DD71 Message-Id: <20200226124722.278C852050@d06av21.portsmouth.uk.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-02-26_04:2020-02-26,2020-02-26 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 clxscore=1015 malwarescore=0 suspectscore=0 priorityscore=1501 phishscore=0 adultscore=0 bulkscore=0 impostorscore=0 lowpriorityscore=0 mlxlogscore=907 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002260095 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On 2/26/20 6:09 PM, Jan Kara wrote: > On Wed 26-02-20 15:27:06, Ritesh Harjani wrote: >> 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 > > Hmm, won't it be cleaner to just handle this in ext4_iomap_begin_report()? > We do trim map.m_len there anyway so it is only logical to trim it to > proper value supported by the inode on-disk format... BTW, note we have > sbi->s_bitmap_maxbytes value already computed in the superblock... hmm. Yes, thanks for the pointers. Let me check this again. -ritesh > > Honza > >> --- >> 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 >>