Skip to contentSkip to conversation

btrfs-progs: change mans to describe the third copy of superblock

PATCH In review Satoru Takeuchi 3 participants 4 messages Oct 19, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs-progs: change mans to describe the third copy of superblock

Some tools can select which superblock these commands use by "-s <superblock>" option. Although this option says the valid values are 0-2, we can set 3 if filesystem is very large.

---
 Documentation/btrfs-check.asciidoc        | 2 +-
 Documentation/btrfs-restore.asciidoc      | 2 +-
 Documentation/btrfs-select-super.asciidoc | 3 ++-
 3 files changed, 4 insertions(+), 3 deletions(-)
Documentation/btrfs-check.asciidoc +1 -1
index fbf4884..a557cff 100644
@@ -74,7 +74,7 @@ run in read-only mode, this option exists to calm potential panic when users
 are going to run the checker
 
 -s|--super <superblock>::
-use 'superblock'th superblock copy, valid values are 0, 1 or 2 if the
+use 'superblock'th superblock copy, valid values are 0, 1, 2 or 3 if the
 respective superblock offset is within the device size
 +
 This can be used to use a different starting point if some of the primary
Documentation/btrfs-restore.asciidoc +1 -1
index 090dcc5..c19e0e2 100644
@@ -63,7 +63,7 @@ use <bytenr> to read the root tree
 only restore files that are under specified subvolume root pointed by <bytenr>
 
 -u|--super <mirror>::
-use given superblock mirror identified by <mirror>, it can be 0,1 or 2
+use given superblock mirror identified by <mirror>, it can be 0, 1, 2 or 3
 
 -r|--root <rootid>::
 only restore files that are under a specified subvolume whose objectid is <rootid>
Documentation/btrfs-select-super.asciidoc +2 -1
index 6e94a03..7f96bd8 100644
@@ -32,13 +32,14 @@ Superblock copies exist in the following offsets on the device:
 - primary: '64KiB' (65536)
 - 1st copy: '64MiB' (67108864)
 - 2nd copy: '256GiB' (274877906944)
+- 3rd copy: '1PiB' (1125899906842624)
 
 A superblock size is '4KiB' (4096).
 
 OPTIONS
 -------
 -s|--super <superblock>::
-use 'superblock'th superblock copy, valid values are 0 1 or 2 if the
+use 'superblock'th superblock copy, valid values are 0, 1, 2 or 3 if the
 respective superblock offset is within the device size
 
 SEE ALSO
Signature · 1 line
2.7.4
#1 lore raw
Quoted 4 lines · Satoru Takeuchi

Some tools can select which superblock these commands use by "-s <superblock>" option. Although this option says the valid values are 0-2, we can set 3 if filesystem is very large.

Hello,
Wiki says there are 4 superblocks. However in the implementation BTRFS_SUPER_MIROR_MAX is 3 and 0 indicates the block at 64K (disk-io.h of btrfs-progs), therefore I think there is no 4th superblock actually.

Regards,
Tomohiro

#2 lore raw
Quoted 10 lines · Tomohiro
Quoted 4 lines · Satoru Takeuchi

Some tools can select which superblock these commands use by "-s <superblock>" option. Although this option says the valid values are 0-2, we can set 3 if filesystem is very large.

Hello,
Wiki says there are 4 superblocks. However in the implementation BTRFS_SUPER_MIROR_MAX is 3 and 0 indicates the block at 64K (disk-io.h of btrfs-progs), therefore I think there is no 4th superblock actually.

Kernel implementation also shows that it will only update up to 3 superblocks:

---

	if (max_mirrors == 0)
		max_mirrors = BTRFS_SUPER_MIRROR_MAX;

	for (i = 0; i < max_mirrors; i++) {
		bytenr = btrfs_sb_offset(i);
		if (bytenr + BTRFS_SUPER_INFO_SIZE >=
		    device->commit_total_bytes)
			break;

---

And BTRFS_SUPER_MIRROR_MAX is 3:
---
#define BTRFS_SUPER_MIRROR_MAX 3
---

So even you can set any value and btrfs_sb_offset() can calculate the super block offset, you will just read out some garbage.

Thanks,
Qu

Quoted 9 lines

Regards,
Tomohiro

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw

At Thu, 19 Oct 2017 17:05:18 +0800,

Quoted 29 lines · Qu Wenruo
Quoted 10 lines · Tomohiro
Quoted 4 lines · Satoru Takeuchi

Some tools can select which superblock these commands use by "-s <superblock>" option. Although this option says the valid values are 0-2, we can set 3 if filesystem is very large.

Hello,
Wiki says there are 4 superblocks. However in the implementation BTRFS_SUPER_MIROR_MAX is 3 and 0 indicates the block at 64K (disk-io.h of btrfs-progs), therefore I think there is no 4th superblock actually.

Kernel implementation also shows that it will only update up to 3 superblocks:

---

	if (max_mirrors == 0)
		max_mirrors = BTRFS_SUPER_MIRROR_MAX;

	for (i = 0; i < max_mirrors; i++) {
		bytenr = btrfs_sb_offset(i);
		if (bytenr + BTRFS_SUPER_INFO_SIZE >=
		    device->commit_total_bytes)
			break;

---

Quoted 7 lines

And BTRFS_SUPER_MIRROR_MAX is 3:
---
#define BTRFS_SUPER_MIRROR_MAX 3
---

So even you can set any value and btrfs_sb_offset() can calculate the super block offset, you will just read out some garbage.

My fault, sorry. I should read source more carefully. And thank you both to let me know my mistake.

Thanks,
Satoru

Quoted 12 lines

Thanks,
Qu

Quoted 9 lines

Regards,
Tomohiro

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html