Re: [PATCH] ext3: fsid for statvfs

From: Andrew Morton
Date: Tue Oct 10 2006 - 16:38:24 EST


On Tue, 10 Oct 2006 11:32:13 +0300 (EEST)
Pekka J Enberg <penberg@xxxxxxxxxxxxxx> wrote:

> From: Pekka Enberg <penberg@xxxxxxxxxxxxxx>
>
> Update ext3_statfs to return an FSID that is a 64 bit XOR of the 128 bit
> filesystem UUID as suggested by Andreas Dilger. See the following Bugzilla
> entry for details:
>
> http://bugzilla.kernel.org/show_bug.cgi?id=136
>
> Cc: Andreas Dilger <adilger@xxxxxxxxxxxxx>
> Cc: Stephen Tweedie <sct@xxxxxxxxxx>
> Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxxxxxx>

Deja vu. Gosh, has it really been four years?

Combatants cc'ed ;)

>
> fs/ext3/super.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> Index: 2.6/fs/ext3/super.c
> ===================================================================
> --- 2.6.orig/fs/ext3/super.c
> +++ 2.6/fs/ext3/super.c
> @@ -2385,6 +2385,7 @@ static int ext3_statfs (struct dentry *
> struct ext3_super_block *es = sbi->s_es;
> ext3_fsblk_t overhead;
> int i;
> + u64 fsid;
>
> if (test_opt (sb, MINIX_DF))
> overhead = 0;
> @@ -2431,6 +2432,10 @@ static int ext3_statfs (struct dentry *
> buf->f_files = le32_to_cpu(es->s_inodes_count);
> buf->f_ffree = percpu_counter_sum(&sbi->s_freeinodes_counter);
> buf->f_namelen = EXT3_NAME_LEN;
> + fsid = le64_to_cpup((void *)es->s_uuid) ^
> + le64_to_cpup((void *)es->s_uuid + sizeof(u64));
> + buf->f_fsid.val[0] = fsid & 0xFFFFFFFFUL;
> + buf->f_fsid.val[1] = (fsid >> 32) & 0xFFFFFFFFUL;
> return 0;
> }
>

ext2 and ext4 would need patching too...
-
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/