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
76e3b390
Commit
76e3b390
authored
Oct 15, 2009
by
Sage Weil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ceph: move dirty caps code around
Cleanup only. Signed-off-by:
Sage Weil
<
sage@newdream.net
>
parent
8f3bc053
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
33 deletions
+37
-33
fs/ceph/caps.c
fs/ceph/caps.c
+37
-33
No files found.
fs/ceph/caps.c
View file @
76e3b390
...
...
@@ -1269,6 +1269,41 @@ static void ceph_flush_snaps(struct ceph_inode_info *ci)
spin_unlock
(
&
inode
->
i_lock
);
}
/*
* Mark caps dirty. If inode is newly dirty, add to the global dirty
* list.
*/
void
__ceph_mark_dirty_caps
(
struct
ceph_inode_info
*
ci
,
int
mask
)
{
struct
ceph_mds_client
*
mdsc
=
&
ceph_client
(
ci
->
vfs_inode
.
i_sb
)
->
mdsc
;
struct
inode
*
inode
=
&
ci
->
vfs_inode
;
int
was
=
ci
->
i_dirty_caps
;
int
dirty
=
0
;
dout
(
"__mark_dirty_caps %p %s dirty %s -> %s
\n
"
,
&
ci
->
vfs_inode
,
ceph_cap_string
(
mask
),
ceph_cap_string
(
was
),
ceph_cap_string
(
was
|
mask
));
ci
->
i_dirty_caps
|=
mask
;
if
(
was
==
0
)
{
dout
(
" inode %p now dirty
\n
"
,
&
ci
->
vfs_inode
);
BUG_ON
(
!
list_empty
(
&
ci
->
i_dirty_item
));
spin_lock
(
&
mdsc
->
cap_dirty_lock
);
list_add
(
&
ci
->
i_dirty_item
,
&
mdsc
->
cap_dirty
);
spin_unlock
(
&
mdsc
->
cap_dirty_lock
);
if
(
ci
->
i_flushing_caps
==
0
)
{
igrab
(
inode
);
dirty
|=
I_DIRTY_SYNC
;
}
}
BUG_ON
(
list_empty
(
&
ci
->
i_dirty_item
));
if
(((
was
|
ci
->
i_flushing_caps
)
&
CEPH_CAP_FILE_BUFFER
)
&&
(
mask
&
CEPH_CAP_FILE_BUFFER
))
dirty
|=
I_DIRTY_DATASYNC
;
if
(
dirty
)
__mark_inode_dirty
(
inode
,
dirty
);
__cap_delay_requeue
(
mdsc
,
ci
);
}
/*
* Add dirty inode to the flushing list. Assigned a seq number so we
* can wait for caps to flush without starving.
...
...
@@ -1557,39 +1592,6 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags,
up_read
(
&
mdsc
->
snap_rwsem
);
}
/*
* Mark caps dirty. If inode is newly dirty, add to the global dirty
* list.
*/
void
__ceph_mark_dirty_caps
(
struct
ceph_inode_info
*
ci
,
int
mask
)
{
struct
ceph_mds_client
*
mdsc
=
&
ceph_client
(
ci
->
vfs_inode
.
i_sb
)
->
mdsc
;
struct
inode
*
inode
=
&
ci
->
vfs_inode
;
int
was_dirty
=
ci
->
i_dirty_caps
;
int
dirty
=
0
;
dout
(
"__mark_dirty_caps %p %s dirty %s -> %s
\n
"
,
&
ci
->
vfs_inode
,
ceph_cap_string
(
mask
),
ceph_cap_string
(
ci
->
i_dirty_caps
),
ceph_cap_string
(
ci
->
i_dirty_caps
|
mask
));
ci
->
i_dirty_caps
|=
mask
;
if
(
!
was_dirty
)
{
dout
(
" inode %p now dirty
\n
"
,
&
ci
->
vfs_inode
);
spin_lock
(
&
mdsc
->
cap_dirty_lock
);
list_add
(
&
ci
->
i_dirty_item
,
&
mdsc
->
cap_dirty
);
spin_unlock
(
&
mdsc
->
cap_dirty_lock
);
if
(
ci
->
i_flushing_caps
==
0
)
{
igrab
(
inode
);
dirty
|=
I_DIRTY_SYNC
;
}
}
if
(((
was_dirty
|
ci
->
i_flushing_caps
)
&
CEPH_CAP_FILE_BUFFER
)
&&
(
mask
&
CEPH_CAP_FILE_BUFFER
))
dirty
|=
I_DIRTY_DATASYNC
;
if
(
dirty
)
__mark_inode_dirty
(
inode
,
dirty
);
__cap_delay_requeue
(
mdsc
,
ci
);
}
/*
* Try to flush dirty caps back to the auth mds.
*/
...
...
@@ -2370,6 +2372,8 @@ static void handle_cap_flush_ack(struct inode *inode,
dout
(
" inode %p now clean
\n
"
,
inode
);
BUG_ON
(
!
list_empty
(
&
ci
->
i_dirty_item
));
drop
=
1
;
}
else
{
BUG_ON
(
list_empty
(
&
ci
->
i_dirty_item
));
}
}
spin_unlock
(
&
mdsc
->
cap_dirty_lock
);
...
...
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