Received: by 2002:a17:90a:37e8:0:0:0:0 with SMTP id v95csp4240472pjb; Mon, 21 Oct 2019 02:18:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqxwmY+h31f8xAXbwIGaGTM0GpT9eUG7phqnGkC+d115DhjT6owIjg0ojraF0kFr5JybsvLa X-Received: by 2002:a17:906:a459:: with SMTP id cb25mr20648937ejb.63.1571649509601; Mon, 21 Oct 2019 02:18:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571649509; cv=none; d=google.com; s=arc-20160816; b=Ut5hnEvhlB5yOF0IYStUNm6jMJKDTVqh8rgHGq2G2IcwlZGov5zlpUYbF9NU1fQeiH iCxxhpKHg3wlPVEpV7te8LVWskvka+Td8S68YYFRpN1d69wKVAmH1YWdXKFeORYPEWyy Wb3DK7ZyOi51XG6py+m9il1kmkIOihFwWDRR54ztBHQSXosknAlZb7f/42zdixnaTpid jh2Afmb5YDkBX4VZxGWsiC5hv/Fcj/vo5aU6+n8821FTQ7+IMexu9wIQPopOcn71Y45d ey63J8s70laNDyzEDlCizOA4AQdxXrZ3nNNHM27qd2BbNH5RuLW457XmWAXuImKxpSbg OTRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=9QWaIFLPWtPrQQzBJ0zecD9V3IYmQuOgeDk2HUWpnCw=; b=bD2C2lODFerR5ztNjDM/zJxSCs1aMBnxjHiJxs5/mmhMn+82AwrxnSordw/G1gNH3A XMAzByddWt7Im4tM6TEXfzihrQuQ7SUt4ho0xYafHtFvNSsuxjCcRujtn0G3BJWjz1Zo DXBLCRZE1zkHUM9cdZIsFeq2gInALhj4YxP6K9AThcQjInWRsWJ2/O9rBRA+QrS5QFBO ccE6hz12GALdMtxLZ/k0i2/lS7Y6jxZmTussJsyD/r4kg+D2nHMvOiMTquPBAD82yHWG oX8cGTDmQzH5ynEpnPRwzAu/c0GhfQdpcYArP97R/V3SDi+k+aq8SnEyoELnb1EKL1LM /Tbw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 11si3501641edv.422.2019.10.21.02.18.05; Mon, 21 Oct 2019 02:18:29 -0700 (PDT) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726955AbfJUJSC (ORCPT + 99 others); Mon, 21 Oct 2019 05:18:02 -0400 Received: from mx2.suse.de ([195.135.220.15]:48712 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726725AbfJUJSC (ORCPT ); Mon, 21 Oct 2019 05:18:02 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 201F1B732; Mon, 21 Oct 2019 09:18:01 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 676431E4AA0; Mon, 21 Oct 2019 11:18:00 +0200 (CEST) Date: Mon, 21 Oct 2019 11:18:00 +0200 From: Jan Kara To: Chengguang Xu Cc: jack@suse.com, linux-ext4@vger.kernel.org Subject: Re: [PATCH] ext2: adjust block num when retry allocation Message-ID: <20191021091800.GC17810@quack2.suse.cz> References: <20191020232326.84881-1-cgxu519@mykernel.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191020232326.84881-1-cgxu519@mykernel.net> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Mon 21-10-19 07:23:26, Chengguang Xu wrote: > Set block num to original *count in a case > of retrying allocation in case num < *count > > Signed-off-by: Chengguang Xu > --- > Hi Jan, > > This patch is only compile-tested, I'm not sure if this > kind of unexpected condition which causes reallocation > will actually happen but baesd on the code the fix seems > correct and better. Yeah, you are right that we should reset 'num' back to *count. Although the practial effect of this is minimal - we take this code path only when the filesystem is corrupted. But still... Patch applied. Thanks! Honza > > fs/ext2/balloc.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c > index e0cc55164505..924c1c765306 100644 > --- a/fs/ext2/balloc.c > +++ b/fs/ext2/balloc.c > @@ -1404,6 +1404,7 @@ ext2_fsblk_t ext2_new_blocks(struct inode *inode, ext2_fsblk_t goal, > * use. So we may want to selectively mark some of the blocks > * as free > */ > + num = *count; > goto retry_alloc; > } > > -- > 2.21.0 > > > -- Jan Kara SUSE Labs, CR