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
4730a4bc
Commit
4730a4bc
authored
Mar 26, 2007
by
Chris Mason
Committed by
David Woodhouse
Mar 26, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
btrfs_dirty_inode
Signed-off-by:
Chris Mason
<
chris.mason@oracle.com
>
parent
b52d63fe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
5 deletions
+57
-5
fs/btrfs/super.c
fs/btrfs/super.c
+57
-5
No files found.
fs/btrfs/super.c
View file @
4730a4bc
...
...
@@ -242,6 +242,7 @@ static void reada_leaves(struct btrfs_root *root, struct btrfs_path *path)
}
}
static
int
btrfs_readdir
(
struct
file
*
filp
,
void
*
dirent
,
filldir_t
filldir
)
{
struct
inode
*
inode
=
filp
->
f_path
.
dentry
->
d_inode
;
...
...
@@ -392,6 +393,51 @@ static void fill_inode_item(struct btrfs_inode_item *item,
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
;
btrfs_init_path
(
&
path
);
ret
=
btrfs_lookup_inode
(
trans
,
root
,
&
path
,
inode
->
i_ino
,
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
);
mark_buffer_dirty
(
path
.
nodes
[
0
]);
failed:
btrfs_release_path
(
root
,
&
path
);
return
0
;
}
static
int
btrfs_write_inode
(
struct
inode
*
inode
,
int
wait
)
{
struct
btrfs_root
*
root
=
btrfs_sb
(
inode
->
i_sb
);
struct
btrfs_trans_handle
*
trans
;
int
ret
;
mutex_lock
(
&
root
->
fs_info
->
fs_mutex
);
trans
=
btrfs_start_transaction
(
root
,
1
);
ret
=
btrfs_update_inode
(
trans
,
root
,
inode
);
if
(
wait
)
btrfs_commit_transaction
(
trans
,
root
);
else
btrfs_end_transaction
(
trans
,
root
);
mutex_unlock
(
&
root
->
fs_info
->
fs_mutex
);
return
ret
;
}
static
struct
inode
*
btrfs_new_inode
(
struct
btrfs_trans_handle
*
trans
,
struct
inode
*
dir
,
int
mode
)
{
...
...
@@ -415,9 +461,6 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
inode
->
i_ino
=
objectid
;
inode
->
i_blocks
=
0
;
inode
->
i_mtime
=
inode
->
i_atime
=
inode
->
i_ctime
=
CURRENT_TIME_SEC
;
/* FIXME do this on link */
if
(
mode
&
S_IFDIR
)
inode
->
i_size
=
3
;
fill_inode_item
(
&
inode_item
,
inode
);
key
.
objectid
=
objectid
;
...
...
@@ -431,7 +474,6 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
BUG_ON
(
ret
);
insert_inode_hash
(
inode
);
// FIXME mark_inode_dirty(inode)
return
inode
;
}
...
...
@@ -443,6 +485,12 @@ static int btrfs_add_link(struct btrfs_trans_handle *trans,
dentry
->
d_name
.
name
,
dentry
->
d_name
.
len
,
dentry
->
d_parent
->
d_inode
->
i_ino
,
inode
->
i_ino
,
0
);
if
(
ret
==
0
)
{
dentry
->
d_parent
->
d_inode
->
i_size
+=
dentry
->
d_name
.
len
;
ret
=
btrfs_update_inode
(
trans
,
btrfs_sb
(
inode
->
i_sb
),
dentry
->
d_parent
->
d_inode
);
}
return
ret
;
}
...
...
@@ -502,6 +550,10 @@ static int btrfs_make_empty_dir(struct btrfs_trans_handle *trans,
goto
error
;
ret
=
btrfs_insert_dir_item
(
trans
,
root
,
buf
,
2
,
inode
->
i_ino
,
dir
->
i_ino
,
1
);
if
(
ret
)
goto
error
;
inode
->
i_size
=
3
;
ret
=
btrfs_update_inode
(
trans
,
root
,
inode
);
error:
return
ret
;
}
...
...
@@ -536,7 +588,6 @@ static int btrfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
if
(
err
)
goto
out_fail
;
d_instantiate
(
dentry
,
inode
);
mark_inode_dirty
(
inode
);
drop_on_err
=
0
;
out_fail:
...
...
@@ -600,6 +651,7 @@ static struct super_operations btrfs_super_ops = {
.
read_inode
=
btrfs_read_locked_inode
,
.
write_super
=
btrfs_write_super
,
.
sync_fs
=
btrfs_sync_fs
,
.
write_inode
=
btrfs_write_inode
,
};
static
struct
inode_operations
btrfs_dir_inode_operations
=
{
...
...
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