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
9642d82c
Commit
9642d82c
authored
Jun 17, 2003
by
Andrew Morton
Committed by
Linus Torvalds
Jun 17, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] JBD: t_updates locking
Provide the designating locking for transaction_t.t_updates.
parent
48fdf3e6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
9 deletions
+25
-9
fs/jbd/commit.c
fs/jbd/commit.c
+5
-0
fs/jbd/transaction.c
fs/jbd/transaction.c
+20
-9
No files found.
fs/jbd/commit.c
View file @
9642d82c
...
...
@@ -82,11 +82,16 @@ void journal_commit_transaction(journal_t *journal)
commit_transaction
->
t_tid
);
commit_transaction
->
t_state
=
T_LOCKED
;
spin_lock
(
&
commit_transaction
->
t_handle_lock
);
while
(
commit_transaction
->
t_updates
!=
0
)
{
spin_unlock
(
&
commit_transaction
->
t_handle_lock
);
unlock_journal
(
journal
);
sleep_on
(
&
journal
->
j_wait_updates
);
lock_journal
(
journal
);
spin_lock
(
&
commit_transaction
->
t_handle_lock
);
}
spin_unlock
(
&
commit_transaction
->
t_handle_lock
);
J_ASSERT
(
commit_transaction
->
t_outstanding_credits
<=
journal
->
j_max_transaction_buffers
);
...
...
fs/jbd/transaction.c
View file @
9642d82c
...
...
@@ -196,9 +196,11 @@ static int start_this_handle(journal_t *journal, handle_t *handle)
* use and add the handle to the running transaction. */
handle
->
h_transaction
=
transaction
;
spin_lock
(
&
transaction
->
t_handle_lock
);
transaction
->
t_outstanding_credits
+=
nblocks
;
transaction
->
t_updates
++
;
transaction
->
t_handle_count
++
;
spin_unlock
(
&
transaction
->
t_handle_lock
);
jbd_debug
(
4
,
"Handle %p given %d credits (total %d, free %d)
\n
"
,
handle
,
nblocks
,
transaction
->
t_outstanding_credits
,
log_space_left
(
journal
));
...
...
@@ -363,18 +365,21 @@ int journal_restart(handle_t *handle, int nblocks)
if
(
is_handle_aborted
(
handle
))
return
0
;
/* First unlink the handle from its current transaction, and
* start the commit on that. */
J_ASSERT
(
transaction
->
t_updates
>
0
);
J_ASSERT
(
journal_current_handle
()
==
handle
);
/*
* First unlink the handle from its current transaction, and start the
* commit on that.
*/
J_ASSERT
(
transaction
->
t_updates
>
0
);
J_ASSERT
(
journal_current_handle
()
==
handle
);
lock_kernel
();
spin_lock
(
&
transaction
->
t_handle_lock
);
transaction
->
t_outstanding_credits
-=
handle
->
h_buffer_credits
;
transaction
->
t_updates
--
;
if
(
!
transaction
->
t_updates
)
wake_up
(
&
journal
->
j_wait_updates
);
spin_unlock
(
&
transaction
->
t_handle_lock
);
jbd_debug
(
2
,
"restarting handle %p
\n
"
,
handle
);
log_start_commit
(
journal
,
transaction
);
...
...
@@ -396,7 +401,7 @@ int journal_restart(handle_t *handle, int nblocks)
*
* The journal lock should not be held on entry.
*/
void
journal_lock_updates
(
journal_t
*
journal
)
void
journal_lock_updates
(
journal_t
*
journal
)
{
lock_journal
(
journal
);
...
...
@@ -409,9 +414,13 @@ void journal_lock_updates (journal_t *journal)
transaction_t
*
transaction
=
journal
->
j_running_transaction
;
if
(
!
transaction
)
break
;
if
(
!
transaction
->
t_updates
)
spin_lock
(
&
transaction
->
t_handle_lock
);
if
(
!
transaction
->
t_updates
)
{
spin_unlock
(
&
transaction
->
t_handle_lock
);
break
;
}
spin_unlock
(
&
transaction
->
t_handle_lock
);
unlock_journal
(
journal
);
sleep_on
(
&
journal
->
j_wait_updates
);
lock_journal
(
journal
);
...
...
@@ -1299,8 +1308,8 @@ int journal_stop(handle_t *handle)
if
(
!
handle
)
return
0
;
J_ASSERT
(
transaction
->
t_updates
>
0
);
J_ASSERT
(
journal_current_handle
()
==
handle
);
J_ASSERT
(
transaction
->
t_updates
>
0
);
J_ASSERT
(
journal_current_handle
()
==
handle
);
if
(
is_handle_aborted
(
handle
))
err
=
-
EIO
;
...
...
@@ -1334,6 +1343,7 @@ int journal_stop(handle_t *handle)
current
->
journal_info
=
NULL
;
lock_kernel
();
spin_lock
(
&
transaction
->
t_handle_lock
);
transaction
->
t_outstanding_credits
-=
handle
->
h_buffer_credits
;
transaction
->
t_updates
--
;
if
(
!
transaction
->
t_updates
)
{
...
...
@@ -1341,6 +1351,7 @@ int journal_stop(handle_t *handle)
if
(
journal
->
j_barrier_count
)
wake_up
(
&
journal
->
j_wait_transaction_locked
);
}
spin_unlock
(
&
transaction
->
t_handle_lock
);
/* Move callbacks from the handle to the transaction. */
list_splice
(
&
handle
->
h_jcb
,
&
transaction
->
t_jcb
);
...
...
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