Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp729420ybx; Thu, 7 Nov 2019 01:45:27 -0800 (PST) X-Google-Smtp-Source: APXvYqwhfsh+lfPibaixJnXD1R7le8Wrz+q/wp/tdPg1sRnaPpmnE3wc4r3o8aP4lq/KmS2uZq4q X-Received: by 2002:a17:906:85da:: with SMTP id i26mr2114029ejy.186.1573119927109; Thu, 07 Nov 2019 01:45:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1573119927; cv=pass; d=google.com; s=arc-20160816; b=W3b+bwFV158G2cx1Jjh7fzodj8N+KJuEie8whpX3OyuHaaEQxOm02+81GOEpQ3UH2E G2SflwnPsR/MUmkb+LGECVQ5b1QydfxfAgcrSeACdWfg2OJRYR/v6ofj1clalxkv4wld 6xVpWdSKfA/AFElRJKQrJNy+SPw6YWeT+t4Fh/9XdNTY8aj5oLWecOy5JDeQdm91iIFH A7tWMG/WwvaE9eCHypTHlOFMF/tKUqaWvAlzXvskrg7ElNfWTo7SyUYtndT7E8oACZbq AnycTnbDz/VfSphuDYEysTmnBSLesxOssiUW9BC1/M0PH9JzGtm7j16lxEowoGTTVW78 L3Ng== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-transfer-encoding :mime-version:subject:references:in-reply-to:message-id:cc:to :reply-to:from:date:dkim-signature; bh=pqYHCzjtbdk0Vsetr9tkPwToVHLSqWDh9kTs/tHPJR8=; b=tJPRclzR8tT4+UtEhCnPYo0WpXS5no2vq2TJFLRVwp1SP8InwYG5RFarDM1T5CDSYr Sgi/2dP9sLQJ54txSJVPAzPZxzy6Sk0+25rYGoQZIz1juAFAYFekuvJKOysmQanszOyy YjTSquVUuYOnKfvm5v/HPL+J8rlFDVU62kR1JOVS4QxWZtZ9373AeqkDjk+Oj0/6h7iD ILnskRcQYA3+TRYOc9L/qrxQSpkDGPFTLJDXXhKt4gpMRRMMD5+9AabXKGd14wjHWmu+ mJb4kHnb2H0qGhQyCi23HDqEeIBV9yu/uFXQwC94BDSedK/z44kyg7AIbjBhLl3sLza9 JyOA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mykernel.net header.s=zohomail header.b=Q0euPC4j; arc=pass (i=1 spf=pass spfdomain=mykernel.net dkim=pass dkdomain=mykernel.net dmarc=pass fromdomain=mykernel.net>); 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 gu7si1055661ejb.405.2019.11.07.01.44.57; Thu, 07 Nov 2019 01:45:27 -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; dkim=pass header.i=@mykernel.net header.s=zohomail header.b=Q0euPC4j; arc=pass (i=1 spf=pass spfdomain=mykernel.net dkim=pass dkdomain=mykernel.net dmarc=pass fromdomain=mykernel.net>); 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 S1727415AbfKGJoy (ORCPT + 99 others); Thu, 7 Nov 2019 04:44:54 -0500 Received: from sender2-pp-o92.zoho.com.cn ([163.53.93.251]:25339 "EHLO sender3-pp-o92.zoho.com.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726866AbfKGJoy (ORCPT ); Thu, 7 Nov 2019 04:44:54 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1573119865; cv=none; d=zoho.com.cn; s=zohoarc; b=SU3RDOaUnLCn1QGmgxhYMtOZHui9oOTqEGZFwcWr6lEwHhNArWGDfzimwthxZJnHEUADwLJONor8kC76CRAmtsj0laxIJtremQPniog+B4NtFEtccLF0X6mWLSl3OV6ortq25wXx3fdORq0t2LsHkVjzWj9uTdM3nt2wxo2MnUA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com.cn; s=zohoarc; t=1573119865; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:Reply-To:References:Subject:To; bh=pqYHCzjtbdk0Vsetr9tkPwToVHLSqWDh9kTs/tHPJR8=; b=dwK5dQV8ZN1jh0dpPFUfuR0qegGRMo+8cUyq61Jzt5/9QGDJHwnBsxxnIpqr7PYSMpVToq/F1SGf54VQWO7MnRj+LuTuQi47qyV/oCvey3FAnJw0GEp2xQ+oCcNeqjz/dKPkHgMNBRx8p7KqXE9vXrDWnuzpXvZOwObwbIwisQM= ARC-Authentication-Results: i=1; mx.zoho.com.cn; dkim=pass header.i=mykernel.net; spf=pass smtp.mailfrom=cgxu519@mykernel.net; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1573119865; s=zohomail; d=mykernel.net; i=cgxu519@mykernel.net; h=Date:From:Reply-To:To:Cc:Message-ID:In-Reply-To:References:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding; l=1609; bh=pqYHCzjtbdk0Vsetr9tkPwToVHLSqWDh9kTs/tHPJR8=; b=Q0euPC4jEtWv/UBjsEG7GStGlvYZP8+CkUdSDCGd5dqwZYkALpeRVB/hJ0x25DlZ a4sfCcDdZWRKeer4iREAGZ8eZOQA2TeDCgflkH654V2Ak79xxCcm7V7gbOR0Z7o+t7z u4k+RJH4Ze6QvgQi6ll2EtO9dtqcA0IJslFQlPKs= Received: from mail.baihui.com by mx.zoho.com.cn with SMTP id 1573119863323397.8144115962217; Thu, 7 Nov 2019 17:44:23 +0800 (CST) Date: Thu, 07 Nov 2019 17:44:23 +0800 From: Chengguang Xu Reply-To: cgxu519@mykernel.net To: "Jan Kara" Cc: "jack" , "linux-ext4" Message-ID: <16e45402a18.c7fb3dc01505.2507377017571315195@mykernel.net> In-Reply-To: <20191107092117.GA11400@quack2.suse.cz> References: <20191104114036.9893-1-cgxu519@mykernel.net> <20191104114036.9893-2-cgxu519@mykernel.net> <20191106154236.GB12685@quack2.suse.cz> <16e43c91b4e.12c0f5d17918.413402503051848643@mykernel.net> <20191107092117.GA11400@quack2.suse.cz> Subject: Re: [PATCH 2/5] ext2: code cleanup by calling ext2_group_last_block_no() MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Priority: Medium User-Agent: ZohoCN Mail X-Mailer: ZohoCN Mail Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org ---- =E5=9C=A8 =E6=98=9F=E6=9C=9F=E5=9B=9B, 2019-11-07 17:21:17 Jan Kara <= jack@suse.cz> =E6=92=B0=E5=86=99 ---- > On Thu 07-11-19 10:54:43, Chengguang Xu wrote: > > ---- =E5=9C=A8 =E6=98=9F=E6=9C=9F=E4=B8=89, 2019-11-06 23:42:36 Jan K= ara =E6=92=B0=E5=86=99 ---- > > > On Mon 04-11-19 19:40:33, Chengguang Xu wrote: > > > > Call common helper ext2_group_last_block_no() to > > > > calculate group last block number. > > > >=20 > > > > Signed-off-by: Chengguang Xu > > >=20 > > > Thanks for the patch! I've applied it (as well as 1/5) and added at= tached > > > simplification on top. > > >=20 > >=20 > > In ext2_try_to_allocate() > >=20 > > + if (my_rsv->_rsv_end < group_last_block) > > + end =3D my_rsv->_rsv_end - group_first_block + 1; > > + if (grp_goal < start || grp_goal > end) > >=20 > > Based on original code, shouldn't it be if (grp_goal < start || grp_g= oal > > >=3Dend) ? >=20 > Hum, that's a good point. The original code actually had an off-by-one b= ug > because 'end' is really the last block that can be used so grp_goal =3D= =3D end > still makes sense. And my cleanup fixed it. Now looking at the code in > ext2_try_to_allocate() we also have a similar bug in the loop allocating > blocks. There we can also go upto 'end' inclusive. Added a patch to fix > that. Thanks for pointing me to this! >=20 Doesn't it depend on what starting number for grp_block inside block group? if it starts from 0, is the end number block still available for allocation= ? Thanks, Chengguang