Skip to contentSkip to conversation

fix calculation of 2nd superblock position.

PATCH In review Jiro SEKIBA 2 participants 5 messages Jul 7, 2010 – Jul 13, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix calculation of 2nd superblock position.

Hi,

This patch fixes calculation of 2nd superblock position.

nilfs2 has two super blocks, the 1st one is at beginning of the partition, the 2nd one is the end of partition. 2nd one resides at last 4k block. However when the partition size is not a multiple of 4k bytes, the remainder will be ignored.

2010-07-07 Jiro SEKIBA <[email protected]>

* fs/nilfs2.c: fix macro NILFS_2ND_SUPER_BLOCK to calculate 2nd superblock position from partition size.

=== modified file 'fs/nilfs2.c'

nilfs2.c +3 -3
@@ -52,9 +52,9 @@
 /* nilfs 1st super block posission from beginning of the partition
    in 512 block size */
 #define NILFS_1ST_SUPER_BLOCK	2
-/* nilfs 2nd super block posission from end of the partition
+/* nilfs 2nd super block posission from beginning of the partition
    in 512 block size */
-#define NILFS_2ND_SUPER_BLOCK	8
+#define NILFS_2ND_SUPER_BLOCK(devsize)	(((devsize >> 3) - 1) << 3)
 
 struct grub_nilfs2_inode
 {
@@ -729,7 +729,7 @@
   if (partition_size != GRUB_DISK_SIZE_UNKNOWN)
     {
       /* Read second super block. */
-      grub_disk_read (disk, partition_size - NILFS_2ND_SUPER_BLOCK, 0,
+      grub_disk_read (disk, NILFS_2ND_SUPER_BLOCK (partition_size), 0,
 		      sizeof (struct grub_nilfs2_super_block), &sb2);
       /* Make sure if 2nd super block is valid.  */
       valid[1] = grub_nilfs2_valid_sb (&sb2);
Signature · 1 line
Jiro SEKIBA <[email protected]>
#1 lore raw
Quoted 9 lines · Jiro SEKIBA

Hi,

This patch fixes calculation of 2nd superblock position.

nilfs2 has two super blocks, the 1st one is at beginning of the partition, the 2nd one is the end of partition. 2nd one resides at last 4k block. However when the partition size is not a multiple of 4k bytes, the remainder will be ignored.

Quoted 6 lines

2010-07-07 Jiro SEKIBA <[email protected]>

* fs/nilfs2.c: fix macro NILFS_2ND_SUPER_BLOCK to calculate 2nd superblock position from partition size.

Go ahead for trunk

Quoted 27 lines

=== modified file 'fs/nilfs2.c'

nilfs2.c +3 -3
@@ -52,9 +52,9 @@
 /* nilfs 1st super block posission from beginning of the partition
    in 512 block size */
 #define NILFS_1ST_SUPER_BLOCK	2
-/* nilfs 2nd super block posission from end of the partition
+/* nilfs 2nd super block posission from beginning of the partition
    in 512 block size */
-#define NILFS_2ND_SUPER_BLOCK	8
+#define NILFS_2ND_SUPER_BLOCK(devsize)	(((devsize >> 3) - 1) << 3)
 
 struct grub_nilfs2_inode
 {
@@ -729,7 +729,7 @@
   if (partition_size != GRUB_DISK_SIZE_UNKNOWN)
     {
       /* Read second super block. */
-      grub_disk_read (disk, partition_size - NILFS_2ND_SUPER_BLOCK, 0,
+      grub_disk_read (disk, NILFS_2ND_SUPER_BLOCK (partition_size), 0,
 		      sizeof (struct grub_nilfs2_super_block), &sb2);
       /* Make sure if 2nd super block is valid.  */
       valid[1] = grub_nilfs2_valid_sb (&sb2);
Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
#2 lore raw

At Tue, 13 Jul 2010 01:12:05 +0200,

Quoted 13 lines · Vladimir 'φ-coder/phcoder' Serbinenko

[1 <multipart/signed (7bit)>]
[1.1 <text/plain; UTF-8 (quoted-printable)>]

Quoted 9 lines · Jiro SEKIBA

Hi,

This patch fixes calculation of 2nd superblock position.

nilfs2 has two super blocks, the 1st one is at beginning of the partition, the 2nd one is the end of partition. 2nd one resides at last 4k block. However when the partition size is not a multiple of 4k bytes, the remainder will be ignored.

Quoted 7 lines
Quoted 6 lines

2010-07-07 Jiro SEKIBA <[email protected]>

* fs/nilfs2.c: fix macro NILFS_2ND_SUPER_BLOCK to calculate 2nd superblock position from partition size.

Go ahead for trunk

Sorry, but what am I supposed to do?
Did I have a write access to the trunk?

Quoted 41 lines
Quoted 27 lines

=== modified file 'fs/nilfs2.c'

nilfs2.c +3 -3
@@ -52,9 +52,9 @@
 /* nilfs 1st super block posission from beginning of the partition
    in 512 block size */
 #define NILFS_1ST_SUPER_BLOCK	2
-/* nilfs 2nd super block posission from end of the partition
+/* nilfs 2nd super block posission from beginning of the partition
    in 512 block size */
-#define NILFS_2ND_SUPER_BLOCK	8
+#define NILFS_2ND_SUPER_BLOCK(devsize)	(((devsize >> 3) - 1) << 3)
 
 struct grub_nilfs2_inode
 {
@@ -729,7 +729,7 @@
   if (partition_size != GRUB_DISK_SIZE_UNKNOWN)
     {
       /* Read second super block. */
-      grub_disk_read (disk, partition_size - NILFS_2ND_SUPER_BLOCK, 0,
+      grub_disk_read (disk, NILFS_2ND_SUPER_BLOCK (partition_size), 0,
 		      sizeof (struct grub_nilfs2_super_block), &sb2);
       /* Make sure if 2nd super block is valid.  */
       valid[1] = grub_nilfs2_valid_sb (&sb2);
Signature · 11 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko


[1.2 OpenPGP digital signature <application/pgp-signature (7bit)>]

[2  <text/plain; us-ascii (7bit)>]
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 1 line
Jiro SEKIBA <[email protected]>
#3 lore raw
Quoted 23 lines · Jiro SEKIBA

At Tue, 13 Jul 2010 01:12:05 +0200,

Quoted 20 lines · Vladimir 'φ-coder/phcoder' Serbinenko

[1 <multipart/signed (7bit)>]
[1.1 <text/plain; UTF-8 (quoted-printable)>]

Quoted 16 lines · Jiro SEKIBA

Hi,

This patch fixes calculation of 2nd superblock position.

nilfs2 has two super blocks, the 1st one is at beginning of the partition, the 2nd one is the end of partition. 2nd one resides at last 4k block. However when the partition size is not a multiple of 4k bytes, the remainder will be ignored.

2010-07-07 Jiro SEKIBA <[email protected]>

* fs/nilfs2.c: fix macro NILFS_2ND_SUPER_BLOCK to calculate 2nd superblock position from partition size.

Quoted 6 lines
Quoted 2 lines

Go ahead for trunk

Sorry, but what am I supposed to do?
Did I have a write access to the trunk?

No, I plainly forgot to give you one. What's your savannah account? I committed your patch.

Quoted 45 lines
Quoted 42 lines
Quoted 28 lines

=== modified file 'fs/nilfs2.c'

nilfs2.c +3 -3
@@ -52,9 +52,9 @@
 /* nilfs 1st super block posission from beginning of the partition
    in 512 block size */
 #define NILFS_1ST_SUPER_BLOCK	2
-/* nilfs 2nd super block posission from end of the partition
+/* nilfs 2nd super block posission from beginning of the partition
    in 512 block size */
-#define NILFS_2ND_SUPER_BLOCK	8
+#define NILFS_2ND_SUPER_BLOCK(devsize)	(((devsize >> 3) - 1) << 3)
 
 struct grub_nilfs2_inode
 {
@@ -729,7 +729,7 @@
   if (partition_size != GRUB_DISK_SIZE_UNKNOWN)
     {
       /* Read second super block. */
-      grub_disk_read (disk, partition_size - NILFS_2ND_SUPER_BLOCK, 0,
+      grub_disk_read (disk, NILFS_2ND_SUPER_BLOCK (partition_size), 0,
 		      sizeof (struct grub_nilfs2_super_block), &sb2);
       /* Make sure if 2nd super block is valid.  */
       valid[1] = grub_nilfs2_valid_sb (&sb2);
Signature · 11 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko


[1.2 OpenPGP digital signature <application/pgp-signature (7bit)>]

[2  <text/plain; us-ascii (7bit)>]
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
#4 lore raw

At Tue, 13 Jul 2010 11:48:15 +0200,

Quoted 25 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 23 lines · Jiro SEKIBA

At Tue, 13 Jul 2010 01:12:05 +0200,

Quoted 20 lines · Vladimir 'φ-coder/phcoder' Serbinenko

[1 <multipart/signed (7bit)>]
[1.1 <text/plain; UTF-8 (quoted-printable)>]

Quoted 16 lines · Jiro SEKIBA

Hi,

This patch fixes calculation of 2nd superblock position.

nilfs2 has two super blocks, the 1st one is at beginning of the partition, the 2nd one is the end of partition. 2nd one resides at last 4k block. However when the partition size is not a multiple of 4k bytes, the remainder will be ignored.

2010-07-07 Jiro SEKIBA <[email protected]>

* fs/nilfs2.c: fix macro NILFS_2ND_SUPER_BLOCK to calculate 2nd superblock position from partition size.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Go ahead for trunk

Sorry, but what am I supposed to do?
Did I have a write access to the trunk?

No, I plainly forgot to give you one. What's your savannah account? I committed your patch.

Thanks,

I obtained one. My account is "jir".

Quoted 52 lines
Quoted 45 lines
Quoted 42 lines
Quoted 28 lines

=== modified file 'fs/nilfs2.c'

nilfs2.c +3 -3
@@ -52,9 +52,9 @@
 /* nilfs 1st super block posission from beginning of the partition
    in 512 block size */
 #define NILFS_1ST_SUPER_BLOCK	2
-/* nilfs 2nd super block posission from end of the partition
+/* nilfs 2nd super block posission from beginning of the partition
    in 512 block size */
-#define NILFS_2ND_SUPER_BLOCK	8
+#define NILFS_2ND_SUPER_BLOCK(devsize)	(((devsize >> 3) - 1) << 3)
 
 struct grub_nilfs2_inode
 {
@@ -729,7 +729,7 @@
   if (partition_size != GRUB_DISK_SIZE_UNKNOWN)
     {
       /* Read second super block. */
-      grub_disk_read (disk, partition_size - NILFS_2ND_SUPER_BLOCK, 0,
+      grub_disk_read (disk, NILFS_2ND_SUPER_BLOCK (partition_size), 0,
 		      sizeof (struct grub_nilfs2_super_block), &sb2);
       /* Make sure if 2nd super block is valid.  */
       valid[1] = grub_nilfs2_valid_sb (&sb2);
Signature · 11 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko


[1.2 OpenPGP digital signature <application/pgp-signature (7bit)>]

[2  <text/plain; us-ascii (7bit)>]
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
Signature · 1 line
Jiro SEKIBA <[email protected]>