Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci
Commits
95e05289
Commit
95e05289
authored
Aug 29, 2007
by
Chris Mason
Committed by
David Woodhouse
Aug 29, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Btrfs: Use mount -o subvol to select the subvol directory instead of dev:
Signed-off-by:
Chris Mason
<
chris.mason@oracle.com
>
parent
e9fe395e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
10 deletions
+45
-10
fs/btrfs/ctree.h
fs/btrfs/ctree.h
+6
-0
fs/btrfs/super.c
fs/btrfs/super.c
+39
-10
No files found.
fs/btrfs/ctree.h
View file @
95e05289
...
@@ -1064,6 +1064,12 @@ static inline int btrfs_set_root_name(struct btrfs_root *root,
...
@@ -1064,6 +1064,12 @@ static inline int btrfs_set_root_name(struct btrfs_root *root,
((type *)(btrfs_leaf_data(leaf) + \
((type *)(btrfs_leaf_data(leaf) + \
btrfs_item_offset((leaf)->items + (slot))))
btrfs_item_offset((leaf)->items + (slot))))
/* mount option defines and helpers */
#define BTRFS_MOUNT_SUBVOL 0x000001
#define btrfs_clear_opt(o, opt) o &= ~BTRFS_MOUNT_##opt
#define btrfs_set_opt(o, opt) o |= BTRFS_MOUNT_##opt
#define btrfs_test_opt(sb, opt) (BTRFS_SB(sb)->s_mount_opt & \
BTRFS_MOUNT_##opt)
/* extent-tree.c */
/* extent-tree.c */
int
btrfs_extent_post_op
(
struct
btrfs_trans_handle
*
trans
,
int
btrfs_extent_post_op
(
struct
btrfs_trans_handle
*
trans
,
struct
btrfs_root
*
root
);
struct
btrfs_root
*
root
);
...
...
fs/btrfs/super.c
View file @
95e05289
...
@@ -33,6 +33,7 @@
...
@@ -33,6 +33,7 @@
#include <linux/writeback.h>
#include <linux/writeback.h>
#include <linux/statfs.h>
#include <linux/statfs.h>
#include <linux/compat.h>
#include <linux/compat.h>
#include <linux/parser.h>
#include "ctree.h"
#include "ctree.h"
#include "disk-io.h"
#include "disk-io.h"
#include "transaction.h"
#include "transaction.h"
...
@@ -58,6 +59,41 @@ static void btrfs_put_super (struct super_block * sb)
...
@@ -58,6 +59,41 @@ static void btrfs_put_super (struct super_block * sb)
sb
->
s_fs_info
=
NULL
;
sb
->
s_fs_info
=
NULL
;
}
}
enum
{
Opt_subvol
,
Opt_err
,
};
static
match_table_t
tokens
=
{
{
Opt_subvol
,
"subvol=%s"
},
{
Opt_err
,
NULL
}
};
static
int
parse_options
(
char
*
options
,
struct
btrfs_root
*
root
,
char
**
subvol_name
)
{
char
*
p
;
substring_t
args
[
MAX_OPT_ARGS
];
if
(
!
options
)
return
1
;
while
((
p
=
strsep
(
&
options
,
","
))
!=
NULL
)
{
int
token
;
if
(
!*
p
)
continue
;
token
=
match_token
(
p
,
tokens
,
args
);
switch
(
token
)
{
case
Opt_subvol
:
*
subvol_name
=
match_strdup
(
&
args
[
0
]);
break
;
default:
return
0
;
}
}
return
1
;
}
static
int
btrfs_fill_super
(
struct
super_block
*
sb
,
void
*
data
,
int
silent
)
static
int
btrfs_fill_super
(
struct
super_block
*
sb
,
void
*
data
,
int
silent
)
{
{
struct
inode
*
inode
;
struct
inode
*
inode
;
...
@@ -250,22 +286,15 @@ error:
...
@@ -250,22 +286,15 @@ error:
/* end copy & paste */
/* end copy & paste */
static
int
btrfs_get_sb
(
struct
file_system_type
*
fs_type
,
static
int
btrfs_get_sb
(
struct
file_system_type
*
fs_type
,
int
flags
,
const
char
*
identifier
,
void
*
data
,
struct
vfsmount
*
mnt
)
int
flags
,
const
char
*
dev_name
,
void
*
data
,
struct
vfsmount
*
mnt
)
{
{
int
ret
;
int
ret
;
char
*
_identifier
=
kstrdup
(
identifier
,
GFP_KERNEL
);
char
*
subvol_name
=
NULL
;
char
*
subvol_name
;
const
char
*
dev_name
;
subvol_name
=
_identifier
;
dev_name
=
strsep
(
&
subvol_name
,
":"
);
if
(
!
dev_name
)
return
-
ENOMEM
;
parse_options
((
char
*
)
data
,
NULL
,
&
subvol_name
);
ret
=
btrfs_get_sb_bdev
(
fs_type
,
flags
,
dev_name
,
data
,
ret
=
btrfs_get_sb_bdev
(
fs_type
,
flags
,
dev_name
,
data
,
btrfs_fill_super
,
mnt
,
btrfs_fill_super
,
mnt
,
subvol_name
?
subvol_name
:
"default"
);
subvol_name
?
subvol_name
:
"default"
);
kfree
(
_identifier
);
return
ret
;
return
ret
;
}
}
...
...
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