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
2e89f6eb
Commit
2e89f6eb
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: implement journal->j_tail locking
Implement the designed locking around journal->j_tail.
parent
23ce7898
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
6 deletions
+13
-6
fs/jbd/checkpoint.c
fs/jbd/checkpoint.c
+5
-3
fs/jbd/journal.c
fs/jbd/journal.c
+8
-3
No files found.
fs/jbd/checkpoint.c
View file @
2e89f6eb
...
...
@@ -416,13 +416,14 @@ int cleanup_journal_tail(journal_t *journal)
blocknr
=
journal
->
j_head
;
}
spin_unlock
(
&
journal
->
j_list_lock
);
spin_unlock
(
&
journal
->
j_state_lock
);
J_ASSERT
(
blocknr
!=
0
);
J_ASSERT
(
blocknr
!=
0
);
/* If the oldest pinned transaction is at the tail of the log
already then there's not much we can do right now. */
if
(
journal
->
j_tail_sequence
==
first_tid
)
if
(
journal
->
j_tail_sequence
==
first_tid
)
{
spin_unlock
(
&
journal
->
j_state_lock
);
return
1
;
}
/* OK, update the superblock to recover the freed space.
* Physical blocks come first: have we wrapped beyond the end of
...
...
@@ -439,6 +440,7 @@ int cleanup_journal_tail(journal_t *journal)
journal
->
j_free
+=
freed
;
journal
->
j_tail_sequence
=
first_tid
;
journal
->
j_tail
=
blocknr
;
spin_unlock
(
&
journal
->
j_state_lock
);
if
(
!
(
journal
->
j_flags
&
JFS_ABORT
))
journal_update_superblock
(
journal
,
1
);
return
0
;
...
...
fs/jbd/journal.c
View file @
2e89f6eb
...
...
@@ -850,12 +850,14 @@ void journal_update_superblock(journal_t *journal, int wait)
journal_superblock_t
*
sb
=
journal
->
j_superblock
;
struct
buffer_head
*
bh
=
journal
->
j_sb_buffer
;
spin_lock
(
&
journal
->
j_state_lock
);
jbd_debug
(
1
,
"JBD: updating superblock (start %ld, seq %d, errno %d)
\n
"
,
journal
->
j_tail
,
journal
->
j_tail_sequence
,
journal
->
j_errno
);
sb
->
s_sequence
=
htonl
(
journal
->
j_tail_sequence
);
sb
->
s_start
=
htonl
(
journal
->
j_tail
);
sb
->
s_errno
=
htonl
(
journal
->
j_errno
);
spin_unlock
(
&
journal
->
j_state_lock
);
BUFFER_TRACE
(
bh
,
"marking dirty"
);
mark_buffer_dirty
(
bh
);
...
...
@@ -1260,18 +1262,21 @@ int journal_flush(journal_t *journal)
* the magic code for a fully-recovered superblock. Any future
* commits of data to the journal will restore the current
* s_start value. */
spin_lock
(
&
journal
->
j_state_lock
);
old_tail
=
journal
->
j_tail
;
journal
->
j_tail
=
0
;
spin_unlock
(
&
journal
->
j_state_lock
);
journal_update_superblock
(
journal
,
1
);
spin_lock
(
&
journal
->
j_state_lock
);
journal
->
j_tail
=
old_tail
;
unlock_journal
(
journal
);
J_ASSERT
(
!
journal
->
j_running_transaction
);
J_ASSERT
(
!
journal
->
j_committing_transaction
);
J_ASSERT
(
!
journal
->
j_checkpoint_transactions
);
J_ASSERT
(
journal
->
j_head
==
journal
->
j_tail
);
J_ASSERT
(
journal
->
j_tail_sequence
==
journal
->
j_transaction_sequence
);
spin_unlock
(
&
journal
->
j_state_lock
);
unlock_journal
(
journal
);
return
err
;
}
...
...
@@ -1289,7 +1294,7 @@ int journal_flush(journal_t *journal)
* we merely suppress recovery.
*/
int
journal_wipe
(
journal_t
*
journal
,
int
write
)
int
journal_wipe
(
journal_t
*
journal
,
int
write
)
{
journal_superblock_t
*
sb
;
int
err
=
0
;
...
...
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