Re: [PATCH] Set JBD2_FEATURE_INCOMPAT_64BIT on filesystems larger than 32-bit blocks

2007-06-06 Thread Laurent Vivier
Jose R. Santos wrote:
 Set the journals JBD2_FEATURE_INCOMPAT_64BIT on devices with more
 than 32bit block sizes during mount time.  This ensure proper record
 lenth when writing to the journal.
 
 Signed-off-by: Jose R. Santos [EMAIL PROTECTED]
 Signed-off-by: Andreas Dilger [EMAIL PROTECTED]
 Signed-off-by: Mingming Cao [EMAIL PROTECTED]
 ---
  fs/ext4/super.c |   11 +++
  1 file changed, 11 insertions(+)
 
 Index: linux-2.6.22-rc3/fs/ext4/super.c
 ===
 --- linux-2.6.22-rc3.orig/fs/ext4/super.c 2007-06-04 11:01:20.028360650 
 -0500
 +++ linux-2.6.22-rc3/fs/ext4/super.c  2007-06-05 21:14:33.974854532 -0500
 @@ -1824,6 +1824,13 @@ static int ext4_fill_super (struct super
   goto failed_mount3;
   }
  
 + if (ext4_blocks_count(es)  0x 

Perhaps you should use 0xULL ?

 + !jbd2_journal_set_features(EXT4_SB(sb)-s_journal, 0, 0,
 +JBD2_FEATURE_INCOMPAT_64BIT)) {
 + printk(KERN_ERR ext4: Failed to set 64-bit journal feature\n);
 + goto failed_mount4;
 + }
 +
   /* We have now updated the journal if required, so we can
* validate the data journaling mode. */
   switch (test_opt(sb, DATA_FLAGS)) {

Regards,
Laurent
-- 
- [EMAIL PROTECTED]  --
   Any sufficiently advanced technology is
  indistinguishable from magic. - Arthur C. Clarke



signature.asc
Description: OpenPGP digital signature


[PATCH] Add static to functions local to fs/ext4/balloc.c

2007-06-06 Thread Kirk True
ext4_reserve_local, ext4_rebalance_reservation, and
ext4_reserve_global are all local to balloc.c and can be made
static.

This is against the 2.6.22-rc4-ext4-1 tree that was announced
on:

http://lists.openwall.net/linux-ext4/2007/06/05/15

Signed-off-by: Kirk True [EMAIL PROTECTED]

Index: linux-2.6.22-rc4/fs/ext4/balloc.c
===
diff -uprN linux-2.6.22-rc4-orig/fs/ext4/balloc.c 
linux-2.6.22-rc4/fs/ext4/balloc.c
--- linux-2.6.22-rc4-orig/fs/ext4/balloc.c  2007-06-06 02:02:29.0 
-0700
+++ linux-2.6.22-rc4/fs/ext4/balloc.c   2007-06-06 01:59:24.0 -0700
@@ -1868,7 +1868,7 @@ struct ext4_reservation_slot {
 } cacheline_aligned;

-
-int ext4_reserve_local(struct super_block *sb, int blocks)
+static int ext4_reserve_local(struct super_block *sb, int blocks)
 {
struct ext4_sb_info *sbi = EXT4_SB(sb);
struct ext4_reservation_slot *rs;
@@ -1888,8 +1888,7 @@ int ext4_reserve_local(struct super_bloc
return rc;
 }

-
-void ext4_rebalance_reservation(struct ext4_reservation_slot *rs, __u64 free)
+static void ext4_rebalance_reservation(struct ext4_reservation_slot *rs, __u64 
free)
 {
int i, used_slots = 0;
__u64 chunk;
@@ -1916,7 +1915,7 @@ void ext4_rebalance_reservation(struct e
BUG_ON(free);
 }
 
-int ext4_reserve_global(struct super_block *sb, int blocks)
+static int ext4_reserve_global(struct super_block *sb, int blocks)
 {
struct ext4_sb_info *sbi = EXT4_SB(sb);
struct ext4_reservation_slot *rs;

-
To unsubscribe from this list: send the line unsubscribe linux-ext4 in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC PATCH 1/1] e2fsprogs: Add undo I/O manager.

2007-06-06 Thread Aneesh Kumar K.V



Theodore Tso wrote:

On Tue, May 22, 2007 at 03:47:33PM +0530, Aneesh Kumar K.V wrote:

This I/O manager saves the contents of the location being overwritten
to a tdb database. This helps in undoing the changes done to the
file system.

+   /* loop through the existing entries and find if they overlap */
+   for (key = tdb_firstkey(tdb); key.dptr; key = tdb_nextkey(tdb, key)) {
+   data = tdb_fetch(tdb, key);
+   /*
+* we are not interested in the data
+*/
+   free(data.dptr);


Youch.  This is going to be painful; it means that for every single
write, we need to iterate over every single entry in the TDB.  This
doesn't scale terribly well.  :-(

I suspect you will do much better by using a different encoding for
the tdb database; namely, one where you don't use an extent-based
encoding, but rather something which is strictly block based.  So that
means a separate entry in the tdb database for each block entry.  That
will be slightly more inefficient in terms of overhead stored in the
tdb database, yes, but as a percentage of the blocksize (typically
4k), the overhead isn't that great, and the performance improvement
will be huge.

The downside of doing this is that you need to take into account
changes in blocksize via set_blksize() (this is rare; it's only done
by mke2fs, and then only to zap various MD superblocks, et. al), and
if the size is negative (in which case it represents the size in
bytes, which could be more or less than a blocksize, and not
necessarily a multiple of a blocksize).




If we allow to change the block size in between that would mean the
records that we store in the tdb database will be of variable size ( 
different block sizes). That would also add all the code/complexity that 
i have in is_trans_overlapping. So if we are looking at avoiding the 
above for() loop then we should have constant block size (4K ?).  But in 
your above statement, you are counting overhead as a percentage of 
blocksize. So how do we handle this ?



Now with constant block size The write_blk gets complex because of there 
won't be a 1:1 mapping between the block number we need to use in 
tdb_database and the backing I/O manager.






But that's not too bad, since now you just have to do is figure out
which block(s) need to be saved, and then check to see if a record
already exists in the tdb; if it does, the original value has been
saved, and you don't have to do anything; if it doesn't then you just
save the entire block.  The undo manager need to save the first
blocksize specified, and backup the original data in the tdb file in
terms of that first blocksize, regardless of any later changes in the
blocksize (which as I said is rare).




+   if (req_loc  cur_loc) {
+   if (req_loc+req_size  cur_loc) {
+   /*  --
+*  |  |||
+*  --
+*  rl cl   rs   cs
+*/


This looks like notes to yourself; but it's not obvious what's going
on here.  Fortunately with the above suggested change in algorith,
most of this will go away, but please make your comments more obvious.




rl - req_loc
cl - cur_loc
rs - req_size
cs - cur_size





+   // I have libtdb1. Enable after rebasing to latest e2fsprogs that has 
this API
+   //tdb_transaction_start(data-tdb);


What version of e2fsprogs are you developing against?




Right now i am manually linking it against libtdb.

dpkg --search /usr/lib/libtdb.so
tdb-dev: /usr/lib/libtdb.so




+   /* FIXME!! Not sure what should be the error */
+   //tdb_transaction_cancel(data-tdb);
+   retval = EXT2_ET_SHORT_WRITE;
+   goto error_out;


I would add a new error code in lib/ext2fs/ext2_err.et.in; that way we
can have a very specific error code explaining that we have a failure
to save the original version of the block.  




Will do this



+   actual = read(data-dev, tdb_data.dptr, size);
+   if (actual != size) {


Instead of using ext2fs_llseek() and read(), please use the underlying
io_manager.  That way the undo manager might have a chance to work on
some other io manager other than unix_io.  Yes, that means that you
might in some cases need to save and restore the current blksize.  But
that's not going to be the common case, and it will make the code much
more general.


+error_out:
+   /* Move the location back */
+   if (ext2fs_llseek(data-dev, cur_loc, SEEK_SET) != cur_loc) {
+   retval = errno ? errno : EXT2_ET_LLSEEK_FAILED;
+   goto error_out;
+   }


Why do you need to move the location back?  As far as I know nothing
should be depending on current offset of the file descriptor.




No specific reason.


-aneesh
-
To unsubscribe from this list: send the line