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
f68cad0f
Commit
f68cad0f
authored
Apr 24, 2007
by
Chris Mason
Committed by
David Woodhouse
Apr 24, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Btrfs: fixup dirty_inode related deadlocks
Signed-off-by:
Chris Mason
<
chris.mason@oracle.com
>
parent
c62a1920
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
53 deletions
+56
-53
fs/btrfs/super.c
fs/btrfs/super.c
+56
-53
No files found.
fs/btrfs/super.c
View file @
f68cad0f
...
...
@@ -120,6 +120,58 @@ static void btrfs_read_locked_inode(struct inode *inode)
make_bad_inode
(
inode
);
}
static
void
fill_inode_item
(
struct
btrfs_inode_item
*
item
,
struct
inode
*
inode
)
{
btrfs_set_inode_uid
(
item
,
inode
->
i_uid
);
btrfs_set_inode_gid
(
item
,
inode
->
i_gid
);
btrfs_set_inode_size
(
item
,
inode
->
i_size
);
btrfs_set_inode_mode
(
item
,
inode
->
i_mode
);
btrfs_set_inode_nlink
(
item
,
inode
->
i_nlink
);
btrfs_set_timespec_sec
(
&
item
->
atime
,
inode
->
i_atime
.
tv_sec
);
btrfs_set_timespec_nsec
(
&
item
->
atime
,
inode
->
i_atime
.
tv_nsec
);
btrfs_set_timespec_sec
(
&
item
->
mtime
,
inode
->
i_mtime
.
tv_sec
);
btrfs_set_timespec_nsec
(
&
item
->
mtime
,
inode
->
i_mtime
.
tv_nsec
);
btrfs_set_timespec_sec
(
&
item
->
ctime
,
inode
->
i_ctime
.
tv_sec
);
btrfs_set_timespec_nsec
(
&
item
->
ctime
,
inode
->
i_ctime
.
tv_nsec
);
btrfs_set_inode_nblocks
(
item
,
inode
->
i_blocks
);
btrfs_set_inode_generation
(
item
,
inode
->
i_generation
);
}
static
int
btrfs_update_inode
(
struct
btrfs_trans_handle
*
trans
,
struct
btrfs_root
*
root
,
struct
inode
*
inode
)
{
struct
btrfs_inode_item
*
inode_item
;
struct
btrfs_path
*
path
;
int
ret
;
path
=
btrfs_alloc_path
();
BUG_ON
(
!
path
);
btrfs_init_path
(
path
);
ret
=
btrfs_lookup_inode
(
trans
,
root
,
path
,
&
BTRFS_I
(
inode
)
->
location
,
1
);
if
(
ret
)
{
if
(
ret
>
0
)
ret
=
-
ENOENT
;
goto
failed
;
}
inode_item
=
btrfs_item_ptr
(
btrfs_buffer_leaf
(
path
->
nodes
[
0
]),
path
->
slots
[
0
],
struct
btrfs_inode_item
);
fill_inode_item
(
inode_item
,
inode
);
btrfs_mark_buffer_dirty
(
path
->
nodes
[
0
]);
ret
=
0
;
failed:
btrfs_release_path
(
root
,
path
);
btrfs_free_path
(
path
);
return
ret
;
}
static
int
btrfs_unlink_trans
(
struct
btrfs_trans_handle
*
trans
,
struct
btrfs_root
*
root
,
struct
inode
*
dir
,
...
...
@@ -166,10 +218,11 @@ static int btrfs_unlink_trans(struct btrfs_trans_handle *trans,
dentry
->
d_inode
->
i_ctime
=
dir
->
i_ctime
;
err:
btrfs_free_path
(
path
);
if
(
ret
==
0
)
{
inode_dec_link_count
(
dentry
->
d_inode
);
if
(
!
ret
)
{
dir
->
i_size
-=
name_len
*
2
;
mark_inode_dirty
(
dir
);
btrfs_update_inode
(
trans
,
root
,
dir
);
drop_nlink
(
dentry
->
d_inode
);
btrfs_update_inode
(
trans
,
root
,
dentry
->
d_inode
);
}
return
ret
;
}
...
...
@@ -668,56 +721,6 @@ static int btrfs_fill_super(struct super_block * sb, void * data, int silent)
return
0
;
}
static
void
fill_inode_item
(
struct
btrfs_inode_item
*
item
,
struct
inode
*
inode
)
{
btrfs_set_inode_uid
(
item
,
inode
->
i_uid
);
btrfs_set_inode_gid
(
item
,
inode
->
i_gid
);
btrfs_set_inode_size
(
item
,
inode
->
i_size
);
btrfs_set_inode_mode
(
item
,
inode
->
i_mode
);
btrfs_set_inode_nlink
(
item
,
inode
->
i_nlink
);
btrfs_set_timespec_sec
(
&
item
->
atime
,
inode
->
i_atime
.
tv_sec
);
btrfs_set_timespec_nsec
(
&
item
->
atime
,
inode
->
i_atime
.
tv_nsec
);
btrfs_set_timespec_sec
(
&
item
->
mtime
,
inode
->
i_mtime
.
tv_sec
);
btrfs_set_timespec_nsec
(
&
item
->
mtime
,
inode
->
i_mtime
.
tv_nsec
);
btrfs_set_timespec_sec
(
&
item
->
ctime
,
inode
->
i_ctime
.
tv_sec
);
btrfs_set_timespec_nsec
(
&
item
->
ctime
,
inode
->
i_ctime
.
tv_nsec
);
btrfs_set_inode_nblocks
(
item
,
inode
->
i_blocks
);
btrfs_set_inode_generation
(
item
,
inode
->
i_generation
);
}
static
int
btrfs_update_inode
(
struct
btrfs_trans_handle
*
trans
,
struct
btrfs_root
*
root
,
struct
inode
*
inode
)
{
struct
btrfs_inode_item
*
inode_item
;
struct
btrfs_path
*
path
;
int
ret
;
path
=
btrfs_alloc_path
();
BUG_ON
(
!
path
);
btrfs_init_path
(
path
);
ret
=
btrfs_lookup_inode
(
trans
,
root
,
path
,
&
BTRFS_I
(
inode
)
->
location
,
1
);
if
(
ret
)
{
if
(
ret
>
0
)
ret
=
-
ENOENT
;
goto
failed
;
}
inode_item
=
btrfs_item_ptr
(
btrfs_buffer_leaf
(
path
->
nodes
[
0
]),
path
->
slots
[
0
],
struct
btrfs_inode_item
);
fill_inode_item
(
inode_item
,
inode
);
btrfs_mark_buffer_dirty
(
path
->
nodes
[
0
]);
ret
=
0
;
failed:
btrfs_release_path
(
root
,
path
);
btrfs_free_path
(
path
);
return
ret
;
}
static
int
btrfs_write_inode
(
struct
inode
*
inode
,
int
wait
)
{
struct
btrfs_root
*
root
=
BTRFS_I
(
inode
)
->
root
;
...
...
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