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
ab5d6be1
Commit
ab5d6be1
authored
Jan 09, 2004
by
Nathan Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[XFS] Merge page_buf_locking routines in with the rest of page_buf.
SGI Modid: 2.5.x-xfs:slinx:162155a
parent
8a5d8dd8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
90 additions
and
12 deletions
+90
-12
fs/xfs/Makefile
fs/xfs/Makefile
+1
-3
fs/xfs/pagebuf/page_buf.c
fs/xfs/pagebuf/page_buf.c
+89
-9
No files found.
fs/xfs/Makefile
View file @
ab5d6be1
...
...
@@ -128,9 +128,7 @@ xfs-y += xfs_alloc.o \
xfs-$(CONFIG_XFS_TRACE)
+=
xfs_dir2_trace.o
# Objects in pagebuf/
xfs-y
+=
$(
addprefix
pagebuf/,
\
page_buf.o
\
page_buf_locking.o
)
xfs-y
+=
pagebuf/page_buf.o
# Objects in linux/
xfs-y
+=
$(
addprefix
linux/,
\
...
...
fs/xfs/pagebuf/page_buf.c
View file @
ab5d6be1
...
...
@@ -246,15 +246,6 @@ purge_addresses(void)
}
}
/*
* Locking model:
*
* Buffers associated with inodes for which buffer locking
* is not enabled are not protected by semaphores, and are
* assumed to be exclusively owned by the caller. There is
* spinlock in the buffer, for use by the caller when concurrent
* access is possible.
*/
/*
* Internal pagebuf object manipulation
...
...
@@ -1042,6 +1033,95 @@ pagebuf_rele(
}
/*
* Mutual exclusion on buffers. Locking model:
*
* Buffers associated with inodes for which buffer locking
* is not enabled are not protected by semaphores, and are
* assumed to be exclusively owned by the caller. There is a
* spinlock in the buffer, used by the caller when concurrent
* access is possible.
*/
/*
* pagebuf_cond_lock
*
* pagebuf_cond_lock locks a buffer object, if it is not already locked.
* Note that this in no way
* locks the underlying pages, so it is only useful for synchronizing
* concurrent use of page buffer objects, not for synchronizing independent
* access to the underlying pages.
*/
int
pagebuf_cond_lock
(
/* lock buffer, if not locked */
/* returns -EBUSY if locked) */
page_buf_t
*
pb
)
{
int
locked
;
ASSERT
(
pb
->
pb_flags
&
_PBF_LOCKABLE
);
locked
=
down_trylock
(
&
pb
->
pb_sema
)
==
0
;
if
(
locked
)
{
PB_SET_OWNER
(
pb
);
}
PB_TRACE
(
pb
,
PB_TRACE_REC
(
condlck
),
locked
);
return
(
locked
?
0
:
-
EBUSY
);
}
/*
* pagebuf_lock_value
*
* Return lock value for a pagebuf
*/
int
pagebuf_lock_value
(
page_buf_t
*
pb
)
{
ASSERT
(
pb
->
pb_flags
&
_PBF_LOCKABLE
);
return
(
atomic_read
(
&
pb
->
pb_sema
.
count
));
}
/*
* pagebuf_lock
*
* pagebuf_lock locks a buffer object. Note that this in no way
* locks the underlying pages, so it is only useful for synchronizing
* concurrent use of page buffer objects, not for synchronizing independent
* access to the underlying pages.
*/
int
pagebuf_lock
(
page_buf_t
*
pb
)
{
ASSERT
(
pb
->
pb_flags
&
_PBF_LOCKABLE
);
PB_TRACE
(
pb
,
PB_TRACE_REC
(
lock
),
0
);
if
(
atomic_read
(
&
pb
->
pb_io_remaining
))
blk_run_queues
();
down
(
&
pb
->
pb_sema
);
PB_SET_OWNER
(
pb
);
PB_TRACE
(
pb
,
PB_TRACE_REC
(
locked
),
0
);
return
0
;
}
/*
* pagebuf_unlock
*
* pagebuf_unlock releases the lock on the buffer object created by
* pagebuf_lock or pagebuf_cond_lock (not any
* pinning of underlying pages created by pagebuf_pin).
*/
void
pagebuf_unlock
(
/* unlock buffer */
page_buf_t
*
pb
)
/* buffer to unlock */
{
ASSERT
(
pb
->
pb_flags
&
_PBF_LOCKABLE
);
PB_CLEAR_OWNER
(
pb
);
up
(
&
pb
->
pb_sema
);
PB_TRACE
(
pb
,
PB_TRACE_REC
(
unlock
),
0
);
}
/*
* Pinning Buffer Storage in Memory
*/
...
...
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