From patchwork Mon May 9 16:41:42 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Amir G." X-Patchwork-Id: 94822 X-Patchwork-Delegate: tytso@mit.edu 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 25581B6F2B for ; Tue, 10 May 2011 02:44:47 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753814Ab1EIQon (ORCPT ); Mon, 9 May 2011 12:44:43 -0400 Received: from mail-wy0-f174.google.com ([74.125.82.174]:33538 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753728Ab1EIQoY (ORCPT ); Mon, 9 May 2011 12:44:24 -0400 Received: by mail-wy0-f174.google.com with SMTP id 21so4026020wya.19 for ; Mon, 09 May 2011 09:44:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:from:to:cc:subject:date:message-id :x-mailer:in-reply-to:references; bh=OrB0qrqAsxNPCV0InJNOlKU28cJEXA3ycPzo/e1oJxU=; b=beyiIzT3hC+txBpOA2AhfwBxoYGgjEW294WCd2qgOA7QfpHJY7WhjAxhH90XiLF/8q l+bthEs8jRVY+O1NVTcpTp7+y3WL5HvzQFjdfOJfaW7+VYzviettICk/YsO+ar+3ZfKZ 0C2VB5M4muJr+ATXvj4eI7uXIrbO6RYmM6Khg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; b=fEAnlmwvIKX7TFAC2K+h6xos1q8wtl5n9Z3Y6sFLDTFA9aBdInqbO1GgyZfX6Uwtis VP/5SR2Pa8tzq188cojcT6usstk4DZmzgZiBqyWgGPd5Oq4HvYpyMmxFHaWO5cssd01A Wtba+PqGK875S6FOza3xR6MUtC7MxDHGY6FcE= Received: by 10.227.177.72 with SMTP id bh8mr7315753wbb.67.1304959464059; Mon, 09 May 2011 09:44:24 -0700 (PDT) Received: from localhost.localdomain (bzq-79-179-43-50.red.bezeqint.net [79.179.43.50]) by mx.google.com with ESMTPS id o23sm2034877wbc.27.2011.05.09.09.44.21 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 09 May 2011 09:44:22 -0700 (PDT) From: amir73il@users.sourceforge.net To: linux-ext4@vger.kernel.org Cc: tytso@mit.edu, Amir Goldstein , Yongqiang Yang Subject: [PATCH RFC 24/30] ext4: snapshot list support Date: Mon, 9 May 2011 19:41:42 +0300 Message-Id: <1304959308-11122-25-git-send-email-amir73il@users.sourceforge.net> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1304959308-11122-1-git-send-email-amir73il@users.sourceforge.net> References: <1304959308-11122-1-git-send-email-amir73il@users.sourceforge.net> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Amir Goldstein Implementation of multiple incremental snapshots. Snapshot inodes are chained on a list starting at the super block, both on-disk and in-memory, similar to the orphan inodes. Unlink and truncate of snapshot inodes on the list is not allowed, so an inode can never be chained on both orphan and snapshot lists. We make use of this fact to overload the in-memory inode field ext4_inode_info.i_orphan for the chaining of snapshots. Signed-off-by: Amir Goldstein Signed-off-by: Yongqiang Yang --- fs/ext4/ext4.h | 1 + fs/ext4/super.c | 1 + 2 files changed, 2 insertions(+), 0 deletions(-) diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 884033f..a7bb8ed 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -1207,6 +1207,7 @@ struct ext4_sb_info { struct block_device *journal_bdev; struct mutex s_snapshot_mutex; /* protects 2 fields below: */ struct inode *s_active_snapshot; /* [ s_snapshot_mutex ] */ + struct list_head s_snapshot_list; /* [ s_snapshot_mutex ] */ #ifdef CONFIG_JBD2_DEBUG struct timer_list turn_ro_timer; /* For turning read-only (crash simulation) */ wait_queue_head_t ro_wait_queue; /* For people waiting for the fs to go read-only */ diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 9f68ed1..461653c 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -3496,6 +3496,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) mutex_init(&sbi->s_snapshot_mutex); sbi->s_active_snapshot = NULL; + INIT_LIST_HEAD(&sbi->s_snapshot_list); /* snapshot files */ needs_recovery = (es->s_last_orphan != 0 || EXT4_HAS_INCOMPAT_FEATURE(sb,