Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp7960659imm; Thu, 28 Jun 2018 12:06:11 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIrZz7u0/d6M1hWbGEox1Qz33mzcLSz0eUmi1RTts2pbwwGTdW8VFitGhpJfXvjtwjKgNUd X-Received: by 2002:a65:4ecd:: with SMTP id w13-v6mr9946907pgq.214.1530212771056; Thu, 28 Jun 2018 12:06:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530212771; cv=none; d=google.com; s=arc-20160816; b=ib+eGqxk4BRaBTkPTt2ObWJSZ1sJ04K/N7IdfmmNf7KK2HShdVYQrvSqI4WTSA02Fi q7xCL7jDmTNq6zY0WdHmbVrAJ3M3MNa20Thsm9deLObKbjdFZadrPxL0DZ+Njnp1GhyL qW5pGfJObe6iinZPKmikP+c9K9/Zt5qr0fblMgU6TCjuQfGwRAV1xHpX9OSXXaRX8Uhp BuZYHjam4h8/0XHNiK56cNUu9eKD8I4X2VLamG0rIXYHWnCnzQZfqxLPKWCeE3uBhcHg m7aFwCMx0+4d3yvu6unBGcVUZQk9aGuthm0Nv0DGEtxOKKRPARPdbA04UeiIalRtnqbl IFXg== 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:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=vz6JhvmmsHmYqdou6n8cS8VcCVHWEosn48QWhb3Gti0=; b=jyyc9JnNG/MkhsRkxxnXIrLsXymMTWNdk+BYO2be5DhShfSrJMMFx1Gb3bZqawRg79 G6jEubLPPhwlxO2F52AjBHud/WUBPXlC66y9nHM/hdaeF+70n/S7OjkS+WBrmyKUmBr0 jEBX3YaQKIaCD4aYsS4nGKkQjUMTX026XbNv8hgp0dLIOtve79RHfp4gF/YfYniEHBj0 deNo3gk773DRSFSzXnD9Jtxt7kivbSkYKy6ap3IbmMxSblbHfWqFle8MRvkIZuXqa/P8 3sYVdzL9xImYxun71P42isb8WYCbpdFlQnvRopu100u4ot2LQ38jagQ91m9q0gBKWj7W dUSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@thunk.org header.s=ef5046eb header.b=PRdR8kT7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 62-v6si5366110pfg.224.2018.06.28.12.05.56; Thu, 28 Jun 2018 12:06:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@thunk.org header.s=ef5046eb header.b=PRdR8kT7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934221AbeF1Pa1 (ORCPT + 99 others); Thu, 28 Jun 2018 11:30:27 -0400 Received: from imap.thunk.org ([74.207.234.97]:36892 "EHLO imap.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933604AbeF1PaZ (ORCPT ); Thu, 28 Jun 2018 11:30:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=thunk.org; s=ef5046eb; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=vz6JhvmmsHmYqdou6n8cS8VcCVHWEosn48QWhb3Gti0=; b=PRdR8kT72yOLnxb329XanasAVM gmNwPW3Te6Y5GXewVxFitAw+tsQnAzZBDrOkhnNQ1rRvHof2wQyeHFMuoBwtvIyvkFeG5ClO/dwKv cwQHIs2IMeaan9oMZdCGAlhO1r59TwEzvTH/bmVAGxPc1baYhZZWCbn6zyqmMq1rZkbw=; Received: from root (helo=callcc.thunk.org) by imap.thunk.org with local-esmtp (Exim 4.89) (envelope-from ) id 1fYYsJ-0008Lo-5h; Thu, 28 Jun 2018 15:30:23 +0000 Received: by callcc.thunk.org (Postfix, from userid 15806) id 7C5067A4480; Thu, 28 Jun 2018 11:30:22 -0400 (EDT) Date: Thu, 28 Jun 2018 11:30:22 -0400 From: "Theodore Y. Ts'o" To: "Gaoming (ming, consumer BG)" Cc: "linux-ext4@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Liqingchao (sorp)" , "Shenchen (harry)" , "miaoxie (A)" , "yangfei (D)" , "Renlipeng (OS driver)" Subject: Re: =?utf-8?B?562U5aSNOiDnrZTlpI06IFtQQVRD?= =?utf-8?Q?H=5D_ext4=3A_e2fsprogs=3A_fix_inode_bitma?= =?utf-8?Q?p?= num not integer,incompatible for ancient android devices Message-ID: <20180628153022.GA8521@thunk.org> Mail-Followup-To: "Theodore Y. Ts'o" , "Gaoming (ming, consumer BG)" , "linux-ext4@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Liqingchao (sorp)" , "Shenchen (harry)" , "miaoxie (A)" , "yangfei (D)" , "Renlipeng (OS driver)" References: <1530014046-62466-1-git-send-email-gaoming20@huawei.com> <20180627140937.GA3348@thunk.org> <20180628022900.GA663@thunk.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.0 (2018-05-17) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: tytso@thunk.org X-SA-Exim-Scanned: No (on imap.thunk.org); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 28, 2018 at 07:56:59AM +0000, Gaoming (ming, consumer BG) wrote: > You see, Inodes per group is 1708,which is illegal as you said. > > So, the problem exists a long time until Jun 21th 2018. > > You complained the problem in 2011, they do not fix it till 2018. > Just as > I complained, fix it, and you do not accept it. ^_^ Here's the commit. (Note the date.) Do you see it in your repository? Or are you using an unusual inode size? (e.g., not 256 bytes, or 16 inodes per block). - Ted commit 06c35f935a7adadceb9ee326b3231f952f6ad203 Merge: 480a3b1 96cc54a Author: Colin Cross Date: Sat Apr 30 19:08:09 2011 -0700 Merge "Make inodes per group a multiple of inodes per block" diff --cc ext4_utils/make_ext4fs.c index c9fd992,e37d617..22c9424 --- a/ext4_utils/make_ext4fs.c +++ b/ext4_utils/make_ext4fs.c @@@ -214,26 -215,10 +214,27 @@@ static u32 compute_inodes_per_group( { u32 blocks = DIV_ROUND_UP(info.len, info.block_size); u32 block_groups = DIV_ROUND_UP(blocks, info.blocks_per_group); - return DIV_ROUND_UP(info.inodes, block_groups); + u32 inodes = DIV_ROUND_UP(info.inodes, block_groups); + return ALIGN(inodes, (info.block_size / info.inode_size)); } +static u32 compute_bg_desc_reserve_blocks() +{ + u32 blocks = DIV_ROUND_UP(info.len, info.block_size); + u32 block_groups = DIV_ROUND_UP(blocks, info.blocks_per_group); + u32 bg_desc_blocks = DIV_ROUND_UP(block_groups * sizeof(struct ext2_group_desc), + info.block_size); + + u32 bg_desc_reserve_blocks = + DIV_ROUND_UP(block_groups * 1024 * sizeof(struct ext2_group_desc), + info.block_size) - bg_desc_blocks; + + if (bg_desc_reserve_blocks > info.block_size / sizeof(u32)) + bg_desc_reserve_blocks = info.block_size / sizeof(u32); + + return bg_desc_reserve_blocks; +} + void reset_ext4fs_info() { // Reset all the global data structures used by make_ext4fs so it // can be called again.