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
nexedi
linux
Commits
dd68c5de
Commit
dd68c5de
authored
Jan 31, 2004
by
Christoph Hellwig
Committed by
Christoph Hellwig
Jan 31, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[XFS] Simplify pagebuf_rele / pagebuf_free
SGI Modid: xfs-linux:xfs-kern:165500a
parent
9a5c2c0c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
49 deletions
+12
-49
fs/xfs/linux/xfs_buf.c
fs/xfs/linux/xfs_buf.c
+12
-49
No files found.
fs/xfs/linux/xfs_buf.c
View file @
dd68c5de
...
@@ -207,7 +207,6 @@ EXPORT_SYMBOL(pagebuf_trace_buf);
...
@@ -207,7 +207,6 @@ EXPORT_SYMBOL(pagebuf_trace_buf);
typedef
struct
{
typedef
struct
{
struct
list_head
pb_hash
;
struct
list_head
pb_hash
;
int
pb_count
;
spinlock_t
pb_hash_lock
;
spinlock_t
pb_hash_lock
;
}
pb_hash_t
;
}
pb_hash_t
;
...
@@ -378,26 +377,27 @@ _pagebuf_freepages(
...
@@ -378,26 +377,27 @@ _pagebuf_freepages(
}
}
/*
/*
*
_pagebuf_free_object
*
pagebuf_free
*
*
*
_pagebuf_free_object releases the contents specified buffer.
*
pagebuf_free releases the specified buffer. The modification
*
The modification
state of any associated pages is left unchanged.
* state of any associated pages is left unchanged.
*/
*/
void
void
_pagebuf_free_object
(
pagebuf_free
(
pb_hash_t
*
hash
,
/* hash bucket for buffer */
page_buf_t
*
pb
)
page_buf_t
*
pb
)
/* buffer to deallocate */
{
{
page_buf_flags_t
pb_flags
=
pb
->
pb_flags
;
page_buf_flags_t
pb_flags
=
pb
->
pb_flags
;
pb_hash_t
*
hash
;
PB_TRACE
(
pb
,
"free_object"
,
0
);
PB_TRACE
(
pb
,
"free_object"
,
0
);
pb
->
pb_flags
|=
PBF_FREED
;
pb
->
pb_flags
|=
PBF_FREED
;
if
(
hash
)
{
if
(
pb
->
pb_flags
&
_PBF_LOCKABLE
)
{
if
(
!
list_empty
(
&
pb
->
pb_hash_list
))
{
hash
=
pb_hash
(
pb
);
hash
->
pb_count
--
;
spin_lock
(
&
hash
->
pb_hash_lock
);
if
(
!
list_empty
(
&
pb
->
pb_hash_list
))
list_del_init
(
&
pb
->
pb_hash_list
);
list_del_init
(
&
pb
->
pb_hash_list
);
}
spin_unlock
(
&
hash
->
pb_hash_lock
);
spin_unlock
(
&
hash
->
pb_hash_lock
);
}
}
...
@@ -668,7 +668,6 @@ _pagebuf_find( /* find buffer for block */
...
@@ -668,7 +668,6 @@ _pagebuf_find( /* find buffer for block */
_pagebuf_initialize
(
new_pb
,
target
,
range_base
,
_pagebuf_initialize
(
new_pb
,
target
,
range_base
,
range_length
,
flags
|
_PBF_LOCKABLE
);
range_length
,
flags
|
_PBF_LOCKABLE
);
new_pb
->
pb_hash_index
=
hval
;
new_pb
->
pb_hash_index
=
hval
;
h
->
pb_count
++
;
list_add
(
&
new_pb
->
pb_hash_list
,
&
h
->
pb_hash
);
list_add
(
&
new_pb
->
pb_hash_list
,
&
h
->
pb_hash
);
}
else
{
}
else
{
PB_STATS_INC
(
pb_miss_locked
);
PB_STATS_INC
(
pb_miss_locked
);
...
@@ -999,26 +998,6 @@ pagebuf_hold(
...
@@ -999,26 +998,6 @@ pagebuf_hold(
PB_TRACE
(
pb
,
"hold"
,
0
);
PB_TRACE
(
pb
,
"hold"
,
0
);
}
}
/*
* pagebuf_free
*
* pagebuf_free releases the specified buffer. The modification
* state of any associated pages is left unchanged.
*/
void
pagebuf_free
(
page_buf_t
*
pb
)
{
if
(
pb
->
pb_flags
&
_PBF_LOCKABLE
)
{
pb_hash_t
*
h
=
pb_hash
(
pb
);
spin_lock
(
&
h
->
pb_hash_lock
);
_pagebuf_free_object
(
h
,
pb
);
}
else
{
_pagebuf_free_object
(
NULL
,
pb
);
}
}
/*
/*
* pagebuf_rele
* pagebuf_rele
*
*
...
@@ -1029,44 +1008,28 @@ void
...
@@ -1029,44 +1008,28 @@ void
pagebuf_rele
(
pagebuf_rele
(
page_buf_t
*
pb
)
page_buf_t
*
pb
)
{
{
pb_hash_t
*
h
;
PB_TRACE
(
pb
,
"rele"
,
pb
->
pb_relse
);
PB_TRACE
(
pb
,
"rele"
,
pb
->
pb_relse
);
if
(
pb
->
pb_flags
&
_PBF_LOCKABLE
)
{
h
=
pb_hash
(
pb
);
spin_lock
(
&
h
->
pb_hash_lock
);
}
else
{
h
=
NULL
;
}
if
(
atomic_dec_and_test
(
&
pb
->
pb_hold
))
{
if
(
atomic_dec_and_test
(
&
pb
->
pb_hold
))
{
int
do_free
=
1
;
int
do_free
=
1
;
if
(
pb
->
pb_relse
)
{
if
(
pb
->
pb_relse
)
{
atomic_inc
(
&
pb
->
pb_hold
);
atomic_inc
(
&
pb
->
pb_hold
);
if
(
h
)
spin_unlock
(
&
h
->
pb_hash_lock
);
(
*
(
pb
->
pb_relse
))
(
pb
);
(
*
(
pb
->
pb_relse
))
(
pb
);
do_free
=
0
;
do_free
=
0
;
}
}
if
(
pb
->
pb_flags
&
PBF_DELWRI
)
{
if
(
pb
->
pb_flags
&
PBF_DELWRI
)
{
pb
->
pb_flags
|=
PBF_ASYNC
;
pb
->
pb_flags
|=
PBF_ASYNC
;
atomic_inc
(
&
pb
->
pb_hold
);
atomic_inc
(
&
pb
->
pb_hold
);
if
(
h
&&
do_free
)
spin_unlock
(
&
h
->
pb_hash_lock
);
pagebuf_delwri_queue
(
pb
,
0
);
pagebuf_delwri_queue
(
pb
,
0
);
do_free
=
0
;
do_free
=
0
;
}
else
if
(
pb
->
pb_flags
&
PBF_FS_MANAGED
)
{
}
else
if
(
pb
->
pb_flags
&
PBF_FS_MANAGED
)
{
if
(
h
)
spin_unlock
(
&
h
->
pb_hash_lock
);
do_free
=
0
;
do_free
=
0
;
}
}
if
(
do_free
)
{
if
(
do_free
)
{
_pagebuf_free_object
(
h
,
pb
);
pagebuf_free
(
pb
);
}
}
}
else
if
(
h
)
{
spin_unlock
(
&
h
->
pb_hash_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