From patchwork Sun Jul 1 13:48:44 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zheng Liu X-Patchwork-Id: 168417 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 B34DA2C01C1 for ; Sun, 1 Jul 2012 23:41:30 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932436Ab2GANl3 (ORCPT ); Sun, 1 Jul 2012 09:41:29 -0400 Received: from mail-pz0-f46.google.com ([209.85.210.46]:36672 "EHLO mail-pz0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932428Ab2GANl2 (ORCPT ); Sun, 1 Jul 2012 09:41:28 -0400 Received: by mail-pz0-f46.google.com with SMTP id y13so6319540dad.19 for ; Sun, 01 Jul 2012 06:41:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=+q94wKHJvaJ1oImEDVXFgFbdJpJAGetR9r+ceq4Y3H8=; b=TN6rAulkoNnXZkOAZurkwHPjc22ycgQMXgZRHdMaIl7kqBNNzWCDAp4y+8cJVAtm4b 1j5/yn4S/4tWBsS76IoAYkl/7w3NyIQD87rrJryMOzcxm1Y+MnVY9aps44Mkk2QZabUV ALUfmns9bgLYpUEMa8Nh2aJFj6CmsDxjjSjAfE9EmTo0A966BXRKb5NHWxKs1qEz+o0x xceoBF1S/w+8xMzQT7DvodXv5MLZFxRWHEz8Ddz2HqwUE+EeShbVhwYO8dXUKInrBNN2 +TWYmzku0uAr7w9Lvy6R8b+IThcm9/VqfQItrM/k5gIfWLqzBYSyXgfBRBrJUHDZZy9y smTw== Received: by 10.68.227.198 with SMTP id sc6mr21761168pbc.138.1341150088170; Sun, 01 Jul 2012 06:41:28 -0700 (PDT) Received: from localhost.localdomain ([182.92.247.2]) by mx.google.com with ESMTPS id ql3sm10544254pbc.72.2012.07.01.06.41.26 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 01 Jul 2012 06:41:27 -0700 (PDT) From: Zheng Liu To: linux-ext4@vger.kernel.org Cc: Zheng Liu Subject: [PATCH 21/35 v3] debugfs: make expand_dir cmd support inline data Date: Sun, 1 Jul 2012 21:48:44 +0800 Message-Id: <1341150538-32047-22-git-send-email-wenqing.lz@taobao.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1341150538-32047-1-git-send-email-wenqing.lz@taobao.com> References: <1341150538-32047-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 expand_dir command allocates two new block for the dir. It firstly allocates a new block, and copies all of inline data into this block. Then it allocates another block for this dir. Signed-off-by: Zheng Liu --- lib/ext2fs/expanddir.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/ext2fs/expanddir.c b/lib/ext2fs/expanddir.c index 22558d6..8ba8a23 100644 --- a/lib/ext2fs/expanddir.c +++ b/lib/ext2fs/expanddir.c @@ -114,8 +114,12 @@ errcode_t ext2fs_expand_dir(ext2_filsys fs, ext2_ino_t dir) es.newblocks = 0; es.dir = dir; - retval = ext2fs_block_iterate3(fs, dir, BLOCK_FLAG_APPEND, - 0, expand_dir_proc, &es); + if (ext2fs_has_inline_data(fs, dir)) + retval = ext2fs_inline_data_expand_dir(fs, dir, BLOCK_CHANGED, + 0, expand_dir_proc, &es); + else + retval = ext2fs_block_iterate3(fs, dir, BLOCK_FLAG_APPEND, + 0, expand_dir_proc, &es); if (es.err) return es.err;