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
Kirill Smelkov
linux
Commits
d561c025
Commit
d561c025
authored
Mar 23, 2007
by
Chris Mason
Committed by
David Woodhouse
Mar 23, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Btrfs: very minimal locking
Signed-off-by:
Chris Mason
<
chris.mason@oracle.com
>
parent
7f5c1516
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
11 deletions
+22
-11
fs/btrfs/ctree.h
fs/btrfs/ctree.h
+1
-0
fs/btrfs/disk-io.c
fs/btrfs/disk-io.c
+1
-0
fs/btrfs/extent-tree.c
fs/btrfs/extent-tree.c
+3
-2
fs/btrfs/super.c
fs/btrfs/super.c
+17
-9
No files found.
fs/btrfs/ctree.h
View file @
d561c025
...
@@ -231,6 +231,7 @@ struct btrfs_fs_info {
...
@@ -231,6 +231,7 @@ struct btrfs_fs_info {
struct
buffer_head
*
sb_buffer
;
struct
buffer_head
*
sb_buffer
;
struct
super_block
*
sb
;
struct
super_block
*
sb
;
struct
mutex
trans_mutex
;
struct
mutex
trans_mutex
;
struct
mutex
fs_mutex
;
};
};
/*
/*
...
...
fs/btrfs/disk-io.c
View file @
d561c025
...
@@ -116,6 +116,7 @@ struct btrfs_root *open_ctree(struct super_block *sb,
...
@@ -116,6 +116,7 @@ struct btrfs_root *open_ctree(struct super_block *sb,
fs_info
->
sb_buffer
=
sb_buffer
;
fs_info
->
sb_buffer
=
sb_buffer
;
fs_info
->
sb
=
sb
;
fs_info
->
sb
=
sb
;
mutex_init
(
&
fs_info
->
trans_mutex
);
mutex_init
(
&
fs_info
->
trans_mutex
);
mutex_init
(
&
fs_info
->
fs_mutex
);
memset
(
&
fs_info
->
current_insert
,
0
,
sizeof
(
fs_info
->
current_insert
));
memset
(
&
fs_info
->
current_insert
,
0
,
sizeof
(
fs_info
->
current_insert
));
memset
(
&
fs_info
->
last_insert
,
0
,
sizeof
(
fs_info
->
last_insert
));
memset
(
&
fs_info
->
last_insert
,
0
,
sizeof
(
fs_info
->
last_insert
));
...
...
fs/btrfs/extent-tree.c
View file @
d561c025
...
@@ -168,9 +168,10 @@ static int pin_down_block(struct btrfs_root *root, u64 blocknr, int tag)
...
@@ -168,9 +168,10 @@ static int pin_down_block(struct btrfs_root *root, u64 blocknr, int tag)
BUG_ON
(
!
bh
);
BUG_ON
(
!
bh
);
err
=
radix_tree_insert
(
&
root
->
fs_info
->
pinned_radix
,
err
=
radix_tree_insert
(
&
root
->
fs_info
->
pinned_radix
,
blocknr
,
bh
);
blocknr
,
bh
);
BUG_ON
(
err
);
if
(
err
&&
err
!=
-
EEXIST
)
{
if
(
err
)
BUG
();
return
err
;
return
err
;
}
radix_tree_tag_set
(
&
root
->
fs_info
->
pinned_radix
,
blocknr
,
radix_tree_tag_set
(
&
root
->
fs_info
->
pinned_radix
,
blocknr
,
tag
);
tag
);
return
0
;
return
0
;
...
...
fs/btrfs/super.c
View file @
d561c025
...
@@ -453,25 +453,21 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry,
...
@@ -453,25 +453,21 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry,
struct
inode
*
inode
;
struct
inode
*
inode
;
int
err
;
int
err
;
mutex_lock
(
&
root
->
fs_info
->
fs_mutex
);
trans
=
btrfs_start_transaction
(
root
,
1
);
trans
=
btrfs_start_transaction
(
root
,
1
);
inode
=
btrfs_new_inode
(
trans
,
dir
,
mode
);
inode
=
btrfs_new_inode
(
trans
,
dir
,
mode
);
err
=
PTR_ERR
(
inode
);
err
=
PTR_ERR
(
inode
);
if
(
IS_ERR
(
inode
))
if
(
IS_ERR
(
inode
))
return
err
;
goto
out_unlock
;
// FIXME mark the inode dirty
// FIXME mark the inode dirty
err
=
btrfs_add_nondir
(
trans
,
dentry
,
inode
);
err
=
btrfs_add_nondir
(
trans
,
dentry
,
inode
);
dir
->
i_sb
->
s_dirt
=
1
;
dir
->
i_sb
->
s_dirt
=
1
;
btrfs_end_transaction
(
trans
,
root
);
btrfs_end_transaction
(
trans
,
root
);
out_unlock:
mutex_unlock
(
&
root
->
fs_info
->
fs_mutex
);
return
err
;
return
err
;
}
}
static
void
btrfs_write_super
(
struct
super_block
*
sb
)
{
sb
->
s_dirt
=
0
;
printk
(
"btrfs write_super!
\n
"
);
filemap_flush
(
sb
->
s_bdev
->
bd_inode
->
i_mapping
);
}
static
int
btrfs_sync_fs
(
struct
super_block
*
sb
,
int
wait
)
static
int
btrfs_sync_fs
(
struct
super_block
*
sb
,
int
wait
)
{
{
struct
btrfs_trans_handle
*
trans
;
struct
btrfs_trans_handle
*
trans
;
...
@@ -479,17 +475,29 @@ static int btrfs_sync_fs(struct super_block *sb, int wait)
...
@@ -479,17 +475,29 @@ static int btrfs_sync_fs(struct super_block *sb, int wait)
int
ret
;
int
ret
;
sb
->
s_dirt
=
0
;
sb
->
s_dirt
=
0
;
if
(
!
wait
)
{
filemap_flush
(
sb
->
s_bdev
->
bd_inode
->
i_mapping
);
return
0
;
return
0
;
}
filemap_write_and_wait
(
sb
->
s_bdev
->
bd_inode
->
i_mapping
);
root
=
btrfs_sb
(
sb
);
root
=
btrfs_sb
(
sb
);
mutex_lock
(
&
root
->
fs_info
->
fs_mutex
);
trans
=
btrfs_start_transaction
(
root
,
1
);
trans
=
btrfs_start_transaction
(
root
,
1
);
ret
=
btrfs_commit_transaction
(
trans
,
root
);
ret
=
btrfs_commit_transaction
(
trans
,
root
);
sb
->
s_dirt
=
0
;
sb
->
s_dirt
=
0
;
BUG_ON
(
ret
);
BUG_ON
(
ret
);
printk
(
"btrfs sync_fs
\n
"
);
printk
(
"btrfs sync_fs
\n
"
);
mutex_unlock
(
&
root
->
fs_info
->
fs_mutex
);
return
0
;
return
0
;
}
}
static
void
btrfs_write_super
(
struct
super_block
*
sb
)
{
btrfs_sync_fs
(
sb
,
1
);
}
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
*
dev_name
,
void
*
data
,
struct
vfsmount
*
mnt
)
int
flags
,
const
char
*
dev_name
,
void
*
data
,
struct
vfsmount
*
mnt
)
{
{
...
...
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