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
2bc74feb
Commit
2bc74feb
authored
Oct 25, 2013
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
take read_seqbegin_or_lock() and friends to seqlock.h
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
b26d4cd3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
29 deletions
+29
-29
fs/dcache.c
fs/dcache.c
+0
-29
include/linux/seqlock.h
include/linux/seqlock.h
+29
-0
No files found.
fs/dcache.c
View file @
2bc74feb
...
@@ -88,35 +88,6 @@ EXPORT_SYMBOL(rename_lock);
...
@@ -88,35 +88,6 @@ EXPORT_SYMBOL(rename_lock);
static
struct
kmem_cache
*
dentry_cache
__read_mostly
;
static
struct
kmem_cache
*
dentry_cache
__read_mostly
;
/**
* read_seqbegin_or_lock - begin a sequence number check or locking block
* @lock: sequence lock
* @seq : sequence number to be checked
*
* First try it once optimistically without taking the lock. If that fails,
* take the lock. The sequence number is also used as a marker for deciding
* whether to be a reader (even) or writer (odd).
* N.B. seq must be initialized to an even number to begin with.
*/
static
inline
void
read_seqbegin_or_lock
(
seqlock_t
*
lock
,
int
*
seq
)
{
if
(
!
(
*
seq
&
1
))
/* Even */
*
seq
=
read_seqbegin
(
lock
);
else
/* Odd */
read_seqlock_excl
(
lock
);
}
static
inline
int
need_seqretry
(
seqlock_t
*
lock
,
int
seq
)
{
return
!
(
seq
&
1
)
&&
read_seqretry
(
lock
,
seq
);
}
static
inline
void
done_seqretry
(
seqlock_t
*
lock
,
int
seq
)
{
if
(
seq
&
1
)
read_sequnlock_excl
(
lock
);
}
/*
/*
* This is the single most critical data structure when it comes
* This is the single most critical data structure when it comes
* to the dcache: the hashtable for lookups. Somebody should try
* to the dcache: the hashtable for lookups. Somebody should try
...
...
include/linux/seqlock.h
View file @
2bc74feb
...
@@ -354,6 +354,35 @@ static inline void read_sequnlock_excl(seqlock_t *sl)
...
@@ -354,6 +354,35 @@ static inline void read_sequnlock_excl(seqlock_t *sl)
spin_unlock
(
&
sl
->
lock
);
spin_unlock
(
&
sl
->
lock
);
}
}
/**
* read_seqbegin_or_lock - begin a sequence number check or locking block
* @lock: sequence lock
* @seq : sequence number to be checked
*
* First try it once optimistically without taking the lock. If that fails,
* take the lock. The sequence number is also used as a marker for deciding
* whether to be a reader (even) or writer (odd).
* N.B. seq must be initialized to an even number to begin with.
*/
static
inline
void
read_seqbegin_or_lock
(
seqlock_t
*
lock
,
int
*
seq
)
{
if
(
!
(
*
seq
&
1
))
/* Even */
*
seq
=
read_seqbegin
(
lock
);
else
/* Odd */
read_seqlock_excl
(
lock
);
}
static
inline
int
need_seqretry
(
seqlock_t
*
lock
,
int
seq
)
{
return
!
(
seq
&
1
)
&&
read_seqretry
(
lock
,
seq
);
}
static
inline
void
done_seqretry
(
seqlock_t
*
lock
,
int
seq
)
{
if
(
seq
&
1
)
read_sequnlock_excl
(
lock
);
}
static
inline
void
read_seqlock_excl_bh
(
seqlock_t
*
sl
)
static
inline
void
read_seqlock_excl_bh
(
seqlock_t
*
sl
)
{
{
spin_lock_bh
(
&
sl
->
lock
);
spin_lock_bh
(
&
sl
->
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