linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Theodore Tso <tytso@mit.edu>
To: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Cc: linux-ext4@vger.kernel.org
Subject: Re: [PATCH 1/4] Add unix COW io manager
Date: Mon, 7 May 2007 09:01:22 -0400	[thread overview]
Message-ID: <20070507130121.GA17180@thunk.org> (raw)
In-Reply-To: <eb16ba5f2c6f399ea747169097434ae84443728f.1178262585.git.aneesh.kumar@linux.vnet.ibm.com>

On Fri, May 04, 2007 at 02:43:21PM +0530, Aneesh Kumar K.V wrote:
> + * unix_cow_io.c --- This is the Unix (well, really POSIX) implementation
> + * 	of the COW I/O manager.

I really wish you had based this not on unix_io.c, but rather on
test_io.c, for two reasons (a) this reduces code duplication, (b) it
means that we can chain/stack I/O managers.  i.e., test_io ->
cow_manager -> unix_io.

The one change I would recommend is that instead of assigning to a
globally visible external variable (as I did in test_io, and which I
now regret as a not necessarily being portable --- different shared
library implementations have different restrictions on whether you can
access global variables defined in shared libraries from an
application or vice versa --- with AIX having some of the most peverse
shared library restritions, at least 7-8 years ago when I had the
misfortune of trying to make Kerberos v5 shared libraries work on AIX
:-).  Instead, what I would recommend is creating a function which an
application could call to set the backing I/O manager for the
cow_manager, as well as the filenames to use for the tdb journal.

The second change I would recommend is to NOT call it "cow_manager"
but rather an "undo_manager", since that makes it clear that what is
being backed up is not the work that we are about to do, but rather
the original contents of the disk.  I would also rename the
ext4_replay tool something like e2undofs, since "replay" has the
connotation that you are applying changes that were done in a log,
when in fact what you are really doing is backing out changes.

We want to make sure we avoid this confusion, since Xen and UML and
most other virtualization engines, for good reasons, do the exact
opposite --- the COW file contains the changes, and the base
file/device remains unchanged.

> +	retval = tdb_store(data->tdb, tdb_key, tdb_data, TDB_INSERT);
> +	if (retval == -1) {
> +		/* FIXME!! Not sure what should be the error */
> +		retval = EXT2_ET_SHORT_WRITE;
> +		goto error_out;
> +	}

You need to write the tdb_store() around a tdb_transaction_start() and
tdb_transaction_commit() pair, so that we can be sure the original
data is actually synced to disk.  Otherwise, on a crash, we could have
a situation where the original data on disk has been overwritten, but
the backup of the original block was never forced to disk!

						- Ted

  parent reply	other threads:[~2007-05-07 13:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-04  9:13 [RFC][take 4] e2fsprogs: Add ext4migrate Aneesh Kumar K.V
     [not found] ` <eb16ba5f2c6f399ea747169097434ae84443728f.1178262585.git.aneesh.kumar@linux.vnet.ibm.com>
2007-05-04  9:13   ` [PATCH 1/4] Add unix COW io manager Aneesh Kumar K.V
     [not found]   ` <344eabfd05e36374043e8cd0b4e166a66f88bec6.1178262586.git.aneesh.kumar@linux.vnet.ibm.com>
2007-05-04  9:13     ` [PATCH 2/4] Add extent related functions Aneesh Kumar K.V
     [not found]   ` <1dcc9dea2106570ec314b59bf69e7e3720818a94.1178262586.git.aneesh.kumar@linux.vnet.ibm.com>
2007-05-04  9:13     ` [PATCH 3/4] e2fsprogs: Add ext4migrate Aneesh Kumar K.V
     [not found]   ` <69f2894044fa7c5ad14a59c22e603bc5529dce2a.1178262586.git.aneesh.kumar@linux.vnet.ibm.com>
2007-05-04  9:13     ` [PATCH 4/4] Add ext4replay tool Aneesh Kumar K.V
2007-05-07 13:01   ` Theodore Tso [this message]
2007-05-06  5:17 ` [RFC][take 4] e2fsprogs: Add ext4migrate Andreas Dilger
2007-05-07  3:26   ` Aneesh Kumar K.V
2007-05-07 13:20     ` Theodore Tso
2007-05-07 13:46       ` Aneesh Kumar K.V
2007-05-07 15:57         ` Theodore Tso
2007-05-07 21:01         ` Andreas Dilger
2007-05-07 13:59       ` Aneesh Kumar K.V

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070507130121.GA17180@thunk.org \
    --to=tytso@mit.edu \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=linux-ext4@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).