From patchwork Wed Dec 10 08:05:38 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Tao X-Patchwork-Id: 13142 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id B99D7DDECF for ; Wed, 10 Dec 2008 19:05:45 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753883AbYLJIFp (ORCPT ); Wed, 10 Dec 2008 03:05:45 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754531AbYLJIFo (ORCPT ); Wed, 10 Dec 2008 03:05:44 -0500 Received: from ti-out-0910.google.com ([209.85.142.186]:58206 "EHLO ti-out-0910.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753883AbYLJIFo (ORCPT ); Wed, 10 Dec 2008 03:05:44 -0500 Received: by ti-out-0910.google.com with SMTP id b6so216037tic.23 for ; Wed, 10 Dec 2008 00:05:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:x-enigmail-version:content-type; bh=lYTvkZliO4Mx7uI9AWMEEqVg2cxjrt0d4lU3MOwqQK0=; b=lO1FdjJRwPnIVxiZ5TXxH82bsLcm2vikkmZgk0R8ka7PRXEBrSVaHBpKRs10KxTe7a v4vGvp5TM/Gl2e8EvdLku+CmuPDaDXS/qwCvU6XoFqN4dsK4mqYoDo2ZQFhuZt7HBG0H Iw+4rHCEitlB00yZzA5tRgJ5B0dDkXvGt5sTU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :x-enigmail-version:content-type; b=CVHW76bKfs+IMOcquQuuNhR1G77AIW/1yH184abzKeoM2wwDX7UtRcR1cJ/qErZaFJ TbktmFL1+H3Iz/cFNqYocq/4Row+iIfvn4hHuTZSiqMSAlFz9Rh+ukc8HSNeJCa/Qt7w gSloMyb06LNRcqnxXqOhmsQ2tGPaGqIc98gEM= Received: by 10.110.5.18 with SMTP id 18mr1564062tie.6.1228896343428; Wed, 10 Dec 2008 00:05:43 -0800 (PST) Received: from ?59.64.157.2? ([59.64.157.2]) by mx.google.com with ESMTPS id w5sm2821705tib.14.2008.12.10.00.05.40 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 10 Dec 2008 00:05:41 -0800 (PST) Message-ID: <493F7852.2040201@gmail.com> Date: Wed, 10 Dec 2008 16:05:38 +0800 From: Peng Tao User-Agent: Mozilla-Thunderbird 2.0.0.17 (X11/20081018) MIME-Version: 1.0 To: ext4 development Subject: [PATCH 3/3][e2fsprogs] tune2fs: Don't allow tune2fs -I if flex_bg on X-Enigmail-Version: 0.95.7 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org add force flag to tune2fs -I, because it may cause data corruption when the last inode table block is followed by a in-use data block. If user really want to tune the inode size, they should be warned about this. Signed-off-by: Peng Tao diff --git a/misc/tune2fs.c b/misc/tune2fs.c index 453a529..1227802 100644 --- a/misc/tune2fs.c +++ b/misc/tune2fs.c @@ -107,7 +107,7 @@ static void usage(void) "[-L volume_label]\n" "\t[-M last_mounted_dir] [-O [^]feature[,...]]\n" "\t[-E extended-option[,...]] [-T last_check_time] " - "[-U UUID]\n\t[ -I new_inode_size ] device\n"), program_name); + "[-U UUID]\n\t[ -I new_inode_size ] [-f] device\n"), program_name); exit (1); } @@ -1598,6 +1598,13 @@ retry_open: ext2fs_mark_super_dirty(fs); } if (I_flag) { + if (!f_flag) { + fputs(_("Enlarging inode size may cause data " + "corruption.\nUse with -f at your warranty. " + "Abort.\n"), stderr); + exit(1); + } + if (mount_flags & EXT2_MF_MOUNTED) { fputs(_("The inode size may only be " "changed when the filesystem is "