Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
7ae9c09d
Commit
7ae9c09d
authored
Apr 18, 2008
by
Chris Mason
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Btrfs: Add support for labels in the super block
Signed-off-by:
Chris Mason
<
chris.mason@oracle.com
>
parent
a443755f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
8 deletions
+11
-8
fs/btrfs/ctree.h
fs/btrfs/ctree.h
+2
-0
fs/btrfs/volumes.c
fs/btrfs/volumes.c
+9
-8
No files found.
fs/btrfs/ctree.h
View file @
7ae9c09d
...
@@ -247,6 +247,7 @@ struct btrfs_header {
...
@@ -247,6 +247,7 @@ struct btrfs_header {
* room to translate 14 chunks with 3 stripes each.
* room to translate 14 chunks with 3 stripes each.
*/
*/
#define BTRFS_SYSTEM_CHUNK_ARRAY_SIZE 2048
#define BTRFS_SYSTEM_CHUNK_ARRAY_SIZE 2048
#define BTRFS_LABEL_SIZE 256
/*
/*
* the super block basically lists the main trees of the FS
* the super block basically lists the main trees of the FS
...
@@ -276,6 +277,7 @@ struct btrfs_super_block {
...
@@ -276,6 +277,7 @@ struct btrfs_super_block {
u8
root_level
;
u8
root_level
;
u8
chunk_root_level
;
u8
chunk_root_level
;
struct
btrfs_dev_item
dev_item
;
struct
btrfs_dev_item
dev_item
;
char
label
[
BTRFS_LABEL_SIZE
];
u8
sys_chunk_array
[
BTRFS_SYSTEM_CHUNK_ARRAY_SIZE
];
u8
sys_chunk_array
[
BTRFS_SYSTEM_CHUNK_ARRAY_SIZE
];
}
__attribute__
((
__packed__
));
}
__attribute__
((
__packed__
));
...
...
fs/btrfs/volumes.c
View file @
7ae9c09d
...
@@ -57,9 +57,7 @@ int btrfs_cleanup_fs_uuids(void)
...
@@ -57,9 +57,7 @@ int btrfs_cleanup_fs_uuids(void)
devices_cur
=
fs_devices
->
devices
.
next
;
devices_cur
=
fs_devices
->
devices
.
next
;
dev
=
list_entry
(
devices_cur
,
struct
btrfs_device
,
dev
=
list_entry
(
devices_cur
,
struct
btrfs_device
,
dev_list
);
dev_list
);
printk
(
"uuid cleanup finds %s
\n
"
,
dev
->
name
);
if
(
dev
->
bdev
)
{
if
(
dev
->
bdev
)
{
printk
(
"closing
\n
"
);
close_bdev_excl
(
dev
->
bdev
);
close_bdev_excl
(
dev
->
bdev
);
}
}
list_del
(
&
dev
->
dev_list
);
list_del
(
&
dev
->
dev_list
);
...
@@ -149,7 +147,6 @@ static int device_list_add(const char *path,
...
@@ -149,7 +147,6 @@ static int device_list_add(const char *path,
}
}
if
(
fs_devices
->
lowest_devid
>
devid
)
{
if
(
fs_devices
->
lowest_devid
>
devid
)
{
fs_devices
->
lowest_devid
=
devid
;
fs_devices
->
lowest_devid
=
devid
;
printk
(
"lowest devid now %Lu
\n
"
,
devid
);
}
}
*
fs_devices_ret
=
fs_devices
;
*
fs_devices_ret
=
fs_devices
;
return
0
;
return
0
;
...
@@ -166,7 +163,6 @@ int btrfs_close_devices(struct btrfs_fs_devices *fs_devices)
...
@@ -166,7 +163,6 @@ int btrfs_close_devices(struct btrfs_fs_devices *fs_devices)
device
=
list_entry
(
cur
,
struct
btrfs_device
,
dev_list
);
device
=
list_entry
(
cur
,
struct
btrfs_device
,
dev_list
);
if
(
device
->
bdev
)
{
if
(
device
->
bdev
)
{
close_bdev_excl
(
device
->
bdev
);
close_bdev_excl
(
device
->
bdev
);
printk
(
"close devices closes %s
\n
"
,
device
->
name
);
}
}
device
->
bdev
=
NULL
;
device
->
bdev
=
NULL
;
}
}
...
@@ -220,11 +216,9 @@ int btrfs_scan_one_device(const char *path, int flags, void *holder,
...
@@ -220,11 +216,9 @@ int btrfs_scan_one_device(const char *path, int flags, void *holder,
mutex_lock
(
&
uuid_mutex
);
mutex_lock
(
&
uuid_mutex
);
printk
(
"scan one opens %s
\n
"
,
path
);
bdev
=
open_bdev_excl
(
path
,
flags
,
holder
);
bdev
=
open_bdev_excl
(
path
,
flags
,
holder
);
if
(
IS_ERR
(
bdev
))
{
if
(
IS_ERR
(
bdev
))
{
printk
(
"open failed
\n
"
);
ret
=
PTR_ERR
(
bdev
);
ret
=
PTR_ERR
(
bdev
);
goto
error
;
goto
error
;
}
}
...
@@ -240,13 +234,20 @@ int btrfs_scan_one_device(const char *path, int flags, void *holder,
...
@@ -240,13 +234,20 @@ int btrfs_scan_one_device(const char *path, int flags, void *holder,
disk_super
=
(
struct
btrfs_super_block
*
)
bh
->
b_data
;
disk_super
=
(
struct
btrfs_super_block
*
)
bh
->
b_data
;
if
(
strncmp
((
char
*
)(
&
disk_super
->
magic
),
BTRFS_MAGIC
,
if
(
strncmp
((
char
*
)(
&
disk_super
->
magic
),
BTRFS_MAGIC
,
sizeof
(
disk_super
->
magic
)))
{
sizeof
(
disk_super
->
magic
)))
{
printk
(
"no btrfs found on %s
\n
"
,
path
);
ret
=
-
EINVAL
;
ret
=
-
EINVAL
;
goto
error_brelse
;
goto
error_brelse
;
}
}
devid
=
le64_to_cpu
(
disk_super
->
dev_item
.
devid
);
devid
=
le64_to_cpu
(
disk_super
->
dev_item
.
devid
);
transid
=
btrfs_super_generation
(
disk_super
);
transid
=
btrfs_super_generation
(
disk_super
);
printk
(
"found device %Lu transid %Lu on %s
\n
"
,
devid
,
transid
,
path
);
if
(
disk_super
->
label
[
0
])
printk
(
"device label %s "
,
disk_super
->
label
);
else
{
/* FIXME, make a readl uuid parser */
printk
(
"device fsid %llx-%llx "
,
*
(
unsigned
long
long
*
)
disk_super
->
fsid
,
*
(
unsigned
long
long
*
)(
disk_super
->
fsid
+
8
));
}
printk
(
"devid %Lu transid %Lu %s
\n
"
,
devid
,
transid
,
path
);
ret
=
device_list_add
(
path
,
disk_super
,
devid
,
fs_devices_ret
);
ret
=
device_list_add
(
path
,
disk_super
,
devid
,
fs_devices_ret
);
error_brelse:
error_brelse:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment