[PATCH 3/4][e2fsprogs] Relax group descriptor checking.

2007-08-13 Thread Jose R. Santos
From: Jose R. Santos <[EMAIL PROTECTED]>

Relax group descriptor checking.

In order for tools such as dump2efs, e2fsck and debugfs to open a ext4
filesystem with FLEX_BG feature enable, some descriptor checking needs
to be relaxed.  This patch changes the group desciptor checking so
that bitmaps and inode tables can be located anywhere in the
partitions block range.

Signed-off-by: Jose R. Santos <[EMAIL PROTECTED]>
--

 e2fsck/super.c  |   14 --
 lib/ext2fs/check_desc.c |   15 +--
 2 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/e2fsck/super.c b/e2fsck/super.c
index 00a131c..ed28732 100644
--- a/e2fsck/super.c
+++ b/e2fsck/super.c
@@ -463,6 +463,8 @@ void check_super_block(e2fsck_t ctx)
int inodes_per_block;
int ipg_max;
int inode_size;
+   dgrp_t  start_group;
+   int meta_bg_size;
dgrp_t  i;
blk_t   should_be;
struct problem_context  pctx;
@@ -578,8 +580,16 @@ void check_super_block(e2fsck_t ctx)
for (i = 0, gd=fs->group_desc; i < fs->group_desc_count; i++, gd++) {
pctx.group = i;
 
-   first_block = ext2fs_group_first_block(fs, i);
-   last_block = ext2fs_group_last_block(fs, i);
+   if (EXT2_HAS_INCOMPAT_FEATURE (fs->super,
+  EXT4_FEATURE_INCOMPAT_FLEX_BG)) {
+   meta_bg_size = (fs->blocksize / sizeof (struct 
ext2_group_desc));
+   start_group = (i / meta_bg_size) * meta_bg_size;
+   first_block = ext2fs_group_first_block(fs, start_group);
+   last_block = ext2fs_group_first_block(fs, start_group + 
meta_bg_size);
+   } else {
+   first_block = ext2fs_group_first_block(fs, i);
+   last_block = ext2fs_group_last_block(fs, i);
+   }
 
if ((gd->bg_block_bitmap < first_block) ||
(gd->bg_block_bitmap > last_block)) {
diff --git a/lib/ext2fs/check_desc.c b/lib/ext2fs/check_desc.c
index 146f9e5..dbbcfb3 100644
--- a/lib/ext2fs/check_desc.c
+++ b/lib/ext2fs/check_desc.c
@@ -34,12 +34,23 @@ errcode_t ext2fs_check_desc(ext2_filsys fs)
dgrp_t i;
blk_t first_block = fs->super->s_first_data_block;
blk_t last_block;
+   dgrp_t start_group;
+   int meta_bg_size;
 
EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
 
for (i = 0; i < fs->group_desc_count; i++) {
-   first_block = ext2fs_group_first_block(fs, i);
-   last_block = ext2fs_group_last_block(fs, i);
+   if (EXT2_HAS_INCOMPAT_FEATURE (fs->super, 
+  EXT4_FEATURE_INCOMPAT_FLEX_BG)) {
+   meta_bg_size = (fs->blocksize / sizeof (struct 
ext2_group_desc));
+   start_group = (i / meta_bg_size) * meta_bg_size;
+   first_block = ext2fs_group_first_block(fs, start_group);
+   last_block = ext2fs_group_first_block(fs, start_group + 
meta_bg_size);
+   }
+   else {
+   first_block = ext2fs_group_first_block(fs, i);
+   last_block = ext2fs_group_last_block(fs, i);
+   }
 
/*
 * Check to make sure block bitmap for group is
-
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


[PATCH 4/4][e2fsprogs] New bitmap and inode table allocation for FLEX_BG

2007-08-13 Thread Jose R. Santos
From: Jose R. Santos <[EMAIL PROTECTED]>

New bitmap and inode table allocation for FLEX_BG

Change the way we allocate bitmaps and inode tables if the FLEX_BG
feature is used at mke2fs time.  The block and inode bitmaps are
allocated as a one contiguous set for each flex block group.  Due to
the size of the inode tables, the inode table for each block group is
allocate individually but packed close together at the beginning of a
flex group.  For now, this allow for the inode table to be packed
close to the inode bitmaps in cases where we try to allocate a large
group of inode tables right after the bitmaps and fail.

Signed-off-by: Jose R. Santos <[EMAIL PROTECTED]>
--

 lib/ext2fs/alloc_tables.c |  132 -
 1 files changed, 128 insertions(+), 4 deletions(-)

diff --git a/lib/ext2fs/alloc_tables.c b/lib/ext2fs/alloc_tables.c
index 4ad2ba9..9740a2f 100644
--- a/lib/ext2fs/alloc_tables.c
+++ b/lib/ext2fs/alloc_tables.c
@@ -27,6 +27,124 @@
 #include "ext2_fs.h"
 #include "ext2fs.h"
 
+#define ALLOC_BLOCK_BITMAPS1
+#define ALLOC_INODE_BITMAPS2
+#define ALLOC_INODE_TABLES 3
+
+errcode_t ext2fs_allocate_contiguous(ext2_filsys fs, dgrp_t group,
+int type, blk_t start_blk, blk_t last_blk, 
+int count, ext2fs_block_bitmap bmap)
+{
+   errcode_t   retval;
+   blk_t   new_blk, blk;
+   int i, j;
+
+   if (!bmap)
+   bmap = fs->block_map;
+
+   switch (type) {
+   case ALLOC_BLOCK_BITMAPS:
+   retval = ext2fs_get_free_blocks(fs, start_blk, last_blk,
+   1 * count, bmap, &new_blk);
+   if (retval)
+   return retval;
+   for (i=0, blk=new_blk; i < count; i++, blk++) {
+   ext2fs_mark_block_bitmap(bmap, blk);
+   fs->group_desc[group+i].bg_block_bitmap = blk;
+   }
+   break;
+
+   case ALLOC_INODE_BITMAPS:
+   retval = ext2fs_get_free_blocks(fs, start_blk, last_blk,
+   1 * count, bmap, &new_blk);
+   if (retval)
+   return retval;
+   for (i=0, blk=new_blk; i < count; i++, blk++) {
+   ext2fs_mark_block_bitmap(bmap, blk);
+   fs->group_desc[group+i].bg_inode_bitmap = blk;
+   }
+   break;
+
+   case ALLOC_INODE_TABLES:
+   for (i=0; i < count; i++) {
+   retval = ext2fs_get_free_blocks(fs, start_blk, last_blk,
+   
fs->inode_blocks_per_group,
+   bmap, &new_blk);
+   if (retval)
+   return retval;
+   blk = new_blk;
+   for (j=0; j < fs->inode_blocks_per_group; j++, blk++)
+   ext2fs_mark_block_bitmap(bmap, blk);
+   fs->group_desc[group+i].bg_inode_table = new_blk;
+   }
+   break;
+
+   }
+   return 0;
+}
+
+
+
+errcode_t ext2fs_allocate_flex_groups(ext2_filsys fs)
+{
+   errcode_t   retval;
+   blk_t   start, last, j, blocks;
+   dgrp_t  i, k;
+   int meta_bg_size;
+
+   meta_bg_size = (fs->blocksize / sizeof (struct ext2_group_desc));
+   blocks = 0;
+
+   for (i = 0; i < fs->group_desc_count; i=i+meta_bg_size) {
+   
+   start = ext2fs_group_first_block(fs, i);
+
+   if (i+meta_bg_size >= fs->group_desc_count) {
+   last = ext2fs_group_last_block(fs, 
fs->group_desc_count);
+   meta_bg_size = fs->group_desc_count - i;
+   }
+   else
+   last = ext2fs_group_last_block(fs, i+meta_bg_size-1);
+
+   retval = ext2fs_allocate_contiguous(fs, i, ALLOC_BLOCK_BITMAPS,
+   start, last, meta_bg_size,
+   fs->block_map);
+   if (retval)
+   return retval;
+   retval = ext2fs_allocate_contiguous(fs, i, ALLOC_INODE_BITMAPS,
+   start, last, meta_bg_size,
+   fs->block_map);
+   if (retval)
+   return retval;
+   retval = ext2fs_allocate_contiguous(fs, i, ALLOC_INODE_TABLES,
+   start, last, meta_bg_size,
+   fs->block_map);
+   if (retval)
+   return retval;
+
+   /*
+* The content of bg_free_blocks_co

[PATCH 2/4][e2fsprogs] Allow FLEX_BG to be use as a feature option at mke2fs time.

2007-08-13 Thread Jose R. Santos
From: Jose R. Santos <[EMAIL PROTECTED]>

Allow FLEX_BG to be use as a feature option at mke2fs time.

Signed-off-by: Jose R. Santos <[EMAIL PROTECTED]>
--

 lib/e2p/feature.c   |2 ++
 lib/ext2fs/ext2fs.h |6 --
 misc/mke2fs.c   |7 ++-
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/lib/e2p/feature.c b/lib/e2p/feature.c
index fe7e65a..4bf5630 100644
--- a/lib/e2p/feature.c
+++ b/lib/e2p/feature.c
@@ -67,6 +67,8 @@ static struct feature feature_list[] = {
"extent" },
{   E2P_FEATURE_INCOMPAT, EXT4_FEATURE_INCOMPAT_64BIT,
"64bit" },
+   {   E2P_FEATURE_INCOMPAT, EXT4_FEATURE_INCOMPAT_FLEX_BG,
+"flex_bg"},
{   0, 0, 0 },
 };
 
diff --git a/lib/ext2fs/ext2fs.h b/lib/ext2fs/ext2fs.h
index 83a9091..5c461c9 100644
--- a/lib/ext2fs/ext2fs.h
+++ b/lib/ext2fs/ext2fs.h
@@ -432,12 +432,14 @@ typedef struct ext2_icount *ext2_icount_t;
 EXT2_FEATURE_INCOMPAT_COMPRESSION|\
 EXT3_FEATURE_INCOMPAT_JOURNAL_DEV|\
 EXT2_FEATURE_INCOMPAT_META_BG|\
-EXT3_FEATURE_INCOMPAT_RECOVER)
+EXT3_FEATURE_INCOMPAT_RECOVER|\
+EXT4_FEATURE_INCOMPAT_FLEX_BG)
 #else
 #define EXT2_LIB_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE|\
 EXT3_FEATURE_INCOMPAT_JOURNAL_DEV|\
 EXT2_FEATURE_INCOMPAT_META_BG|\
-EXT3_FEATURE_INCOMPAT_RECOVER)
+EXT3_FEATURE_INCOMPAT_RECOVER|\
+EXT4_FEATURE_INCOMPAT_FLEX_BG)
 #endif
 #define EXT2_LIB_FEATURE_RO_COMPAT_SUPP
(EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER|\
 EXT2_FEATURE_RO_COMPAT_LARGE_FILE)
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index 4a6cace..6dd8d30 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -873,7 +873,8 @@ static __u32 ok_features[3] = {
EXT2_FEATURE_COMPAT_LAZY_BG,/* Compat */
EXT2_FEATURE_INCOMPAT_FILETYPE| /* Incompat */
EXT3_FEATURE_INCOMPAT_JOURNAL_DEV|
-   EXT2_FEATURE_INCOMPAT_META_BG,
+   EXT2_FEATURE_INCOMPAT_META_BG|
+   EXT4_FEATURE_INCOMPAT_FLEX_BG,
EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER /* R/O compat */
 };
 
@@ -1363,6 +1364,10 @@ static void PRS(int argc, char *argv[])
fs_param.s_feature_ro_compat = 0;
}

+   if (fs_param.s_feature_incompat &
+   EXT4_FEATURE_INCOMPAT_FLEX_BG)
+   fs_param.s_feature_incompat |= EXT2_FEATURE_INCOMPAT_META_BG;
+
/* Set first meta blockgroup via an environment variable */
/* (this is mostly for debugging purposes) */
if ((fs_param.s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) &&
-
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


[PATCH 0/4][e2fsprogs] Enable FLEX_BG support

2007-08-13 Thread Jose R. Santos

The following series of patches add support creating and checking
filesystems with the FLEX_BG feature.  This feature currently groups
meta-data from a series of groups at the beginning of a flex group in
order to improve performance during heavy meta-data operations.

Changes from last time:
- When making a filesystem with FLEX_BG also enable META_BG feature.
- Allocate meta data within the META_BG group range.  
- Descriptor checking ensures bitmaps and inode tables are in the META 
  group.

Problems and TODOs:
- Fsck has some failures using FLEX_BG and resize_inode features at the
  same time.  Still investigating.
- Need to define how unallocated inode tables will look like.
- Need to create test case

-JRS
-
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


[PATCH 1/4][e2fsprogs] Reserve the INCOMPAT feature number for FLEX_BG.

2007-08-13 Thread Jose R. Santos
From: Jose R. Santos <[EMAIL PROTECTED]>

Reserve the INCOMPAT feature number for FLEX_BG.

Signed-off-by: Jose R. Santos <[EMAIL PROTECTED]>
--

 lib/ext2fs/ext2_fs.h |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/lib/ext2fs/ext2_fs.h b/lib/ext2fs/ext2_fs.h
index a316665..2394857 100644
--- a/lib/ext2fs/ext2_fs.h
+++ b/lib/ext2fs/ext2_fs.h
@@ -640,6 +640,7 @@ struct ext2_super_block {
 #define EXT3_FEATURE_INCOMPAT_EXTENTS  0x0040
 #define EXT4_FEATURE_INCOMPAT_64BIT0x0080
 #define EXT4_FEATURE_INCOMPAT_MMP  0x0100
+#define EXT4_FEATURE_INCOMPAT_FLEX_BG  0x0200
 
 
 #define EXT2_FEATURE_COMPAT_SUPP   0
-
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: Future of ext2 support in the Hurd?

2007-08-13 Thread Samuel Thibault
Hi,

Theodore Tso, le Mon 13 Aug 2007 12:11:46 -0400, a écrit :
> the latest Debian version of e2fsprogs is 1.40.2, and I assume
> (although I don't know for sure) that the Debian GNU/Hurd port is
> tracking Debian unstable,

Yes.

> so if there were anything embarassing, I would have gotten a
> complaint.

I've just sent one on the bts :)
(just disabling devmapper, SElinux and online resizing support)

Samuel
-
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: [PATCH] [188/2many] MAINTAINERS - EXT4 FILE SYSTEM

2007-08-13 Thread Joe Perches
On Mon, 2007-08-13 at 10:19 -0700, Mingming Cao wrote:
> Probably should add Shaggy (Dave Kleikamp <[EMAIL PROTECTED]>) here
> too. He helped push ext4 fs into mainline and actively performing ext4
> patch queue maintainence. 

EXT4 FILE SYSTEM
P:  Ted Ts'o
M:  [EMAIL PROTECTED]
P:  Mingming Cao
M:  [EMAIL PROTECTED]
P:  Andreas Dilger
M:  [EMAIL PROTECTED]
P:  Dave Kleikamp
M:  [EMAIL PROTECTED]
P:  Eric Sandeen
M:  [EMAIL PROTECTED]
L:  linux-ext4@vger.kernel.org
S:  Maintained
F:  fs/ext4/
F:  include/linux/ext4*


-
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: [PATCH] [188/2many] MAINTAINERS - EXT4 FILE SYSTEM

2007-08-13 Thread Mingming Cao
On Mon, 2007-08-13 at 09:55 -0700, Joe Perches wrote:
> On Mon, 2007-08-13 at 11:39 -0500, Eric Sandeen wrote:
> > (And to be fair about it in terms of actual work done so far, please
> > put
> > the other names ahead of mine!)  :)
> 
> EXT4 FILE SYSTEM
> P:Ted Ts'o
> M:[EMAIL PROTECTED]
> P:Mingming Cao
> M:[EMAIL PROTECTED]
> P:Andreas Dilger
> M:[EMAIL PROTECTED]
> P:Eric Sandeen
> M:[EMAIL PROTECTED]
> L:linux-ext4@vger.kernel.org
> S:Maintained
> F:fs/ext4/
> F:include/linux/ext4*
> 

Probably should add Shaggy (Dave Kleikamp <[EMAIL PROTECTED]>) here
too. He helped push ext4 fs into mainline and actively performing ext4
patch queue maintainence. 


Mingming

-
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: [PATCH] [188/2many] MAINTAINERS - EXT4 FILE SYSTEM

2007-08-13 Thread Joe Perches
On Mon, 2007-08-13 at 11:39 -0500, Eric Sandeen wrote:
> (And to be fair about it in terms of actual work done so far, please
> put
> the other names ahead of mine!)  :)

EXT4 FILE SYSTEM
P:  Ted Ts'o
M:  [EMAIL PROTECTED]
P:  Mingming Cao
M:  [EMAIL PROTECTED]
P:  Andreas Dilger
M:  [EMAIL PROTECTED]
P:  Eric Sandeen
M:  [EMAIL PROTECTED]
L:  linux-ext4@vger.kernel.org
S:  Maintained
F:  fs/ext4/
F:  include/linux/ext4*



-
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: [PATCH] [188/2many] MAINTAINERS - EXT4 FILE SYSTEM

2007-08-13 Thread Eric Sandeen
Joe Perches wrote:
> On Mon, 2007-08-13 at 11:19 -0400, Theodore Tso wrote:
>> Yep, agreed.
> 
> OK. saved in my tree as
> 
> EXT4 FILE SYSTEM
> P:  Ted Ts'o
> M:[EMAIL PROTECTED]
> P:Eric Sandeen
> M:[EMAIL PROTECTED]

Close... try [EMAIL PROTECTED], now :)

Andreas should still be in there I think (his prior message suggested
replacing Stephen & Andrew with Ted, Mingmimg and me, I think - but not
to replace Andreas - Andreas, correct me if I'm wrong...)

(And to be fair about it in terms of actual work done so far, please put
the other names ahead of mine!)  :)

Thanks,

-Eric

> P:Mingming Cao
> M:[EMAIL PROTECTED]
> L:linux-ext4@vger.kernel.org
> S:Maintained
> F:fs/ext4/
> F:include/linux/ext4*
> 
> Separate question.  Is it right that the L: entries
> for ext2/3/4 are all [EMAIL PROTECTED]
> 

-
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] mballoc patches

2007-08-13 Thread Aneesh Kumar K.V



Aneesh Kumar K.V wrote:

Alex actually pointed me the new mballoc patches at
ftp://ftp.clusterfs.com/pub/people/alex/mballoc3

The series is the forward port of the same on top of
d4ac2477fad0f2680e84ec12e387ce67682c5c13 (v2.6.23-rc2)


I guess the mballoc3 patch at clusterfs.com is based on
a patched ext3(I guess it is ext3 + extent tree local to
clusterfs ? ). The following series is based on ext4.


I tested the changes with different blocks per group
combination and it seems to be working fine. (The last
series did panic with mke2fs -g 800 )


I will now look at splitting this to smaller patches.

NOTE : I am not sure whether patch 2 will be able to make the list.
if not is there a place i can ftp/scp them so that others can access
the same ?




I am attaching below the PATCH 2/4 in .gz format. The uncompressed one
got dropped by the list.

-aneesh


0002-mballoc-core-patch.patch.gz
Description: GNU Zip compressed data


Re: Future of ext2 support in the Hurd?

2007-08-13 Thread Theodore Tso
On Sun, Aug 12, 2007 at 08:13:36PM -0700, Roland McGrath wrote:
> Indeed some people do use the Hurd and they all do rely on the EXT2_OS_HURD
> format support in e2fsprogs.  It's the intended plan to migrate away from
> EXT2_OS_HURD format and use a strict subset of the ext2 format features
> used natively by Linux ext2fs (in theory eventually that whole set).  The
> Hurd-specific data now stored in inode fields in EXT2_OS_HURD format would
> instead be stored in ext2 xattr format.  The extent of cooperation then
> required between ext2 format authorities and Hurd developers is assigning
> an EXT2_XATTR_INDEX_* number to correspond to the "gnu." prefix.  The
> conventions for formats and semantics of attributes with this prefix will
> be maintained by the GNU Project.

Good plan.  :-)  Especially if you end up using a larger inode, and
supporting the EA-in-inode feature, I think you will find a huge speed
boost to files that use translators.  Out of curiosity, do you view
this as something which will be a common case, or an usual one (i.e.,
files using passive translators which are specified in the filesystem)?

Even if you don't, if a large number of files are always using the
same translator, there will probably be some significant disk space
savings with storing that information in an extended attribute.

> If it is important to you and you would like to state a quasi-formal
> schedule to deprecate EXT2_OS_HURD format (not instantaneously), we can
> work with that.  We'd hope for a decent interval of backward compatibility
> support in e2fsck.  (The Hurd code will probably continue to support the
> old format indefinitely.)  Hurd developers can make a small push to get our
> ext2fs code supporting the xattr format encoding of Hurd-specific metadata.
> If you're feeling especially charitable, you could provide format
> conversion support in e2fsprogs.

We don't need to give an explicit schedule, no.  I don't want to force
this to happen fast if the Hurd doesn't have volunteers lined up to do
the work.  As I mentioned earlier, the union is annoying, but it's
hardly a major obstacle to code maintainability.

I am certainly open to including format conversion in e2fprogs, if
someone sends me patches.  I doubt I will have the bandwidth to write
the patches myself in the near future; I have many other todo's on my
plate at the moment.  Working with you to assign a number for the name
index is something that I can help you do.  In fact, I think 7 is
available; why don't I reserve it and then get back to you once it's
been formally merged.

One thing that *would* be useful if you could provide some text (that
would go into the ext2/3/4 wiki) describe exactly what subset of the
ext2 filesystem is currently supported by the Hurd, and what the rough
roadmap you have for supporting additional features.  For example, do
you currently support sparse_superblocks, etc.  BTW, it may be that
you would want to supply a different /etc/mke2fs.conf file in the
e2fsprogs patches so that filesystems created by mke2fs don't include
features that might potentially give the Hurd ext2fs driver heartburn
--- I get the distinct feeling that it hasn't supported many of the
more recent innovations that are in the Linux implementation.

Regards,

- Ted
-
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: Future of ext2 support in the Hurd?

2007-08-13 Thread Theodore Tso
On Mon, Aug 13, 2007 at 02:02:11AM +0200, Marcus Brinkmann wrote:
> In fact, I just searched for your name, and it pops up in the network
> stack, but not in the ext2fs translator (the above files are copyright
> Remy Card and Linus Torvald).

I only did a quick look, but I recognized some Linux code in balloc.c,
at least.  The code I think was probably written originally by Stephen
Tweedie.  We weren't very careful about maintaining authorship
attribution until after we moved to the BitKeeper (and later git) for
source code management.  I probably only have minimal kernel ownership
in terms of lines of code, with the exception being the directory
indexing changes and extended attribute code, which got reworked by me
before they were merged into mainline.  Most of my code ownership from
a copyright standpoint is in e2fsprogs.

> This matches my best understanding of the issues involved.  Beyond
> that, I can not say anything that applies particularly to the Hurd or
> its RPC interfaces.

It will be especially interesting since some RPC interfaces (mediated
by libc) will be used by GPLv2 userspace programs (such as e2fsck :-),
and some of those exact same interfaces will be used by Hurd
translators, and it will be interesting to see the legal
interpretations/contortions necessary to justify making some of these
distinctions.  :-)

> That is an important question, but for now the Hurd is GPLv2, for
> exactly that reason.  There are other significant parts of the Hurd
> taken from Linux, so we can't do a complete switch at this time.  To
> make a partial switch, we would have to address the issues you raised.
> 
> Beside the FSF' position, your position (and Remy Cards', Linus
> Torvalds' etc) matters as well, of course.

Well, the general consensus of the ext2/3/4 developers at this point
is to keep things at GPLv2.  My personal opinion matches with Linus
which is while I think that "Tivoization" in many cases will be a bad
choice from a marketing point of view (see how well Circuit City's
Divx venture fared), but it's not something that should be legislated
via the licenses.  If someone wants to use ext3 inside a locked down
device, that's fine with me, as long as I can get any improvements to
the source code back; I don't feel that it's worth it for the license
the mandate that I MUST be able to replace the running binaries inside
any embedded device.  So I don't see the Linux kernel going GPLv3 at
any time in the near future, and probably not ever.

Regards,

- Ted
-
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: [PATCH] [188/2many] MAINTAINERS - EXT4 FILE SYSTEM

2007-08-13 Thread Joe Perches
On Mon, 2007-08-13 at 11:19 -0400, Theodore Tso wrote:
> Yep, agreed.

OK. saved in my tree as

EXT4 FILE SYSTEM
P:  Ted Ts'o
M:  [EMAIL PROTECTED]
P:  Eric Sandeen
M:  [EMAIL PROTECTED]
P:  Mingming Cao
M:  [EMAIL PROTECTED]
L:  linux-ext4@vger.kernel.org
S:  Maintained
F:  fs/ext4/
F:  include/linux/ext4*

Separate question.  Is it right that the L: entries
for ext2/3/4 are all [EMAIL PROTECTED]

-
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: Future of ext2 support in the Hurd?

2007-08-13 Thread Theodore Tso
On Mon, Aug 13, 2007 at 01:27:02AM +0200, Marcus Brinkmann wrote:
> We have no intention to drop support for it.  In fact, we are very
> happy with it.  How much are we a burden for you?  If it helps, we can
> probably arrange it so that a volunteer cooperates with you if work is
> involved in keeping the support active.

As long as there are people using it, we'll keep supporting it.  If we
could drop support for HURD-specific inode fields, it would clean up a
somewhat annoying union in the filesystem data structures, but that's
a minor point.

Something that *would* be good would be to have a volunteer
periodically check to make sure that the tip of the "maint" and
"master" branches of e2fsprogs builds and passes the regression test
suite on Hurd.  This may be somewhat happenning with the GNU/Hurd
Debian project, since the latest Debian version of e2fsprogs is
1.40.2, and I assume (although I don't know for sure) that the Debian
GNU/Hurd port is tracking Debian unstable, so if there were anything
embarassing, I would have gotten a complaint.  Still, it would be good
to explicitly run the regression test suite to make sure things are
working correctly --- and if not, to send patches.

This is just to make sure e2fsprogs is working fine for the Hurd, of
course; it's not like I would drop support if you can't find a
volunteer to do this, but at the moment we do no testing on Hurd and
there is no guarantees that a particular new release will work on the
Hurd because none of the active developers have a Hurd box.  

Regards,

- Ted
-
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: [PATCH] [188/2many] MAINTAINERS - EXT4 FILE SYSTEM

2007-08-13 Thread Theodore Tso
On Mon, Aug 13, 2007 at 03:01:28AM -0600, Andreas Dilger wrote:
> >  EXT4 FILE SYSTEM
> > -P: Stephen Tweedie, Andrew Morton
> > -M: [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED]
> > +P: Stephen Tweedie
> > +M: [EMAIL PROTECTED]
> > +P: Andrew Morton
> > +M: [EMAIL PROTECTED]
> > +P: Andreas Dilger
> > +M: [EMAIL PROTECTED]
> >  L: linux-ext4@vger.kernel.org
> >  S: Maintained
> > +F: fs/ext4/
> > +F: include/linux/ext4*
> 
> To be honest, Stephen and Andrew haven't been directly involved in
> the ext4 development.  It probably makes more sense to have e.g.
> Eric Sandeen, Ted Ts'o, and MingMing Cao in their place.

Yep, agreed.

- Ted
-
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: [PATCH] ext3: fix ext34_fill_super group description initialization

2007-08-13 Thread Mariusz Kozlowski
> ->s_group_desc have to be zero filled because if sb_read() failed
> we jump to following error path.
> failed_mount2:
>   for (i = 0; i < db_count; i++)
>   brelse(sbi->s_group_desc[i]);<< Bad things may happen here
>
> Signed-off-by: Dmitry Monakhov <[EMAIL PROTECTED]>
> ---
>  fs/ext3/super.c |2 +-
>  fs/ext4/super.c |2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/ext3/super.c b/fs/ext3/super.c
> index f8ac18f..208738e 100644
> --- a/fs/ext3/super.c
> +++ b/fs/ext3/super.c
> @@ -1718,7 +1718,7 @@ static int ext3_fill_super (struct super_block *sb,
> void *data, int silent) / EXT3_BLOCKS_PER_GROUP(sb)) + 1;
>   db_count = (sbi->s_groups_count + EXT3_DESC_PER_BLOCK(sb) - 1) /
>  EXT3_DESC_PER_BLOCK(sb);
> - sbi->s_group_desc = kmalloc(db_count * sizeof (struct buffer_head *),
> + sbi->s_group_desc = kzalloc(db_count * sizeof (struct buffer_head *),
>   GFP_KERNEL);

kcalloc?

>   if (sbi->s_group_desc == NULL) {
>   printk (KERN_ERR "EXT3-fs: not enough memory\n");
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 8f1d2f6..fefffc0 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -1830,7 +1830,7 @@ static int ext4_fill_super (struct super_block *sb,
> void *data, int silent) sbi->s_groups_count = blocks_count;
>   db_count = (sbi->s_groups_count + EXT4_DESC_PER_BLOCK(sb) - 1) /
>  EXT4_DESC_PER_BLOCK(sb);
> - sbi->s_group_desc = kmalloc(db_count * sizeof (struct buffer_head *),
> + sbi->s_group_desc = kzalloc(db_count * sizeof (struct buffer_head *),
>   GFP_KERNEL);

kcalloc?

>   if (sbi->s_group_desc == NULL) {
>   printk (KERN_ERR "EXT4-fs: not enough memory\n");

Regards,

Mariusz
-
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


[kj] is_power_of_2 in ext

2007-08-13 Thread vignesh babu
Replacing n & (n - 1) for power of 2 check by is_power_of_2(n)

Signed-off-by: vignesh babu <[EMAIL PROTECTED]>
---
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 639a32c..f932c60 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include "ext2.h"
 #include "xattr.h"
@@ -804,7 +805,7 @@ static int ext2_fill_super(struct super_block *sb, void 
*data, int silent)
sbi->s_inode_size = le16_to_cpu(es->s_inode_size);
sbi->s_first_ino = le32_to_cpu(es->s_first_ino);
if ((sbi->s_inode_size < EXT2_GOOD_OLD_INODE_SIZE) ||
-   (sbi->s_inode_size & (sbi->s_inode_size - 1)) ||
+   !is_power_of_2(sbi->s_inode_size) ||
(sbi->s_inode_size > blocksize)) {
printk ("EXT2-fs: unsupported inode size: %d\n",
sbi->s_inode_size);
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 4550b83..0bfb88e 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1667,7 +1667,7 @@ static int ext4_fill_super (struct super_block *sb, void 
*data, int silent)
if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_64BIT)) {
if (sbi->s_desc_size < EXT4_MIN_DESC_SIZE_64BIT ||
sbi->s_desc_size > EXT4_MAX_DESC_SIZE ||
-   sbi->s_desc_size & (sbi->s_desc_size - 1)) {
+   !is_power_of_2(sbi->s_desc_size)) {
printk(KERN_ERR
   "EXT4-fs: unsupported descriptor size %lu\n",
   sbi->s_desc_size);

-- 
Vignesh Babu BM 
_ 
"Why is it that every time I'm with you, makes me believe in magic?"

-
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: [PATCH 00/25] move handling of setuid/gid bits from VFS into individual setattr functions (RESEND)

2007-08-13 Thread Jeff Layton
On Mon, 13 Aug 2007 08:01:34 -0400
Jeff Layton <[EMAIL PROTECTED]> wrote:

> On Sat, 11 Aug 2007 03:57:39 +0100
> Christoph Hellwig <[EMAIL PROTECTED]> wrote:
> > 
> > I like the idea of checking ia_valid after return a lot.  But instead of
> > going BUG() it should just do the default action, that we can avoid
> > touching all the filesystem and only need to change those that need
> > special care.  I also have plans to add some new AT_ flags for implementing
> > some filesystem ioctl in generic code that would benefit greatly from
> > the ia_valid checkin after return to return ENOTTY fr filesystems not
> > implementing those ioctls.
> 
> That sounds good (if I follow your meaning correctly). How about
> something like the patch below? If either ATTR_KILL bit is set after
> the setattr, try to handle them in the "standard" way with a second
> setattr call. It also does a printk in this situation to alert
> filesystem developers that they should convert to the "new" scheme,
> so they can avoid this second setattr call.
> 
> If this idea seems sound then I'll start the grunt work to fix up the
> in-tree filesystems so that they don't need the second setattr call.
> 

The earlier patch has a misplaced comma and won't build. This one
builds. This should be considered an RFC, as I've not yet done any
real testing of this patch:

Signed-off-by: Jeff Layton <[EMAIL PROTECTED]>

commit ad00450c4532da32718efe39e27d99060f04e396
Author: Jeff Layton <[EMAIL PROTECTED]>
Date:   Mon Aug 13 08:33:10 2007 -0400

VFS: move ATTR_KILL handling from notify_change into helper function

Separate the handling of the local ia_valid bitmask from the one in
attr->ia_valid. This allows us to hand off the actual handling of the
ATTR_KILL_* flags to the .setattr i_op when one is defined.

notify_change still needs to process those flags for the local ia_valid
variable, since it uses that to decide whether to return early, and to pass
a (hopefully) appropriate bitmask to fsnotify_change.

Also, check the ia_valid after the setattr op returns and see if either
ATTR_KILL_* bit is set. If so, then throw a warning and try to clear the
bits in the "standard" way. This should help us to catch filesystems that
don't handle these bits correctly without breaking them outright.

diff --git a/fs/attr.c b/fs/attr.c
index f8dfc22..9585e45 100644
--- a/fs/attr.c
+++ b/fs/attr.c
@@ -100,15 +100,53 @@ int inode_setattr(struct inode * inode, struct iattr * 
attr)
 }
 EXPORT_SYMBOL(inode_setattr);
 
+/**
+ * generic_attrkill - helper to convert ATTR_KILL_* bits into mode change
+ * @mode: current mode of inode
+ * @attr: inode attribute changes requested by VFS
+ * Context: anywhere
+ *
+ * This is a helper function to convert ATTR_KILL_SUID and ATTR_KILL_SGID
+ * into a mode change. Filesystems should call this from their setattr
+ * inode op when they want "conventional" setuid-clearing behavior.
+ *
+ * Filesystems that declare a setattr inode operation are now expected to
+ * handle the ATTR_KILL_SUID and ATTR_KILL_SGID bits appropriately. The VFS
+ * no longer automatically converts these bits to a mode change for
+ * inodes that have their own setattr operation.
+ **/
+void generic_attrkill(mode_t mode, struct iattr *attr)
+{
+   if (attr->ia_valid & ATTR_KILL_SUID) {
+   attr->ia_valid &= ~ATTR_KILL_SUID;
+   if (mode & S_ISUID) {
+   if (!(attr->ia_valid & ATTR_MODE)) {
+   attr->ia_valid |= ATTR_MODE;
+   attr->ia_mode = mode;
+   }
+   attr->ia_mode &= ~S_ISUID;
+   }
+   }
+   if (attr->ia_valid & ATTR_KILL_SGID) {
+   attr->ia_valid &= ~ATTR_KILL_SGID;
+   if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) {
+   if (!(attr->ia_valid & ATTR_MODE)) {
+   attr->ia_valid |= ATTR_MODE;
+   attr->ia_mode = mode;
+   }
+   attr->ia_mode &= ~S_ISGID;
+   }
+   }
+}
+EXPORT_SYMBOL(generic_attrkill);
+
 int notify_change(struct dentry * dentry, struct iattr * attr)
 {
struct inode *inode = dentry->d_inode;
-   mode_t mode;
-   int error;
+   int error, once = 0;
struct timespec now;
unsigned int ia_valid = attr->ia_valid;
 
-   mode = inode->i_mode;
now = current_fs_time(inode->i_sb);
 
attr->ia_ctime = now;
@@ -117,36 +155,48 @@ int notify_change(struct dentry * dentry, struct iattr * 
attr)
if (!(ia_valid & ATTR_MTIME_SET))
attr->ia_mtime = now;
if (ia_valid & ATTR_KILL_SUID) {
-   attr->ia_valid &= ~ATTR_KILL_SUID;
-   if (mode & S_ISUID) {
-   if (!(ia_valid & ATTR_MODE)) {
-   ia_valid = attr->ia_valid |= ATTR_MO

Re: [PATCH 00/25] move handling of setuid/gid bits from VFS into individual setattr functions (RESEND)

2007-08-13 Thread Jeff Layton
On Sat, 11 Aug 2007 03:57:39 +0100
Christoph Hellwig <[EMAIL PROTECTED]> wrote:
> 
> I like the idea of checking ia_valid after return a lot.  But instead of
> going BUG() it should just do the default action, that we can avoid
> touching all the filesystem and only need to change those that need
> special care.  I also have plans to add some new AT_ flags for implementing
> some filesystem ioctl in generic code that would benefit greatly from
> the ia_valid checkin after return to return ENOTTY fr filesystems not
> implementing those ioctls.

That sounds good (if I follow your meaning correctly). How about
something like the patch below? If either ATTR_KILL bit is set after
the setattr, try to handle them in the "standard" way with a second
setattr call. It also does a printk in this situation to alert
filesystem developers that they should convert to the "new" scheme,
so they can avoid this second setattr call.

If this idea seems sound then I'll start the grunt work to fix up the
in-tree filesystems so that they don't need the second setattr call.

Signed-off-by: Jeff Layton <[EMAIL PROTECTED]>

commit 521ada37ab165d9d0a12dfb59a631a2ec58a8f84
Author: Jeff Layton <[EMAIL PROTECTED]>
Date:   Mon Aug 13 07:43:56 2007 -0400

VFS: move ATTR_KILL handling from notify_change into helper function

Separate the handling of the local ia_valid bitmask from the one in
attr->ia_valid. This allows us to hand off the actual handling of the
ATTR_KILL_* flags to the .setattr i_op when one is defined.

notify_change still needs to process those flags for the local ia_valid
variable, since it uses that to decide whether to return early, and to pass
a (hopefully) appropriate bitmask to fsnotify_change.

Also, check the ia_valid after the setattr op returns and see if either
ATTR_KILL_* bit is set. If so, then throw a warning and try to clear the
bits in the "standard" way. This should help us to catch filesystems that
don't handle these bits correctly without breaking them outright.

diff --git a/fs/attr.c b/fs/attr.c
index f8dfc22..7cbb883 100644
--- a/fs/attr.c
+++ b/fs/attr.c
@@ -100,15 +100,53 @@ int inode_setattr(struct inode * inode, struct iattr * 
attr)
 }
 EXPORT_SYMBOL(inode_setattr);
 
+/**
+ * generic_attrkill - helper to convert ATTR_KILL_* bits into mode change
+ * @mode: current mode of inode
+ * @attr: inode attribute changes requested by VFS
+ * Context: anywhere
+ *
+ * This is a helper function to convert ATTR_KILL_SUID and ATTR_KILL_SGID
+ * into a mode change. Filesystems should call this from their setattr
+ * inode op when they want "conventional" setuid-clearing behavior.
+ *
+ * Filesystems that declare a setattr inode operation are now expected to
+ * handle the ATTR_KILL_SUID and ATTR_KILL_SGID bits appropriately. The VFS
+ * no longer automatically converts these bits to a mode change for
+ * inodes that have their own setattr operation.
+ **/
+void generic_attrkill(mode_t mode, struct iattr *attr)
+{
+   if (attr->ia_valid & ATTR_KILL_SUID) {
+   attr->ia_valid &= ~ATTR_KILL_SUID;
+   if (mode & S_ISUID) {
+   if (!(attr->ia_valid & ATTR_MODE)) {
+   attr->ia_valid |= ATTR_MODE;
+   attr->ia_mode = mode;
+   }
+   attr->ia_mode &= ~S_ISUID;
+   }
+   }
+   if (attr->ia_valid & ATTR_KILL_SGID) {
+   attr->ia_valid &= ~ATTR_KILL_SGID;
+   if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) {
+   if (!(attr->ia_valid & ATTR_MODE)) {
+   attr->ia_valid |= ATTR_MODE;
+   attr->ia_mode = mode;
+   }
+   attr->ia_mode &= ~S_ISGID;
+   }
+   }
+}
+EXPORT_SYMBOL(generic_attrkill);
+
 int notify_change(struct dentry * dentry, struct iattr * attr)
 {
struct inode *inode = dentry->d_inode;
-   mode_t mode;
-   int error;
+   int error, once = 0;
struct timespec now;
unsigned int ia_valid = attr->ia_valid;
 
-   mode = inode->i_mode;
now = current_fs_time(inode->i_sb);
 
attr->ia_ctime = now;
@@ -117,36 +155,48 @@ int notify_change(struct dentry * dentry, struct iattr * 
attr)
if (!(ia_valid & ATTR_MTIME_SET))
attr->ia_mtime = now;
if (ia_valid & ATTR_KILL_SUID) {
-   attr->ia_valid &= ~ATTR_KILL_SUID;
-   if (mode & S_ISUID) {
-   if (!(ia_valid & ATTR_MODE)) {
-   ia_valid = attr->ia_valid |= ATTR_MODE;
-   attr->ia_mode = inode->i_mode;
-   }
-   attr->ia_mode &= ~S_ISUID;
-   }
+   ia_valid &= ~ATTR_KILL_SUID;
+   if (inode->i_mode & S_ISUID)
+   ia_v

Re: [PATCH] [188/2many] MAINTAINERS - EXT4 FILE SYSTEM

2007-08-13 Thread Stephen C. Tweedie
Hi,

On Mon, 2007-08-13 at 03:01 -0600, Andreas Dilger wrote:

> To be honest, Stephen and Andrew haven't been directly involved in
> the ext4 development.  It probably makes more sense to have e.g.
> Eric Sandeen, Ted Ts'o, and MingMing Cao in their place.

Works for me.

--Stephen


-
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


[PATCH 3/6] e2fsprogs: Make mke2fs use undo I/O manager.

2007-08-13 Thread Aneesh Kumar K.V
When running mke2fs, if a file system is detected
on the device, we use Undo I/O manager as the io manager.
This helps in reverting the changes made to the filesystem
in case we wrongly selected the device.

The environment variable MKE2FS_SCRATCH_DIR
is used to indicate the  directory within which the tdb
file need to be created. The file will be named mke2fs-
If MKE2FS_SCRATCH_DIR is not set /var/lib/e2fsprogs is used


Signed-off-by: Aneesh Kumar K.V <[EMAIL PROTECTED]>
---
 misc/mke2fs.c |  109 -
 1 files changed, 108 insertions(+), 1 deletions(-)

diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index 0c6d4f3..3ff4b90 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -44,6 +44,7 @@ extern int optind;
 #endif
 #include 
 #include 
+#include 
 
 #include "ext2fs/ext2_fs.h"
 #include "et/com_err.h"
@@ -1521,6 +1522,102 @@ static void PRS(int argc, char *argv[])
fs_param.s_blocks_count);
 }
 
+static int filesystem_exist(const char *name)
+{
+   errcode_t retval;
+   io_channel channel;
+   __u16   s_magic;
+   struct ext2_super_block super;
+   io_manager manager = unix_io_manager;
+
+   retval = manager->open(name, IO_FLAG_EXCLUSIVE,  &channel);
+   if (retval) {
+   /*
+* We don't handle error cases instead we
+* declare that the file system doesn't exist
+* and let the rest of mke2fs take care of
+* error
+*/
+   retval = 0;
+   goto open_err_out;
+   }
+
+   io_channel_set_blksize(channel, SUPERBLOCK_OFFSET);
+   retval = io_channel_read_blk(channel, 1, -SUPERBLOCK_SIZE, &super);
+   if (retval) {
+   retval = 0;
+   goto err_out;
+   }
+
+#if defined(WORDS_BIGENDIAN)
+   s_magic = ext2fs_swab16(super.s_magic);
+#else
+   s_magic = super.s_magic;
+#endif
+
+   if (s_magic == EXT2_SUPER_MAGIC)
+   retval = 1;
+
+err_out:
+   io_channel_close(channel);
+
+open_err_out:
+
+   return retval;
+}
+
+static int mke2fs_setup_tdb(const char *name)
+{
+   errcode_t retval = 0;
+   char *tdb_dir, tdb_file[PATH_MAX];
+   char *device_name, *tmp_name;
+
+#if 0 /* FIXME!! */
+   /*
+* Configuration via a conf file would be
+* nice
+*/
+   profile_get_string(profile, "scratch_files",
+   "directory", 0, 0,
+   &tdb_dir);
+#endif
+   tmp_name = strdup(name);
+   device_name = basename(tmp_name);
+
+   tdb_dir = getenv("MKE2FS_SCRATCH_DIR");
+   if (!tdb_dir) {
+   printf(_("MKE2FS_SCRATCH_DIR not configured\n"));
+   printf(_("Using /var/lib/e2fsprogs\n"));
+   tdb_dir="/var/lib/e2fsprogs";
+   }
+   if (access(tdb_dir, W_OK)) {
+   fprintf(stderr,
+   _("Cannot create file under %s\n"),
+   tdb_dir);
+   retval = EXT2_ET_INVALID_ARGUMENT;
+   goto err_out;
+
+   }
+
+   sprintf(tdb_file, "%s/mke2fs-%s", tdb_dir, device_name);
+
+   if (!access(tdb_file, F_OK)) {
+   fprintf(stderr,
+   _("File exist %s\n"), tdb_file);
+   retval = EXT2_ET_INVALID_ARGUMENT;
+   goto err_out;
+   }
+
+   set_undo_io_backup_file(tdb_file);
+   printf(_("previous filesystem detected; to undo "
+   "the mke2fs operation, please run the "
+   "command \n'undoe2fs %s %s' in order to recover\n\n"),
+   tdb_file, name);
+err_out:
+   free(tmp_name);
+   return retval;
+}
+
 int main (int argc, char *argv[])
 {
errcode_t   retval = 0;
@@ -1543,7 +1640,17 @@ int main (int argc, char *argv[])
io_ptr = test_io_manager;
test_io_backing_manager = unix_io_manager;
 #else
-   io_ptr = unix_io_manager;
+   if (filesystem_exist(device_name)) {
+
+   io_ptr = undo_io_manager;
+   set_undo_io_backing_manager(unix_io_manager);
+   retval = mke2fs_setup_tdb(device_name);
+   if (retval)
+   exit(1);
+
+   } else {
+   io_ptr = unix_io_manager;
+   }
 #endif
 
/*
-- 
1.5.3.rc4.67.gf9286-dirty

-
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


[PATCH 5/6] e2fsprogs: Fix the resize inode test case

2007-08-13 Thread Aneesh Kumar K.V
With the new mke2fs changes the output of the
command differs if we run mke2fs on a device that
already have the file system. So erase the file system
before running mke2fs so that output remain as expected.

Signed-off-by: Aneesh Kumar K.V <[EMAIL PROTECTED]>
---
 tests/r_resize_inode/script |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/tests/r_resize_inode/script b/tests/r_resize_inode/script
index 5422d3b..c54fdf9 100644
--- a/tests/r_resize_inode/script
+++ b/tests/r_resize_inode/script
@@ -39,6 +39,8 @@ $DUMPE2FS $TMPFILE 2>&1 | sed -f $cmd_dir/filter_dumpe2fs >> 
$OUT
 
 echo "" >> $OUT
 
+dd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1
+
 echo mke2fs -q -F -O resize_inode -o Linux -b 1024 -g 1024 test.img 65536 >> 
$OUT
 $MKE2FS -q -F -O resize_inode -o Linux -b 1024 -g 1024 $TMPFILE 65536 2>&1 \
| sed -e '1d' | grep -v "automatically checked" | 
-- 
1.5.3.rc4.67.gf9286-dirty

-
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


[PATCH 2/6] e2fsprogs: Add undoe2fs

2007-08-13 Thread Aneesh Kumar K.V
undoe2fs can be used to replay the transaction saved
in the transaction file using undo I/O Manager

Signed-off-by: Aneesh Kumar K.V <[EMAIL PROTECTED]>
---
 misc/Makefile.in |   10 ++-
 misc/undoe2fs.c  |  220 ++
 2 files changed, 228 insertions(+), 2 deletions(-)
 create mode 100644 misc/undoe2fs.c

diff --git a/misc/Makefile.in b/misc/Makefile.in
index ccad78c..51bb17a 100644
--- a/misc/Makefile.in
+++ b/misc/Makefile.in
@@ -15,7 +15,7 @@ INSTALL = @INSTALL@
 @[EMAIL PROTECTED] e2image.8
 
 SPROGS=mke2fs badblocks tune2fs dumpe2fs blkid logsave \
-   $(E2IMAGE_PROG) @FSCK_PROG@ 
+   $(E2IMAGE_PROG) @FSCK_PROG@  undoe2fs
 USPROGS=   mklost+found filefrag
 SMANPAGES= tune2fs.8 mklost+found.8 mke2fs.8 dumpe2fs.8 badblocks.8 \
e2label.8 findfs.8 blkid.8 $(E2IMAGE_MAN) \
@@ -39,6 +39,7 @@ E2IMAGE_OBJS= e2image.o
 FSCK_OBJS= fsck.o base_device.o
 BLKID_OBJS=blkid.o
 FILEFRAG_OBJS= filefrag.o
+UNDOE2FS_OBJS=  undoe2fs.o
 
 XTRA_CFLAGS=   -I$(srcdir)/../e2fsck -I.
 
@@ -47,7 +48,7 @@ SRCS= $(srcdir)/tune2fs.c $(srcdir)/mklost+found.c 
$(srcdir)/mke2fs.c \
$(srcdir)/badblocks.c $(srcdir)/fsck.c $(srcdir)/util.c \
$(srcdir)/uuidgen.c $(srcdir)/blkid.c $(srcdir)/logsave.c \
$(srcdir)/filefrag.c $(srcdir)/base_device.c \
-   $(srcdir)/../e2fsck/profile.c
+   $(srcdir)/../e2fsck/profile.c $(srcdir)/undoe2fs.c
 
 LIBS= $(LIBEXT2FS) $(LIBCOM_ERR) 
 DEPLIBS= $(LIBEXT2FS) $(LIBCOM_ERR) 
@@ -108,6 +109,10 @@ e2image: $(E2IMAGE_OBJS) $(DEPLIBS)
@echo " LD $@"
@$(CC) $(ALL_LDFLAGS) -o e2image $(E2IMAGE_OBJS) $(LIBS) $(LIBINTL)
 
+undoe2fs: $(UNDOE2FS_OBJS) $(DEPLIBS)
+   @echo " LD $@"
+   @$(CC) $(ALL_LDFLAGS) -o undoe2fs $(UNDOE2FS_OBJS) $(LIBS)
+
 base_device: base_device.c
@echo " LD $@"
@$(CC) $(ALL_CFLAGS) $(ALL_LDFLAGS) $(srcdir)/base_device.c \
@@ -434,3 +439,4 @@ filefrag.o: $(srcdir)/filefrag.c
 base_device.o: $(srcdir)/base_device.c $(srcdir)/fsck.h
 profile.o: $(srcdir)/../e2fsck/profile.c $(top_srcdir)/lib/et/com_err.h \
  $(srcdir)/../e2fsck/profile.h prof_err.h
+undoe2fs.o: $(srcdir)/undoe2fs.c $(top_srcdir)/lib/ext2fs/tdb.h
diff --git a/misc/undoe2fs.c b/misc/undoe2fs.c
new file mode 100644
index 000..d675424
--- /dev/null
+++ b/misc/undoe2fs.c
@@ -0,0 +1,220 @@
+/*
+ * Copyright IBM Corporation, 2007
+ * Author Aneesh Kumar K.V <[EMAIL PROTECTED]>
+ *
+ * %Begin-Header%
+ * This file may be redistributed under the terms of the GNU Public
+ * License.
+ * %End-Header%
+ */
+
+#include 
+#include 
+#ifdef HAVE_GETOPT_H
+#include 
+#endif
+#include 
+#if HAVE_ERRNO_H
+#include 
+#endif
+#include "ext2fs/tdb.h"
+#include "ext2fs/ext2fs.h"
+#include "nls-enable.h"
+
+
+
+static void usage(char *prg_name)
+{
+   fprintf(stderr,
+   _("Usage: %s  \n"), prg_name);
+   exit(1);
+
+}
+static int check_filesystem(TDB_CONTEXT *tdb, io_channel channel)
+{
+   __u32   s_mtime;
+   __u8s_uuid[16];
+   errcode_t retval;
+   TDB_DATA tdb_key, tdb_data;
+   struct ext2_super_block super;
+
+   io_channel_set_blksize(channel, SUPERBLOCK_OFFSET);
+   retval = io_channel_read_blk(channel, 1, -SUPERBLOCK_SIZE, &super);
+   if (retval) {
+   com_err(__FUNCTION__,
+   retval, _("Failed to read the file system data \n"));
+   return retval;
+   }
+
+   tdb_key.dptr = "filesystem MTIME";
+   tdb_key.dsize = sizeof("filesystem MTIME");
+   tdb_data = tdb_fetch(tdb, tdb_key);
+   if (!tdb_data.dptr) {
+   retval = EXT2_ET_TDB_SUCCESS + tdb_error(tdb);
+   com_err(__FUNCTION__, retval,
+   _("Failed tdb_fetch %s\n"), tdb_errorstr(tdb));
+   return retval;
+   }
+
+   s_mtime = *(__u32 *)tdb_data.dptr;
+   if (super.s_mtime != s_mtime) {
+
+   com_err(__FUNCTION__, 0,
+   _("The file system Mount time didn't match %u\n"),
+   s_mtime);
+
+   return  -1;
+   }
+
+
+   tdb_key.dptr = "filesystem UUID";
+   tdb_key.dsize = sizeof("filesystem UUID");
+   tdb_data = tdb_fetch(tdb, tdb_key);
+   if (!tdb_data.dptr) {
+   retval = EXT2_ET_TDB_SUCCESS + tdb_error(tdb);
+   com_err(__FUNCTION__, retval,
+   _("Failed tdb_fetch %s\n"), tdb_errorstr(tdb));
+   return retval;
+   }
+   memcpy(s_uuid, tdb_data.dptr, sizeof(s_uuid));
+   if (memcmp(s_uuid, super.s_uuid, sizeof(s_uuid))) {
+   com_err(__FUNCTION__, 0,
+   _("The file system UUID didn't match \n"));
+   return -1;
+   }
+
+   return 0;
+}
+
+static int set_blk_size(TDB_CONTEXT *tdb, io_channel channel)
+{
+   int block_size;
+   errc

e2fsprogs patches

2007-08-13 Thread Aneesh Kumar K.V

The series is on top of f1f115a78f5ea599fc5f8815a741d43fedd5840d


-
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


[PATCH 6/6] e2fsprogs: Add test case for undoe2fs

2007-08-13 Thread Aneesh Kumar K.V
This adds two test case for undoe2fs.

Signed-off-by: Aneesh Kumar K.V <[EMAIL PROTECTED]>
---
 tests/test_config   |1 +
 tests/u_undoe2fs_mke2fs/script  |   31 +++
 tests/u_undoe2fs_tune2fs/script |   31 +++
 3 files changed, 63 insertions(+), 0 deletions(-)
 create mode 100644 tests/u_undoe2fs_mke2fs/script
 create mode 100644 tests/u_undoe2fs_tune2fs/script

diff --git a/tests/test_config b/tests/test_config
index f5ae0fe..f79ec79 100644
--- a/tests/test_config
+++ b/tests/test_config
@@ -13,6 +13,7 @@ DEBUGFS="$USE_VALGRIND ../debugfs/debugfs"
 TEST_BITS="../debugfs/debugfs"
 RESIZE2FS_EXE="../resize/resize2fs"
 RESIZE2FS="$USE_VALGRIND $RESIZE2FS_EXE"
+UNDOE2FS_EXE="../misc/undoe2fs"
 TEST_REL=../tests/progs/test_rel
 TEST_ICOUNT=../tests/progs/test_icount
 LD_LIBRARY_PATH=../lib:../lib/ext2fs:../lib/e2p:../lib/et:../lib/ss
diff --git a/tests/u_undoe2fs_mke2fs/script b/tests/u_undoe2fs_mke2fs/script
new file mode 100644
index 000..82ee6b3
--- /dev/null
+++ b/tests/u_undoe2fs_mke2fs/script
@@ -0,0 +1,31 @@
+printf "undoe2fs with mke2fs: "
+if test -x $UNDOE2FS_EXE; then
+
+export MKE2FS_SCRATCH_DIR=./
+TDB_FILE=./mke2fs-test.img
+OUT=$test_name.log
+rm -f $TDB_FILE >/dev/null 2>&1
+
+dd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1
+
+echo mke2fs -q -F -o Linux -b 1024 test.img  > $OUT
+$MKE2FS -q -F -o Linux -I 128 -b 1024 $TMPFILE  >/dev/null 2>&1
+md5=$(md5sum $TMPFILE | cut -d " " -f 1)
+echo md5sum before mke2fs $md5 >> $OUT
+
+echo using mke2fs to test undoe2fs >> $OUT
+$MKE2FS -q -F -o Linux -I 256 -b 1024 $TMPFILE  >/dev/null 2>&1
+new_md5=$(md5sum $TMPFILE | cut -d " " -f 1)
+echo md5sum after mke2fs $new_md5 >> $OUT
+
+$UNDOE2FS_EXE  $TDB_FILE $TMPFILE  >/dev/null 2>&1
+new_md5=$(md5sum $TMPFILE | cut -d " " -f 1)
+echo md5sum after undoe2fs $new_md5 >> $OUT
+
+if [ $md5 = $new_md5 ]; then
+   echo "ok"
+   touch $test_name.ok
+else
+   echo "failed"
+fi
+fi
diff --git a/tests/u_undoe2fs_tune2fs/script b/tests/u_undoe2fs_tune2fs/script
new file mode 100644
index 000..d01628d
--- /dev/null
+++ b/tests/u_undoe2fs_tune2fs/script
@@ -0,0 +1,31 @@
+printf "undoe2fs with tune2fs: "
+if test -x $UNDOE2FS_EXE; then
+
+export TUNE2FS_SCRATCH_DIR=./
+TDB_FILE=./tune2fs-test.img
+OUT=$test_name.log
+rm -f $TDB_FILE >/dev/null 2>&1
+
+dd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1
+
+echo mke2fs -q -F -o Linux -b 1024 test.img  >> $OUT
+$MKE2FS -q -F -o Linux -I 128 -b 1024 $TMPFILE  >/dev/null 2>&1
+md5=$(md5sum $TMPFILE | cut -d " " -f 1)
+echo md5sum before tune2fs $md5 >> $OUT
+
+echo using tune2fs to test undoe2fs >> $OUT
+$TUNE2FS -I 256 $TMPFILE  >/dev/null 2>&1
+new_md5=$(md5sum $TMPFILE | cut -d " " -f 1)
+echo md5sum after tune2fs $new_md5 >> $OUT
+
+$UNDOE2FS_EXE  $TDB_FILE $TMPFILE  >/dev/null 2>&1
+new_md5=$(md5sum $TMPFILE | cut -d " " -f 1)
+echo md5sum after undoe2fs $new_md5 >> $OUT
+
+if [ $md5 = $new_md5 ]; then
+   echo "ok"
+   touch $test_name.ok
+else
+   echo "failed"
+fi
+fi
-- 
1.5.3.rc4.67.gf9286-dirty

-
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


[PATCH 4/6] e2fsprogs: Support for large inode migration.

2007-08-13 Thread Aneesh Kumar K.V
Add new option -I  to tune2fs.
This is used to change the inode size. The size
need to be multiple of 2 and we don't allow to
decrease the inode size.

As a part of increasing the inode size we increase the
inode table size. We also move the used data blocks around
and update the respective inodes to point to the new block


tune2fs use undo I/O manager when migrating to large
inode. This helps in reverting the changes if end results
are not correct.The environment variable TUNE2FS_SCRATCH_DIR
is used to indicate the  directory within which the tdb
file need to be created. The file will be named tune2fs-
If TUNE2FS_SCRATCH_DIR is not set /var/lib/e2fsprogs is used

Signed-off-by: Aneesh Kumar K.V <[EMAIL PROTECTED]>
---
 misc/tune2fs.c |  535 +++-
 1 files changed, 532 insertions(+), 3 deletions(-)

diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index 833b994..88842a2 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -42,6 +42,7 @@ extern int optind;
 #include 
 #include 
 #include 
+#include 
 
 #include "ext2fs/ext2_fs.h"
 #include "ext2fs/ext2fs.h"
@@ -61,6 +62,7 @@ char * new_label, *new_last_mounted, *new_UUID;
 char * io_options;
 static int c_flag, C_flag, e_flag, f_flag, g_flag, i_flag, l_flag, L_flag;
 static int m_flag, M_flag, r_flag, s_flag = -1, u_flag, U_flag, T_flag;
+static int I_flag;
 static time_t last_check_time;
 static int print_label;
 static int max_mount_count, mount_count, mount_flags;
@@ -71,10 +73,20 @@ static unsigned short errors;
 static int open_flag;
 static char *features_cmd;
 static char *mntopts_cmd;
+static unsigned long int new_inode_size;
 
 int journal_size, journal_flags;
 char *journal_device;
 
+static struct list_head blk_move_list;
+
+struct blk_move {
+   struct list_head list;
+   blk_t old_loc;
+   blk_t new_loc;
+};
+
+
 static const char *please_fsck = N_("Please run e2fsck on the filesystem.\n");
 
 void do_findfs(int argc, char **argv);
@@ -89,7 +101,8 @@ static void usage(void)
  "\t[-o [^]mount_options[,...]] [-r reserved_blocks_count]\n"
  "\t[-u user] [-C mount_count] [-L volume_label] "
  "[-M last_mounted_dir]\n"
- "\t[-O [^]feature[,...]] [-T last_check_time] [-U UUID]"
+ "\t[-O [^]feature[,...]] [-T last_check_time] [-U UUID]\n"
+ "\t[ -I new_inode_size ]"
  " device\n"), program_name);
exit (1);
 }
@@ -505,7 +518,7 @@ static void parse_tune2fs_options(int argc, char **argv)
struct passwd * pw;
 
printf("tune2fs %s (%s)\n", E2FSPROGS_VERSION, E2FSPROGS_DATE);
-   while ((c = getopt(argc, argv, "c:e:fg:i:jlm:o:r:s:u:C:J:L:M:O:T:U:")) 
!= EOF)
+   while ((c = getopt(argc, argv, 
"c:e:fg:i:jlm:o:r:s:u:C:J:L:M:O:T:U:I:")) != EOF)
switch (c)
{
case 'c':
@@ -702,6 +715,25 @@ static void parse_tune2fs_options(int argc, char **argv)
open_flag = EXT2_FLAG_RW |
EXT2_FLAG_JOURNAL_DEV_OK;
break;
+   case 'I':
+   new_inode_size = strtoul (optarg, &tmp, 0);
+   if (*tmp) {
+   com_err (program_name, 0,
+   _("bad Inode size - %s"),
+   optarg);
+   usage();
+   }
+   if (!((new_inode_size &
+   (new_inode_size - 1)) == 0)) {
+   com_err (program_name, 0,
+   _("Inode size must be a "
+   "power of two- %s"),
+   optarg);
+   usage();
+   }
+   open_flag = EXT2_FLAG_RW;
+   I_flag = 1;
+   break;
default:
usage();
}
@@ -739,6 +771,469 @@ void do_findfs(int argc, char **argv)
exit(0);
 }
 
+static int get_move_bitmap(ext2_filsys fs, int new_ino_blks_per_grp,
+   ext2fs_block_bitmap bmap)
+{
+   dgrp_t i;
+   blk_t j, needed_blocks = 0;
+   blk_t start_blk, end_blk;
+
+   for (i = 0; i < fs->group_desc_count; i++) {
+
+   start_blk = fs->group_desc[i].bg_inode_table +
+   fs->inode_blocks_per_group;
+
+   end_blk = fs->group_desc[i].bg_inode_table +
+   new_ino_blks_per_grp;
+
+   for (j = start_blk; j < end_bl

[PATCH 1/6] e2fsprogs: Add undo I/O manager

2007-08-13 Thread Aneesh Kumar K.V
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.

The call sequence involve

set_undo_io_backing_manager(unix_io_manager);
set_undo_io_backup_file("/tmp/test.tdb");
retval = ext2fs_open2(dev_name, 0, flags,
superblock, block_size, undo_io_manager,
¤t_fs);

Signed-off-by: Aneesh Kumar K.V <[EMAIL PROTECTED]>
---
 lib/ext2fs/Makefile.in |7 +-
 lib/ext2fs/ext2_io.h   |5 +
 lib/ext2fs/undo_io.c   |  574 
 3 files changed, 584 insertions(+), 2 deletions(-)
 create mode 100644 lib/ext2fs/undo_io.c

diff --git a/lib/ext2fs/Makefile.in b/lib/ext2fs/Makefile.in
index 70e18e7..7afd5eb 100644
--- a/lib/ext2fs/Makefile.in
+++ b/lib/ext2fs/Makefile.in
@@ -66,7 +66,8 @@ OBJS= $(DEBUGFS_LIB_OBJS) $(RESIZE_LIB_OBJS) 
$(E2IMAGE_LIB_OBJS) \
unix_io.o \
unlink.o \
valid_blk.o \
-   version.o
+   version.o \
+   undo_io.o
 
 SRCS= ext2_err.c \
$(srcdir)/alloc.c \
@@ -132,7 +133,8 @@ SRCS= ext2_err.c \
$(srcdir)/tst_bitops.c \
$(srcdir)/tst_byteswap.c \
$(srcdir)/tst_getsize.c \
-   $(srcdir)/tst_iscan.c
+   $(srcdir)/tst_iscan.c \
+   $(srcdir)/undo_io.c
 
 HFILES= bitops.h ext2fs.h ext2_io.h ext2_fs.h ext2_ext_attr.h ext3_extents.h \
tdb.h
@@ -573,3 +575,4 @@ tst_iscan.o: $(srcdir)/tst_iscan.c $(srcdir)/ext2_fs.h \
  $(top_builddir)/lib/ext2fs/ext2_types.h $(srcdir)/ext2fs.h \
  $(srcdir)/ext2_fs.h $(srcdir)/ext3_extents.h $(top_srcdir)/lib/et/com_err.h \
  $(srcdir)/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/bitops.h
+undo_io.o: $(srcdir)/undo_io.c $(srcdir)/ext2_fs.h $(srcdir)/ext2fs.h
diff --git a/lib/ext2fs/ext2_io.h b/lib/ext2fs/ext2_io.h
index eada278..476eb4d 100644
--- a/lib/ext2fs/ext2_io.h
+++ b/lib/ext2fs/ext2_io.h
@@ -96,6 +96,11 @@ extern errcode_t io_channel_write_byte(io_channel channel,
 /* unix_io.c */
 extern io_manager unix_io_manager;
 
+/* undo_io.c */
+extern io_manager undo_io_manager;
+extern errcode_t set_undo_io_backing_manager(io_manager manager);
+extern errcode_t set_undo_io_backup_file(char *file_name);
+
 /* test_io.c */
 extern io_manager test_io_manager, test_io_backing_manager;
 extern void (*test_io_cb_read_blk)
diff --git a/lib/ext2fs/undo_io.c b/lib/ext2fs/undo_io.c
new file mode 100644
index 000..0488294
--- /dev/null
+++ b/lib/ext2fs/undo_io.c
@@ -0,0 +1,574 @@
+/*
+ * undo_io.c --- This is the undo io manager that copies the old data that
+ * copies the old data being overwritten into a tdb database
+ *
+ * Copyright IBM Corporation, 2007
+ * Author Aneesh Kumar K.V <[EMAIL PROTECTED]>
+ *
+ * %Begin-Header%
+ * This file may be redistributed under the terms of the GNU Public
+ * License.
+ * %End-Header%
+ */
+
+#define _LARGEFILE_SOURCE
+#define _LARGEFILE64_SOURCE
+
+#include 
+#include 
+#if HAVE_UNISTD_H
+#include 
+#endif
+#if HAVE_ERRNO_H
+#include 
+#endif
+#include 
+#include 
+#ifdef __linux__
+#include 
+#endif
+#if HAVE_SYS_STAT_H
+#include 
+#endif
+#if HAVE_SYS_TYPES_H
+#include 
+#endif
+#if HAVE_SYS_RESOURCE_H
+#include 
+#endif
+
+#include "tdb.h"
+
+#include "ext2_fs.h"
+#include "ext2fs.h"
+
+/*
+ * For checking structure magic numbers...
+ */
+
+#define EXT2_CHECK_MAGIC(struct, code) \
+ if ((struct)->magic != (code)) return (code)
+
+
+
+struct undo_private_data {
+   int magic;
+   TDB_CONTEXT *tdb;
+   char *tdb_file;
+
+   /* The backing io channel */
+   io_channel real;
+
+   /* to support offset in unix I/O manager */
+   ext2_loff_t offset;
+};
+
+static errcode_t undo_open(const char *name, int flags, io_channel *channel);
+static errcode_t undo_close(io_channel channel);
+static errcode_t undo_set_blksize(io_channel channel, int blksize);
+static errcode_t undo_read_blk(io_channel channel, unsigned long block,
+  int count, void *data);
+static errcode_t undo_write_blk(io_channel channel, unsigned long block,
+   int count, const void *data);
+static errcode_t undo_flush(io_channel channel);
+static errcode_t undo_write_byte(io_channel channel, unsigned long offset,
+   int size, const void *data);
+static errcode_t undo_set_option(io_channel channel, const char *option,
+const char *arg);
+
+static struct struct_io_manager struct_undo_manager = {
+   EXT2_ET_MAGIC_IO_MANAGER,
+   "Undo I/O Manager",
+   undo_open,
+   undo_close,
+   undo_set_blksize,
+   undo_read_blk,
+   undo_write_blk,
+   undo_flush,
+   undo_write_byte,
+   undo_set_option
+};
+
+io_manager undo_io_manager = &struct_undo_manager;
+static io_manager undo_io_backing_manager ;
+static  char *tdb_file ;
+static int tdb_data_size = 0;
+
+errcode_t set_undo_io_backing_manager(io_manager manager)
+{
+   /

[PATCH 1/4] Add some new function for searching extent tree.

2007-08-13 Thread Aneesh Kumar K.V
From: Alex Tomas <[EMAIL PROTECTED]>

ext4_ext_search_left
ext4_ext_search_right
---
 fs/ext4/extents.c   |  142 +++
 include/linux/ext4_fs_extents.h |2 +
 2 files changed, 144 insertions(+), 0 deletions(-)

diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 78beb09..3084e09 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -1015,6 +1015,148 @@ out:
 }
 
 /*
+ * search the closest allocated block to the left for *logical
+ * and returns it at @logical + it's physical address at @phys
+ * if *logical is the smallest allocated block, the function
+ * returns 0 at @phys
+ * return value contains 0 (success) or error code
+ */
+int
+ext4_ext_search_left(struct inode *inode, struct ext4_ext_path *path,
+   ext4_fsblk_t *logical, ext4_fsblk_t *phys)
+{
+   struct ext4_extent_idx *ix;
+   struct ext4_extent *ex;
+   int depth;
+
+   BUG_ON(path == NULL);
+   depth = path->p_depth;
+   *phys = 0;
+
+   if (depth == 0 && path->p_ext == NULL)
+   return 0;
+
+   /* usually extent in the path covers blocks smaller
+* then *logical, but it can be that extent is the
+* first one in the file */
+
+   ex = path[depth].p_ext;
+   if (*logical < le32_to_cpu(ex->ee_block)) {
+   BUG_ON(EXT_FIRST_EXTENT(path[depth].p_hdr) != ex);
+   while (--depth >= 0) {
+   ix = path[depth].p_idx;
+   BUG_ON(ix != EXT_FIRST_INDEX(path[depth].p_hdr));
+   }
+   return 0;
+   }
+
+   BUG_ON(*logical < le32_to_cpu(ex->ee_block) + le16_to_cpu(ex->ee_len));
+
+   *logical = le32_to_cpu(ex->ee_block) + le16_to_cpu(ex->ee_len) - 1;
+   *phys = ext_pblock(ex) + le16_to_cpu(ex->ee_len) - 1;
+   return 0;
+}
+
+/*
+ * search the closest allocated block to the right for *logical
+ * and returns it at @logical + it's physical address at @phys
+ * if *logical is the smallest allocated block, the function
+ * returns 0 at @phys
+ * return value contains 0 (success) or error code
+ */
+int
+ext4_ext_search_right(struct inode *inode, struct ext4_ext_path *path,
+   ext4_fsblk_t *logical, ext4_fsblk_t *phys)
+{
+   struct buffer_head *bh = NULL;
+   struct ext4_extent_header *eh;
+   struct ext4_extent_idx *ix;
+   struct ext4_extent *ex;
+   ext4_fsblk_t block;
+   int depth;
+
+   BUG_ON(path == NULL);
+   depth = path->p_depth;
+   *phys = 0;
+
+   if (depth == 0 && path->p_ext == NULL)
+   return 0;
+
+   /* usually extent in the path covers blocks smaller
+* then *logical, but it can be that extent is the
+* first one in the file */
+
+   ex = path[depth].p_ext;
+   if (*logical < le32_to_cpu(ex->ee_block)) {
+   BUG_ON(EXT_FIRST_EXTENT(path[depth].p_hdr) != ex);
+   while (--depth >= 0) {
+   ix = path[depth].p_idx;
+   BUG_ON(ix != EXT_FIRST_INDEX(path[depth].p_hdr));
+   }
+   *logical = le32_to_cpu(ex->ee_block);
+   *phys = ext_pblock(ex);
+   return 0;
+   }
+
+   BUG_ON(*logical < le32_to_cpu(ex->ee_block) + le16_to_cpu(ex->ee_len));
+
+   if (ex != EXT_LAST_EXTENT(path[depth].p_hdr)) {
+   /* next allocated block in this leaf */
+   ex++;
+   *logical = le32_to_cpu(ex->ee_block);
+   *phys = ext_pblock(ex);
+   return 0;
+   }
+
+   /* go up and search for index to the right */
+   while (--depth >= 0) {
+   ix = path[depth].p_idx;
+   if (ix != EXT_LAST_INDEX(path[depth].p_hdr))
+   break;
+   }
+
+   if (depth < 0) {
+   /* we've gone up to the root and
+* found no index to the right */
+   return 0;
+   }
+
+   /* we've found index to the right, let's
+* follow it and find the closest allocated
+* block to the right */
+   ix++;
+   block = idx_pblock(ix);
+   while (++depth < path->p_depth) {
+   bh = sb_bread(inode->i_sb, block);
+   if (bh == NULL)
+   return -EIO;
+   eh = ext_block_hdr(bh);
+   if (ext4_ext_check_header(inode, eh, depth)) {
+   brelse(bh);
+   return -EIO;
+   }
+   ix = EXT_FIRST_INDEX(eh);
+   block = idx_pblock(ix);
+   brelse(bh);
+   }
+
+   bh = sb_bread(inode->i_sb, block);
+   if (bh == NULL)
+   return -EIO;
+   eh = ext_block_hdr(bh);
+   if (ext4_ext_check_header(inode, eh, depth)) {
+   brelse(bh);
+   return -EIO;
+   }
+   ex = EXT_FIRST_EXTENT(eh);
+   *logical = le32_to_cpu(ex->ee_block);
+   *phys = ext_p

[PATCH 4/4] Fixes to make it build and run

2007-08-13 Thread Aneesh Kumar K.V
---
 fs/ext4/balloc.c|   37 +++---
 fs/ext4/extents.c   |7 +--
 fs/ext4/mballoc.c   |   96 ++
 include/linux/ext4_fs.h |   19 +
 4 files changed, 74 insertions(+), 85 deletions(-)

diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index 55f4be8..012c721 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -626,7 +626,7 @@ void ext4_free_blocks(handle_t *handle, struct inode *inode,
int metadata)
 {
struct super_block * sb;
-   int freed;
+   unsigned long dquot_freed_blocks;
 
/* this isn't the right place to decide whether block is metadata
 * inode.c/extents.c knows better, but for safety ... */
@@ -637,11 +637,13 @@ void ext4_free_blocks(handle_t *handle, struct inode 
*inode,
sb = inode->i_sb;
 
if (!test_opt(sb, MBALLOC) || !EXT4_SB(sb)->s_group_info)
-   ext4_free_blocks_sb(handle, sb, block, count, &freed);
+   ext4_free_blocks_sb(handle, sb, block, count,
+   &dquot_freed_blocks);
else
-   ext4_mb_free_blocks(handle, inode, block, count, metadata, 
&freed);
-   if (freed)
-   DQUOT_FREE_BLOCK(inode, freed);
+   ext4_mb_free_blocks(handle, inode, block, count,
+   metadata, &dquot_freed_blocks);
+   if (dquot_freed_blocks)
+   DQUOT_FREE_BLOCK(inode, dquot_freed_blocks);
return;
 }
 
@@ -1417,7 +1419,7 @@ int ext4_should_retry_alloc(struct super_block *sb, int 
*retries)
 }
 
 /**
- * ext4_new_blocks() -- core block(s) allocation function
+ * ext4_new_blocks_old() -- core block(s) allocation function
  * @handle:handle to this transaction
  * @inode: file inode
  * @goal:  given target block(filesystem wide)
@@ -1715,9 +1717,32 @@ ext4_fsblk_t ext4_new_block(handle_t *handle, struct 
inode *inode,
return ret;
 }
 
+ext4_fsblk_t ext4_new_blocks(handle_t *handle, struct inode *inode,
+   ext4_fsblk_t goal, unsigned long *count, int *errp)
+{
+   struct ext4_allocation_request ar;
+   ext4_fsblk_t ret;
 
+   if (!test_opt(inode->i_sb, MBALLOC)) {
+   ret = ext4_new_blocks_old(handle, inode, goal, count, errp);
+   return ret;
+   }
+
+   ar.inode = inode;
+   ar.goal = goal;
+   ar.len = *count;
+   ar.logical = 0;
+   ar.lleft = 0;
+   ar.pleft = 0;
+   ar.lright = 0;
+   ar.pright = 0;
+   ar.flags = 0;
+   ret = ext4_mb_new_blocks(handle, &ar, errp);
+   *count = ar.len;
+   return ret;
 }
 
+
 /**
  * ext4_count_free_blocks() -- count filesystem free blocks
  * @sb:superblock
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 8d163d7..392286f 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -1863,7 +1863,7 @@ static int ext4_remove_blocks(handle_t *handle, struct 
inode *inode,
unsigned short ee_len =  ext4_ext_get_actual_len(ex);
int i, metadata = 0;
 
-   if (S_ISDIR(tree->inode->i_mode) || S_ISLNK(tree->inode->i_mode))
+   if (S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode))
metadata = 1;
 #ifdef EXTENTS_STATS
{
@@ -2496,14 +2496,13 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode 
*inode,
 
/* find neighbour allocated blocks */
ar.lleft = iblock;
-   err = ext4_ext_search_left(&tree, path, &ar.lleft, &ar.pleft);
+   err = ext4_ext_search_left(inode, path, &ar.lleft, &ar.pleft);
if (err)
goto out2;
ar.lright = iblock;
-   err = ext4_ext_search_right(&tree, path, &ar.lright, &ar.pright);
+   err = ext4_ext_search_right(inode, path, &ar.lright, &ar.pright);
if (err)
goto out2;
-   /* FIXME!! allocated is updated with resepec to ar.pright */
 
/*
 * See if request is beyond maximum number of blocks we can have in
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 5fe758e..a28ba0c 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -24,7 +24,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -303,7 +303,7 @@
  */
 #define MB_DEFAULT_STRIPE  256
 
-static kmem_cache_t *ext4_pspace_cachep = NULL;
+static struct kmem_cache *ext4_pspace_cachep = NULL;
 
 #ifdef EXT4_BB_MAX_BLOCKS
 #undef EXT4_BB_MAX_BLOCKS
@@ -361,7 +361,7 @@ struct ext4_prealloc_space {
 
 struct ext4_free_extent {
unsigned long fe_logical;
-   unsigned long fe_start;
+   ext4_grpblk_t fe_start;
unsigned long fe_group;
unsigned long fe_len;
 };
@@ -458,8 +458,8 @@ static struct proc_dir_entry *proc_root_ext4;
 
 int ext4_create (struct inode *, struct dentry *, int, struct nameidata *);
 struct buffer_head * read_block_bitmap(struct super_block *, unsigned int);
-uns

[PATCH 3/4] This is the equivalent of ext3-mballoc3-sles10.patch

2007-08-13 Thread Aneesh Kumar K.V
---
 fs/ext4/Makefile  |2 +-
 fs/ext4/balloc.c  |   58 ++---
 fs/ext4/extents.c |   44 +++---
 fs/ext4/inode.c   |   14 +-
 fs/ext4/super.c   |   18 ++
 fs/ext4/xattr.c   |4 +-
 include/linux/ext4_fs.h   |1 +
 include/linux/ext4_fs_i.h |4 +++
 8 files changed, 112 insertions(+), 33 deletions(-)

diff --git a/fs/ext4/Makefile b/fs/ext4/Makefile
index ae6e7e5..c7801ab 100644
--- a/fs/ext4/Makefile
+++ b/fs/ext4/Makefile
@@ -6,7 +6,7 @@ obj-$(CONFIG_EXT4DEV_FS) += ext4dev.o
 
 ext4dev-y  := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o \
   ioctl.o namei.o super.o symlink.o hash.o resize.o extents.o \
-  ext4_jbd2.o
+  ext4_jbd2.o mballoc.o
 
 ext4dev-$(CONFIG_EXT4DEV_FS_XATTR) += xattr.o xattr_user.o xattr_trusted.o
 ext4dev-$(CONFIG_EXT4DEV_FS_POSIX_ACL) += acl.o
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index e53b4af..55f4be8 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -110,7 +110,7 @@ struct ext4_group_desc * ext4_get_group_desc(struct 
super_block * sb,
  *
  * Return buffer_head on success or NULL in case of failure.
  */
-static struct buffer_head *
+struct buffer_head *
 read_block_bitmap(struct super_block *sb, unsigned int block_group)
 {
struct ext4_group_desc * desc;
@@ -412,6 +412,8 @@ void ext4_discard_reservation(struct inode *inode)
struct ext4_reserve_window_node *rsv;
spinlock_t *rsv_lock = &EXT4_SB(inode->i_sb)->s_rsv_window_lock;
 
+   ext4_mb_discard_inode_preallocations(inode);
+
if (!block_i)
return;
 
@@ -617,21 +619,29 @@ error_return:
  * @inode: inode
  * @block: start physical block to free
  * @count: number of blocks to count
+ * @metadata:  Are these metadata blocks
  */
 void ext4_free_blocks(handle_t *handle, struct inode *inode,
-   ext4_fsblk_t block, unsigned long count)
+   ext4_fsblk_t block, unsigned long count,
+   int metadata)
 {
struct super_block * sb;
-   unsigned long dquot_freed_blocks;
+   int freed;
+
+   /* this isn't the right place to decide whether block is metadata
+* inode.c/extents.c knows better, but for safety ... */
+   if (S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode) ||
+   ext4_should_journal_data(inode))
+   metadata = 1;
 
sb = inode->i_sb;
-   if (!sb) {
-   printk ("ext4_free_blocks: nonexistent device");
-   return;
-   }
-   ext4_free_blocks_sb(handle, sb, block, count, &dquot_freed_blocks);
-   if (dquot_freed_blocks)
-   DQUOT_FREE_BLOCK(inode, dquot_freed_blocks);
+
+   if (!test_opt(sb, MBALLOC) || !EXT4_SB(sb)->s_group_info)
+   ext4_free_blocks_sb(handle, sb, block, count, &freed);
+   else
+   ext4_mb_free_blocks(handle, inode, block, count, metadata, 
&freed);
+   if (freed)
+   DQUOT_FREE_BLOCK(inode, freed);
return;
 }
 
@@ -1420,7 +1430,7 @@ int ext4_should_retry_alloc(struct super_block *sb, int 
*retries)
  * any specific goal block.
  *
  */
-ext4_fsblk_t ext4_new_blocks(handle_t *handle, struct inode *inode,
+ext4_fsblk_t ext4_new_blocks_old(handle_t *handle, struct inode *inode,
ext4_fsblk_t goal, unsigned long *count, int *errp)
 {
struct buffer_head *bitmap_bh = NULL;
@@ -1681,11 +1691,31 @@ out:
 }
 
 ext4_fsblk_t ext4_new_block(handle_t *handle, struct inode *inode,
-   ext4_fsblk_t goal, int *errp)
+   ext4_fsblk_t goal, int *errp)
 {
-   unsigned long count = 1;
+   struct ext4_allocation_request ar;
+   ext4_fsblk_t ret;
+
+   if (!test_opt(inode->i_sb, MBALLOC)) {
+   unsigned long count = 1;
+   ret = ext4_new_blocks_old(handle, inode, goal, &count, errp);
+   return ret;
+   }
+
+   ar.inode = inode;
+   ar.goal = goal;
+   ar.len = 1;
+   ar.logical = 0;
+   ar.lleft = 0;
+   ar.pleft = 0;
+   ar.lright = 0;
+   ar.pright = 0;
+   ar.flags = 0;
+   ret = ext4_mb_new_blocks(handle, &ar, errp);
+   return ret;
+}
+
 
-   return ext4_new_blocks(handle, inode, goal, &count, errp);
 }
 
 /**
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 3084e09..8d163d7 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -851,7 +851,7 @@ cleanup:
for (i = 0; i < depth; i++) {
if (!ablocks[i])
continue;
-   ext4_free_blocks(handle, inode, ablocks[i], 1);
+   ext4_free_blocks(handle, inode, ablocks[i], 1, 1);
}
}
kfree(ablocks);
@@ -1800,7 +1800,7 @@ i

[RFC] mballoc patches

2007-08-13 Thread Aneesh Kumar K.V

Alex actually pointed me the new mballoc patches at
ftp://ftp.clusterfs.com/pub/people/alex/mballoc3

The series is the forward port of the same on top of
d4ac2477fad0f2680e84ec12e387ce67682c5c13 (v2.6.23-rc2)


I guess the mballoc3 patch at clusterfs.com is based on
a patched ext3(I guess it is ext3 + extent tree local to
clusterfs ? ). The following series is based on ext4.


I tested the changes with different blocks per group
combination and it seems to be working fine. (The last
series did panic with mke2fs -g 800 )


I will now look at splitting this to smaller patches.

NOTE : I am not sure whether patch 2 will be able to make the list.
if not is there a place i can ftp/scp them so that others can access
the same ?

I haven't split the patches in any order and didn't bothered to
write any meaningful commit messages since this is mostly work in
progress.

-aneesh


-
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: [PATCH] ext3: fix ext34_fill_super group description initialization

2007-08-13 Thread Aneesh Kumar K.V



Dmitry Monakhov wrote:

->s_group_desc have to be zero filled because if sb_read() failed
we jump to following error path.
failed_mount2:
for (i = 0; i < db_count; i++)
brelse(sbi->s_group_desc[i]);<< Bad things may happen here




But the db_count is updated in the failure path to point to the number
of successful sb_read. 


-aneesh
-
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: [PATCH] [187/2many] MAINTAINERS - EXT3 FILE SYSTEM

2007-08-13 Thread Andreas Dilger
On Aug 13, 2007  02:59 -0600, Andreas Dilger wrote:
> >  EXT3 FILE SYSTEM
> 
> You may as well have fs/jbd/* and include/linux/jbd.h for ext3.

Ignore this, there is a separate section for that already...

Cheers, Andreas
--
Andreas Dilger
Principal Software Engineer
Cluster File Systems, Inc.

-
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: [PATCH] ext3: fix ext34_fill_super group description initialization

2007-08-13 Thread Dmitry Monakhov
On 13:09 Mon 13 Aug , Dmitry Monakhov wrote:
> ->s_group_desc have to be zero filled because if sb_read() failed
> we jump to following error path.
> failed_mount2:
>   for (i = 0; i < db_count; i++)
>   brelse(sbi->s_group_desc[i]);<< Bad things may happen here
OOPs i'm sorry. I've lost db_count changing after sb_read() error,
so error path is ok, and this patch is not needed.
> 
> Signed-off-by: Dmitry Monakhov <[EMAIL PROTECTED]>
> ---
>  fs/ext3/super.c |2 +-
>  fs/ext4/super.c |2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/ext3/super.c b/fs/ext3/super.c
> index f8ac18f..208738e 100644
> --- a/fs/ext3/super.c
> +++ b/fs/ext3/super.c
> @@ -1718,7 +1718,7 @@ static int ext3_fill_super (struct super_block *sb, 
> void *data, int silent)
>  / EXT3_BLOCKS_PER_GROUP(sb)) + 1;
>   db_count = (sbi->s_groups_count + EXT3_DESC_PER_BLOCK(sb) - 1) /
>  EXT3_DESC_PER_BLOCK(sb);
> - sbi->s_group_desc = kmalloc(db_count * sizeof (struct buffer_head *),
> + sbi->s_group_desc = kzalloc(db_count * sizeof (struct buffer_head *),
>   GFP_KERNEL);
>   if (sbi->s_group_desc == NULL) {
>   printk (KERN_ERR "EXT3-fs: not enough memory\n");
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 8f1d2f6..fefffc0 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -1830,7 +1830,7 @@ static int ext4_fill_super (struct super_block *sb, 
> void *data, int silent)
>   sbi->s_groups_count = blocks_count;
>   db_count = (sbi->s_groups_count + EXT4_DESC_PER_BLOCK(sb) - 1) /
>  EXT4_DESC_PER_BLOCK(sb);
> - sbi->s_group_desc = kmalloc(db_count * sizeof (struct buffer_head *),
> + sbi->s_group_desc = kzalloc(db_count * sizeof (struct buffer_head *),
>   GFP_KERNEL);
>   if (sbi->s_group_desc == NULL) {
>   printk (KERN_ERR "EXT4-fs: not enough memory\n");
> -- 
> 1.5.2.2
> 
> 
> -
> 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

-
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


[PATCH] ext3: fix ext34_fill_super group description initialization

2007-08-13 Thread Dmitry Monakhov
->s_group_desc have to be zero filled because if sb_read() failed
we jump to following error path.
failed_mount2:
for (i = 0; i < db_count; i++)
brelse(sbi->s_group_desc[i]);<< Bad things may happen here

Signed-off-by: Dmitry Monakhov <[EMAIL PROTECTED]>
---
 fs/ext3/super.c |2 +-
 fs/ext4/super.c |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index f8ac18f..208738e 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -1718,7 +1718,7 @@ static int ext3_fill_super (struct super_block *sb, void 
*data, int silent)
   / EXT3_BLOCKS_PER_GROUP(sb)) + 1;
db_count = (sbi->s_groups_count + EXT3_DESC_PER_BLOCK(sb) - 1) /
   EXT3_DESC_PER_BLOCK(sb);
-   sbi->s_group_desc = kmalloc(db_count * sizeof (struct buffer_head *),
+   sbi->s_group_desc = kzalloc(db_count * sizeof (struct buffer_head *),
GFP_KERNEL);
if (sbi->s_group_desc == NULL) {
printk (KERN_ERR "EXT3-fs: not enough memory\n");
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 8f1d2f6..fefffc0 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1830,7 +1830,7 @@ static int ext4_fill_super (struct super_block *sb, void 
*data, int silent)
sbi->s_groups_count = blocks_count;
db_count = (sbi->s_groups_count + EXT4_DESC_PER_BLOCK(sb) - 1) /
   EXT4_DESC_PER_BLOCK(sb);
-   sbi->s_group_desc = kmalloc(db_count * sizeof (struct buffer_head *),
+   sbi->s_group_desc = kzalloc(db_count * sizeof (struct buffer_head *),
GFP_KERNEL);
if (sbi->s_group_desc == NULL) {
printk (KERN_ERR "EXT4-fs: not enough memory\n");
-- 
1.5.2.2


-
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: [PATCH] [188/2many] MAINTAINERS - EXT4 FILE SYSTEM

2007-08-13 Thread Andreas Dilger
On Aug 12, 2007  23:27 -0700, [EMAIL PROTECTED] wrote:
> Signed-off-by: Joe Perches <[EMAIL PROTECTED]>
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 814168d..992a314 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1808,10 +1808,16 @@ F:fs/ext3/
>  F:   include/linux/ext3*
>  
>  EXT4 FILE SYSTEM
> -P:   Stephen Tweedie, Andrew Morton
> -M:   [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED]
> +P:   Stephen Tweedie
> +M:   [EMAIL PROTECTED]
> +P:   Andrew Morton
> +M:   [EMAIL PROTECTED]
> +P:   Andreas Dilger
> +M:   [EMAIL PROTECTED]
>  L:   linux-ext4@vger.kernel.org
>  S:   Maintained
> +F:   fs/ext4/
> +F:   include/linux/ext4*

To be honest, Stephen and Andrew haven't been directly involved in
the ext4 development.  It probably makes more sense to have e.g.
Eric Sandeen, Ted Ts'o, and MingMing Cao in their place.

Cheers, Andreas
--
Andreas Dilger
Principal Software Engineer
Cluster File Systems, Inc.

-
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: [PATCH] [187/2many] MAINTAINERS - EXT3 FILE SYSTEM

2007-08-13 Thread Andreas Dilger
On Aug 12, 2007  23:27 -0700, [EMAIL PROTECTED] wrote:
> Add file pattern to MAINTAINER entry
> 
> Signed-off-by: Joe Perches <[EMAIL PROTECTED]>
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 653b9a0..814168d 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1796,10 +1796,16 @@ F:fs/ext2/
>  F:   include/linux/ext2*
>  
>  EXT3 FILE SYSTEM
> -P:   Stephen Tweedie, Andrew Morton
> -M:   [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED]
> +P:   Stephen Tweedie
> +M:   [EMAIL PROTECTED]
> +P:   Andrew Morton
> +M:   [EMAIL PROTECTED]
> +P:   Andreas Dilger
> +M:   [EMAIL PROTECTED]
>  L:   linux-ext4@vger.kernel.org
>  S:   Maintained
> +F:   fs/ext3/
> +F:   include/linux/ext3*

You may as well have fs/jbd/* and include/linux/jbd.h for ext3.

Cheers, Andreas
--
Andreas Dilger
Principal Software Engineer
Cluster File Systems, Inc.

-
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