From patchwork Fri Dec 6 09:58:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zheng Liu X-Patchwork-Id: 297683 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.180.67]) by ozlabs.org (Postfix) with ESMTP id 34A212C00A0 for ; Fri, 6 Dec 2013 20:56:41 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757695Ab3LFJ41 (ORCPT ); Fri, 6 Dec 2013 04:56:27 -0500 Received: from mail-pd0-f180.google.com ([209.85.192.180]:54454 "EHLO mail-pd0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757667Ab3LFJ4T (ORCPT ); Fri, 6 Dec 2013 04:56:19 -0500 Received: by mail-pd0-f180.google.com with SMTP id q10so747210pdj.25 for ; Fri, 06 Dec 2013 01:56:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=aHwXT+sVxOjtGmN0Kx3xyuP+2dyxP3MiB4cGsdQnNgA=; b=yWb+FvJ033QqkwBD14YAvrJSvjnPv9CbcGgPhRQctCYxtF1WrHlgX/eg+MAoBvBDD4 U1yeINOQTRLMzegTB0QN+auVx3QPlDSeDgpQSAdkec0GMYzAsIAHmKV9xC9HmuE/6DI7 3pLRGuROnZTn1dGRk7Ehr/i69fCIXnKJGLuD5P4L3okjDrUnvlB2TJqQTRQGKVDMaXBH GPO2Ntdbf9gQn8mZOBnuAOoizzxDmtW6uug0s6rRyNhBuFeA4qpmIeiOSI36mlAU6Agr ti6EHNnupiIWsOAuDyJQ9dHI/EKjWzLQAmRjfTXqRfd/fhvi5d9LQJLmWcPNWm0t4h7+ /8PA== X-Received: by 10.68.125.198 with SMTP id ms6mr3127703pbb.98.1386323778861; Fri, 06 Dec 2013 01:56:18 -0800 (PST) Received: from alpha.taobao.ali.com ([182.92.247.2]) by mx.google.com with ESMTPSA id m2sm56582620pbn.19.2013.12.06.01.56.16 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 06 Dec 2013 01:56:18 -0800 (PST) From: Zheng Liu To: linux-ext4@vger.kernel.org Cc: Theodore Ts'o , "Darrick J. Wong" , Zheng Liu Subject: [PATCH v3 23/30] e2fsck: add problem descriptions and check inline data feature Date: Fri, 6 Dec 2013 17:58:10 +0800 Message-Id: <1386323897-2354-24-git-send-email-wenqing.lz@taobao.com> X-Mailer: git-send-email 1.7.9.7 In-Reply-To: <1386323897-2354-1-git-send-email-wenqing.lz@taobao.com> References: <1386323897-2354-1-git-send-email-wenqing.lz@taobao.com> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Zheng Liu Signed-off-by: Theodore Ts'o Signed-off-by: Zheng Liu --- e2fsck/pass1.c | 22 +++++++++++++++++++++- e2fsck/problem.c | 9 +++++++++ e2fsck/problem.h | 7 +++++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c index ab23e42..56411f1 100644 --- a/e2fsck/pass1.c +++ b/e2fsck/pass1.c @@ -592,7 +592,7 @@ void e2fsck_pass1(e2fsck_t ctx) struct ext2_super_block *sb = ctx->fs->super; const char *old_op; unsigned int save_type; - int imagic_fs, extent_fs; + int imagic_fs, extent_fs, inlinedata_fs; int busted_fs_time = 0; int inode_size; int failed_csum = 0; @@ -626,6 +626,8 @@ void e2fsck_pass1(e2fsck_t ctx) imagic_fs = (sb->s_feature_compat & EXT2_FEATURE_COMPAT_IMAGIC_INODES); extent_fs = (sb->s_feature_incompat & EXT3_FEATURE_INCOMPAT_EXTENTS); + inlinedata_fs = (sb->s_feature_incompat & + EXT4_FEATURE_INCOMPAT_INLINE_DATA); /* * Allocate bitmaps structures @@ -808,6 +810,24 @@ void e2fsck_pass1(e2fsck_t ctx) } } + /* Test for incorrect inline_data flags settings. */ + if ((inode->i_flags & EXT4_INLINE_DATA_FL) && !inlinedata_fs && + (ino >= EXT2_FIRST_INODE(fs->super))) { + size_t size = 0; + + pctx.errcode = ext2fs_inline_data_size(fs, ino, &size); + if (!pctx.errcode && size && + !fix_problem(ctx, PR_1_INLINE_DATA_FEATURE, &pctx)) { + sb->s_feature_incompat |= + EXT4_FEATURE_INCOMPAT_INLINE_DATA; + ext2fs_mark_super_dirty(fs); + inlinedata_fs = 1; + } else if (!fix_problem(ctx, PR_1_INLINE_DATA_SET, &pctx)) { + e2fsck_clear_inode(ctx, ino, inode, 0, "pass1"); + continue; + } + } + /* * Test for incorrect extent flag settings. * diff --git a/e2fsck/problem.c b/e2fsck/problem.c index 897693a..a4f7749 100644 --- a/e2fsck/problem.c +++ b/e2fsck/problem.c @@ -1018,6 +1018,15 @@ static struct e2fsck_problem problem_table[] = { N_("@i %i, end of extent exceeds allowed value\n\t(logical @b %c, physical @b %b, len %N)\n"), PROMPT_CLEAR, 0 }, + /* Inode has inline data, but superblock is missing INLINE_DATA feature. */ + { PR_1_INLINE_DATA_FEATURE, + N_("@i %i has inline data, but @S is missing INLINE_DATA feature\n"), + PROMPT_CLEAR, PR_PREEN_OK }, + + /* INLINE_DATA feature is set in a non-inline-data filesystem */ + { PR_1_INLINE_DATA_SET, + N_("@i %i has INLINE_DATA_FL flag on @f without inline data support.\n"), + PROMPT_CLEAR, 0 }, /* Pass 1b errors */ diff --git a/e2fsck/problem.h b/e2fsck/problem.h index ae1ed26..9d41cea 100644 --- a/e2fsck/problem.h +++ b/e2fsck/problem.h @@ -593,6 +593,13 @@ struct problem_context { #define PR_1_EXTENT_INDEX_START_INVALID 0x01006D #define PR_1_EXTENT_END_OUT_OF_BOUNDS 0x01006E + +/* Inode has inline data, but superblock is missing INLINE_DATA feature. */ +#define PR_1_INLINE_DATA_FEATURE 0x01006F + +/* INLINE_DATA feature is set in a non-inline-data filesystem */ +#define PR_1_INLINE_DATA_SET 0x010070 + /* * Pass 1b errors */