From patchwork Sat Sep 17 13:33:29 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Monakhov X-Patchwork-Id: 115130 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 EE50EB6F8A for ; Sat, 17 Sep 2011 23:33:37 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752887Ab1IQNdg (ORCPT ); Sat, 17 Sep 2011 09:33:36 -0400 Received: from mail-bw0-f46.google.com ([209.85.214.46]:64332 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751929Ab1IQNdg (ORCPT ); Sat, 17 Sep 2011 09:33:36 -0400 Received: by mail-bw0-f46.google.com with SMTP id zt4so4173708bkb.19 for ; Sat, 17 Sep 2011 06:33:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer; bh=5r0eULQgHeQ81H/6KRG7Loa3XeB9RMxNm6O6ninMCgM=; b=YXNV5W/6UWEoHPqHH7bTHeS7NA3lmDCL/+SsGB5Zvj8C7zFYrv3JgEn9LNWAiv+ka3 TMMfGWgepCDQTBesneKZiiQboefgci8IcUTFtrN9A+EaHKVDOL2eEGnZifg3i9ZGcoiP ZSDP/s7R2wijJHBZ4ufv1xGb8OobT1VVWDodc= Received: by 10.204.138.202 with SMTP id b10mr342972bku.188.1316266415675; Sat, 17 Sep 2011 06:33:35 -0700 (PDT) Received: from localhost.localdomain (swsoft-msk-nat.sw.ru. [195.214.232.10]) by mx.google.com with ESMTPS id y8sm8900079bkb.4.2011.09.17.06.33.34 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 17 Sep 2011 06:33:35 -0700 (PDT) From: Dmitry Monakhov To: linux-ext4@vger.kernel.org Cc: aneesh.kumar@linux.vnet.ibm.com, tytso@mit.edu, Dmitry Monakhov Subject: [PATCH] e2fsck: add migration inodes cleanup support Date: Sat, 17 Sep 2011 17:33:29 +0400 Message-Id: <1316266409-18932-1-git-send-email-dmonakhov@openvz.org> X-Mailer: git-send-email 1.7.0.4 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Inodes with MIGRATION flag enabled are temporal and does not own it's data blocks. Signed-off-by: Dmitry Monakhov --- e2fsck/super.c | 9 ++++++++- lib/ext2fs/ext2_fs.h | 1 + 2 files changed, 9 insertions(+), 1 deletions(-) diff --git a/e2fsck/super.c b/e2fsck/super.c index a61eb33..69566a3 100644 --- a/e2fsck/super.c +++ b/e2fsck/super.c @@ -46,6 +46,7 @@ struct process_block_struct { char *buf; struct problem_context *pctx; int truncating; + int release_data_block; int truncate_offset; e2_blkcnt_t truncate_block; int truncated_blocks; @@ -88,7 +89,8 @@ static int release_inode_block(ext2_filsys fs, fix_problem(ctx, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK, pctx); goto return_abort; } - + if (!pb->release_data_block && blockcnt >= 0) + return 0; /* * If we are deleting an orphan, then we leave the fields alone. * If we are truncating an orphan, then update the inode fields @@ -178,6 +180,11 @@ static int release_inode_blocks(e2fsck_t ctx, ext2_ino_t ino, pb.truncate_block = 0; pb.truncate_offset = 0; } + if (inode->i_flags & EXT4_MIGRATE_FL) + pb.release_data_block = 0; + else + pb.release_data_block = 1; + pb.truncated_blocks = 0; retval = ext2fs_block_iterate3(fs, ino, BLOCK_FLAG_DEPTH_TRAVERSE, block_buf, release_inode_block, &pb); diff --git a/lib/ext2fs/ext2_fs.h b/lib/ext2fs/ext2_fs.h index 54cb3d4..e2fc101 100644 --- a/lib/ext2fs/ext2_fs.h +++ b/lib/ext2fs/ext2_fs.h @@ -284,6 +284,7 @@ struct ext2_dx_countlimit { #define EXT4_SNAPFILE_FL 0x01000000 /* Inode is a snapshot */ #define EXT4_SNAPFILE_DELETED_FL 0x04000000 /* Snapshot is being deleted */ #define EXT4_SNAPFILE_SHRUNK_FL 0x08000000 /* Snapshot shrink has completed */ +#define EXT4_MIGRATE_FL 0x10000000 /* Inode used for data migration */ #define EXT2_RESERVED_FL 0x80000000 /* reserved for ext2 lib */ #define EXT2_FL_USER_VISIBLE 0x004BDFFF /* User visible flags */