linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext2: return FSID for statvfs
@ 2005-12-06 20:22 Pekka Enberg
  0 siblings, 0 replies; only message in thread
From: Pekka Enberg @ 2005-12-06 20:22 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, ext2-devel

This patch changes ext2_statfs() to return a FSID based on least significant
64-bits of the 128-bit filesystem UUID. This patch is a partial fix for
Bugzilla Bug <http://bugzilla.kernel.org/show_bug.cgi?id=136>.

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---

 super.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

Index: 2.6/fs/ext2/super.c
===================================================================
--- 2.6.orig/fs/ext2/super.c
+++ 2.6/fs/ext2/super.c
@@ -1038,6 +1038,7 @@ restore_opts:
 static int ext2_statfs (struct super_block * sb, struct kstatfs * buf)
 {
 	struct ext2_sb_info *sbi = EXT2_SB(sb);
+	struct ext2_super_block *es = sbi->s_es;
 	unsigned long overhead;
 	int i;
 
@@ -1052,7 +1053,7 @@ static int ext2_statfs (struct super_blo
 		 * All of the blocks before first_data_block are
 		 * overhead
 		 */
-		overhead = le32_to_cpu(sbi->s_es->s_first_data_block);
+		overhead = le32_to_cpu(es->s_first_data_block);
 
 		/*
 		 * Add the overhead attributed to the superblock and
@@ -1073,14 +1074,16 @@ static int ext2_statfs (struct super_blo
 
 	buf->f_type = EXT2_SUPER_MAGIC;
 	buf->f_bsize = sb->s_blocksize;
-	buf->f_blocks = le32_to_cpu(sbi->s_es->s_blocks_count) - overhead;
+	buf->f_blocks = le32_to_cpu(es->s_blocks_count) - overhead;
 	buf->f_bfree = ext2_count_free_blocks(sb);
-	buf->f_bavail = buf->f_bfree - le32_to_cpu(sbi->s_es->s_r_blocks_count);
-	if (buf->f_bfree < le32_to_cpu(sbi->s_es->s_r_blocks_count))
+	buf->f_bavail = buf->f_bfree - le32_to_cpu(es->s_r_blocks_count);
+	if (buf->f_bfree < le32_to_cpu(es->s_r_blocks_count))
 		buf->f_bavail = 0;
-	buf->f_files = le32_to_cpu(sbi->s_es->s_inodes_count);
+	buf->f_files = le32_to_cpu(es->s_inodes_count);
 	buf->f_ffree = ext2_count_free_inodes (sb);
 	buf->f_namelen = EXT2_NAME_LEN;
+	buf->f_fsid.val[0] = le32_to_cpup((void *)es->s_uuid);
+	buf->f_fsid.val[1] = le32_to_cpup((void *)es->s_uuid + sizeof(u32));
 	return 0;
 }
 



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-12-06 20:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-06 20:22 [PATCH] ext2: return FSID for statvfs Pekka Enberg

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