linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: Andreas Dilger <adilger@clusterfs.com>
Cc: tytso@mit.edu, linux-ext4@vger.kernel.org
Subject: Re: [PATCH 1/4] e2fsprogs: Add undo I/O manager
Date: Fri, 03 Aug 2007 00:02:32 +0530	[thread overview]
Message-ID: <46B22340.5020709@linux.vnet.ibm.com> (raw)
In-Reply-To: <20070801225247.GC5692@schatzie.adilger.int>



Andreas Dilger wrote:
> On Aug 01, 2007  21:04 +0530, Aneesh Kumar K.V wrote:
>> +static errcode_t write_file_system_identity(io_channel undo_channel,
>> +							TDB_CONTEXT *tdb)
>> +{
>> +	/* Write to tdb file in the file system byte order */
>> +	tdb_key.dptr = "filesystem MTIME";
>> +	tdb_key.dsize = sizeof("filesystem MTIME");
>> +	tdb_data.dptr = (unsigned char *) &(super.s_mtime);
>> +	tdb_data.dsize = sizeof(super.s_mtime);
>> +
>> +	tdb_key.dptr = "filesystem UUID";
>> +	tdb_key.dsize = sizeof("filesystem UUID");
>> +	tdb_data.dptr = (unsigned char *)&(super.s_uuid);
>> +	tdb_data.dsize = sizeof(super.s_uuid);
> 
> Is this the mtime and UUID of the new filesystem or the old one?  It
> should be the UUID and mtime of the new filesystem, so that the
> undo file can be verified against the current superblock.  This poses
> a bit of a problem, because that information isn't saved until after
> the mke2fs run is finished.
> 
> One possibility is to overwrite this information at the end of mke2fs
> after the new UUID and mtime are written?
> 

This can be done by writing the file system identity during the the io_channel_close.
How about this patch on top of the last series. I will merge this into the patcheset

diff --git a/lib/ext2fs/undo_io.c b/lib/ext2fs/undo_io.c
index 30e2514..a80bafc 100644
--- a/lib/ext2fs/undo_io.c
+++ b/lib/ext2fs/undo_io.c
@@ -159,8 +159,8 @@ static errcode_t write_file_system_identity(io_channel undo_channel,
 	/* Also store the block size */
 	tdb_key.dptr = "filesystem BLKSIZE";
 	tdb_key.dsize = sizeof("filesystem BLKSIZE");
-	tdb_data.dptr = (unsigned char *)&(undo_channel->block_size);
-	tdb_data.dsize = sizeof(undo_channel->block_size);
+	tdb_data.dptr = (unsigned char *)&(tdb_data_size);
+	tdb_data.dsize = sizeof(tdb_data_size);
 
 	retval = tdb_store(tdb, tdb_key, tdb_data, TDB_INSERT);
 	if (retval == -1) {
@@ -199,13 +199,6 @@ static errcode_t undo_write_tdb(io_channel channel,
 	 */
 	if (!tdb_data_size) {
 		tdb_data_size = channel->block_size;
-
-		/*
-		 * First write. Write the file system identity
-		 */
-		retval = write_file_system_identity(channel, data->tdb);
-		if (retval)
-			return retval;
 	}
 
 	if (count == 1)
@@ -405,6 +398,11 @@ static errcode_t undo_close(io_channel channel)
 	if (--channel->refcount > 0)
 		return 0;
 
+	/* Before closing Write the file system identity */
+	retval = write_file_system_identity(channel, data->tdb);
+	if (retval)
+		return retval;
+
 	if (data->real)
 		retval = io_channel_close(data->real);
 

  reply	other threads:[~2007-08-02 18:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-01 15:34 e2fsprogs patches Aneesh Kumar K.V
     [not found] ` <f2c3823cb66c7a30436b1f2163cbe3bba791a115.1185981319.git.aneesh.kumar@linux.vnet.ibm.com>
2007-08-01 15:34   ` [PATCH 1/4] e2fsprogs: Add undo I/O manager Aneesh Kumar K.V
     [not found]   ` <53bd7d38bb3251e93fb35f56e38d2d1904951ed0.1185981319.git.aneesh.kumar@linux.vnet.ibm.com>
2007-08-01 15:34     ` [PATCH 2/4] e2fsprogs: Add undoe2fs Aneesh Kumar K.V
     [not found]   ` <54cb90cb47293e41d0b1dd1b36b1edead8960563.1185981319.git.aneesh.kumar@linux.vnet.ibm.com>
2007-08-01 15:34     ` [PATCH 3/4] e2fsprogs: Make mke2fs use undo I/O manager Aneesh Kumar K.V
     [not found]   ` <5fa196da3ae691bc49533fc43d09ff1e272f6563.1185981319.git.aneesh.kumar@linux.vnet.ibm.com>
2007-08-01 15:34     ` [PATCH 4/4] e2fsprogs: Support for large inode migration Aneesh Kumar K.V
2007-08-01 22:52   ` [PATCH 1/4] e2fsprogs: Add undo I/O manager Andreas Dilger
2007-08-02 18:32     ` Aneesh Kumar K.V [this message]
2007-08-02 21:37       ` Andreas Dilger
2007-08-03  4:49         ` Aneesh Kumar K.V
2007-08-03 18:28           ` Andreas Dilger
2007-08-01 23:05 ` e2fsprogs patches Andreas Dilger
     [not found] <bee58d48110eee4d5cd133167245b99644148d96.1185933778.git.aneesh.kumar@linux.vnet.ibm.com>
2007-08-01  2:04 ` [PATCH 1/4] e2fsprogs: Add undo I/O manager 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=46B22340.5020709@linux.vnet.ibm.com \
    --to=aneesh.kumar@linux.vnet.ibm.com \
    --cc=adilger@clusterfs.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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).