Re: [PATCH 2/3] ensure unique i_ino in filesystems without permanent inode numbers (libfs superblock cleanup)

From: Josef Sipek
Date: Fri Dec 08 2006 - 01:17:07 EST


On Thu, Dec 07, 2006 at 05:13:08PM -0500, Jeff Layton wrote:
> This patch ensures that the inodes allocated by the functions get_sb_pseudo
> and simple_fill_super are unique, provided of course, that the filesystems
> calling them play by the rules. Currently that isn't the case, but will be
> as I get to each of the filesystems.
>
> The patch itself is pretty simple, but I also had to fix up the callers of
> simple_fill_super to make sure they passed in the seq flag. For this first
> pass, I set it on any filesystem with an empty "files" struct to 0. That may
> need to be revised as I review each filesystem, but should be OK for now.
>
> Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
>
> diff --git a/drivers/infiniband/hw/ipath/ipath_fs.c
> b/drivers/infiniband/hw/ipath/ipath_fs.c
> index d9ff283..c127995 100644
> --- a/drivers/infiniband/hw/ipath/ipath_fs.c
> +++ b/drivers/infiniband/hw/ipath/ipath_fs.c
> @@ -514,7 +514,7 @@ static int ipathfs_fill_super(struct sup
> {""},
> };
>
> - ret = simple_fill_super(sb, IPATHFS_MAGIC, files);
> + ret = simple_fill_super(sb, IPATHFS_MAGIC, files, 1);

I don't know...the magic looking 1 and 0 (later in the patch) seem a bit
arbitrary. Maybe a #define is in order?

> -int simple_fill_super(struct super_block *s, int magic, struct tree_descr
> *files)
> +/*
> + * Some filesystems require that particular entries have particular i_ino
> values. Those
> + * callers need to set the "seq" flag to make sure that i_ino is assigned
> sequentially
> + * to the files starting with 0.
> + */
> +int simple_fill_super(struct super_block *s, int magic, struct tree_descr
> *files, int seq)

Line wraped.

> @@ -399,7 +407,10 @@ int simple_fill_super(struct super_block
> inode->i_blocks = 0;
> inode->i_atime = inode->i_mtime = inode->i_ctime =
> CURRENT_TIME;

I'd indent CURRENT_TIME a bit.

Josef "Jeff" Sipek.

--
If I have trouble installing Linux, something is wrong. Very wrong.
- Linus Torvalds
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/