linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext3: fsid for statvfs
@ 2006-10-10  8:32 Pekka J Enberg
  2006-10-10 20:36 ` Andrew Morton
  0 siblings, 1 reply; 5+ messages in thread
From: Pekka J Enberg @ 2006-10-10  8:32 UTC (permalink / raw)
  To: akpm; +Cc: sct, adilger, linux-kernel, ext2-devel

From: Pekka Enberg <penberg@cs.helsinki.fi>

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@clusterfs.com>
Cc: Stephen Tweedie <sct@redhat.com>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---

 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;
 }
 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ext3: fsid for statvfs
  2006-10-10  8:32 [PATCH] ext3: fsid for statvfs Pekka J Enberg
@ 2006-10-10 20:36 ` Andrew Morton
  2006-10-11  7:41   ` Pekka Enberg
                     ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Andrew Morton @ 2006-10-10 20:36 UTC (permalink / raw)
  To: Pekka J Enberg, Bryan Henderson, Andries Brouwer, H. Peter Anvin
  Cc: sct, adilger, linux-kernel, ext2-devel

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

> From: Pekka Enberg <penberg@cs.helsinki.fi>
> 
> 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@clusterfs.com>
> Cc: Stephen Tweedie <sct@redhat.com>
> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ext3: fsid for statvfs
  2006-10-10 20:36 ` Andrew Morton
@ 2006-10-11  7:41   ` Pekka Enberg
  2006-10-11 16:11   ` Stephen C. Tweedie
  2006-10-23 11:10   ` Andries Brouwer
  2 siblings, 0 replies; 5+ messages in thread
From: Pekka Enberg @ 2006-10-11  7:41 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Bryan Henderson, Andries Brouwer, H. Peter Anvin, sct, adilger,
	linux-kernel, ext2-devel

On 10/10/06, Andrew Morton <akpm@osdl.org> wrote:
> ext2 and ext4 would need patching too...

I see you already beat me to it. Thanks Andrew!

                           Pekka

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ext3: fsid for statvfs
  2006-10-10 20:36 ` Andrew Morton
  2006-10-11  7:41   ` Pekka Enberg
@ 2006-10-11 16:11   ` Stephen C. Tweedie
  2006-10-23 11:10   ` Andries Brouwer
  2 siblings, 0 replies; 5+ messages in thread
From: Stephen C. Tweedie @ 2006-10-11 16:11 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Pekka J Enberg, Bryan Henderson, Andries Brouwer, H. Peter Anvin,
	Andreas Dilger, linux-kernel, ext2-devel, Stephen Tweedie

Hi,

On Tue, 2006-10-10 at 13:36 -0700, Andrew Morton wrote:

> > 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@clusterfs.com>
> > Cc: Stephen Tweedie <sct@redhat.com>
> > Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
> 
> Deja vu.  Gosh, has it really been four years?
> 
> Combatants cc'ed ;)

Looks entirely reasonable to me.

--Stephen



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ext3: fsid for statvfs
  2006-10-10 20:36 ` Andrew Morton
  2006-10-11  7:41   ` Pekka Enberg
  2006-10-11 16:11   ` Stephen C. Tweedie
@ 2006-10-23 11:10   ` Andries Brouwer
  2 siblings, 0 replies; 5+ messages in thread
From: Andries Brouwer @ 2006-10-23 11:10 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Pekka J Enberg, Bryan Henderson, Andries Brouwer, H. Peter Anvin,
	sct, adilger, linux-kernel, ext2-devel

On Tue, Oct 10, 2006 at 01:36:36PM -0700, Andrew Morton wrote:
> On Tue, 10 Oct 2006 11:32:13 +0300 (EEST)
> Pekka J Enberg <penberg@cs.helsinki.fi> wrote:
> 
> > From: Pekka Enberg <penberg@cs.helsinki.fi>
> > 
> > Update ext3_statfs to return an FSID that is a 64 bit XOR of the 128 bit
> > filesystem UUID as suggested by Andreas Dilger.
> 
> Deja vu.  Gosh, has it really been four years?
> 
> Combatants cc'ed ;)

Ha, you have a memory. To me this seems infinitely long ago.
Google turned up some interesting discussions on dev_t, and the below exchange.

No, at first sight I have no objections to the suggested patch.
(Although I think that fsid is used only for doubtful purposes.)

Andries

-----
Andries Brouwer wrote:
> On Mon, Dec 09, 2002 at 02:15:12PM -0800, H. Peter Anvin wrote:
>
> > > The general idea is that f_fsid contains some random stuff such that
> > > the pair (f_fsid,ino) uniquely determines a file.
>
> > This, of course, is the exact POSIX definition of the st_dev part of
> > struct stat: (st_dev, st_ino) uniquely identifies the file.
>
> Yes, but the difference is that (st_dev, st_ino) only identifies
> the file within a single machine, and may stop working when you
> have NFS mounts.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-10-23 11:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-10  8:32 [PATCH] ext3: fsid for statvfs Pekka J Enberg
2006-10-10 20:36 ` Andrew Morton
2006-10-11  7:41   ` Pekka Enberg
2006-10-11 16:11   ` Stephen C. Tweedie
2006-10-23 11:10   ` Andries Brouwer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).