diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-01 13:57:49 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-01 13:57:49 -0400 |
commit | 395d73413c5656c6d7706ae91dcb441f9b7e3074 (patch) | |
tree | 7fadabe996f70d7918583fa2312d4fad19397fcb /fs/jbd2/revoke.c | |
parent | c226fd659fa7b6a7b038df5ae6856a68514bacde (diff) | |
parent | 06705bff9114531a997a7d0c2520bea0f2927410 (diff) |
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: (33 commits)
ext4: Regularize mount options
ext4: fix locking typo in mballoc which could cause soft lockup hangs
ext4: fix typo which causes a memory leak on error path
jbd2: Update locking coments
ext4: Rename pa_linear to pa_type
ext4: add checks of block references for non-extent inodes
ext4: Check for an valid i_mode when reading the inode from disk
ext4: Use WRITE_SYNC for commits which are caused by fsync()
ext4: Add auto_da_alloc mount option
ext4: Use struct flex_groups to calculate get_orlov_stats()
ext4: Use atomic_t's in struct flex_groups
ext4: remove /proc tuning knobs
ext4: Add sysfs support
ext4: Track lifetime disk writes
ext4: Fix discard of inode prealloc space with delayed allocation.
ext4: Automatically allocate delay allocated blocks on rename
ext4: Automatically allocate delay allocated blocks on close
ext4: add EXT4_IOC_ALLOC_DA_BLKS ioctl
ext4: Simplify delalloc code by removing mpage_da_writepages()
ext4: Save stack space by removing fake buffer heads
...
Diffstat (limited to 'fs/jbd2/revoke.c')
-rw-r--r-- | fs/jbd2/revoke.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/fs/jbd2/revoke.c b/fs/jbd2/revoke.c index 257ff2625765..bbe6d592d8b3 100644 --- a/fs/jbd2/revoke.c +++ b/fs/jbd2/revoke.c | |||
@@ -55,6 +55,25 @@ | |||
55 | * need do nothing. | 55 | * need do nothing. |
56 | * RevokeValid set, Revoked set: | 56 | * RevokeValid set, Revoked set: |
57 | * buffer has been revoked. | 57 | * buffer has been revoked. |
58 | * | ||
59 | * Locking rules: | ||
60 | * We keep two hash tables of revoke records. One hashtable belongs to the | ||
61 | * running transaction (is pointed to by journal->j_revoke), the other one | ||
62 | * belongs to the committing transaction. Accesses to the second hash table | ||
63 | * happen only from the kjournald and no other thread touches this table. Also | ||
64 | * journal_switch_revoke_table() which switches which hashtable belongs to the | ||
65 | * running and which to the committing transaction is called only from | ||
66 | * kjournald. Therefore we need no locks when accessing the hashtable belonging | ||
67 | * to the committing transaction. | ||
68 | * | ||
69 | * All users operating on the hash table belonging to the running transaction | ||
70 | * have a handle to the transaction. Therefore they are safe from kjournald | ||
71 | * switching hash tables under them. For operations on the lists of entries in | ||
72 | * the hash table j_revoke_lock is used. | ||
73 | * | ||
74 | * Finally, also replay code uses the hash tables but at this moment noone else | ||
75 | * can touch them (filesystem isn't mounted yet) and hence no locking is | ||
76 | * needed. | ||
58 | */ | 77 | */ |
59 | 78 | ||
60 | #ifndef __KERNEL__ | 79 | #ifndef __KERNEL__ |
@@ -401,8 +420,6 @@ int jbd2_journal_revoke(handle_t *handle, unsigned long long blocknr, | |||
401 | * the second time we would still have a pending revoke to cancel. So, | 420 | * the second time we would still have a pending revoke to cancel. So, |
402 | * do not trust the Revoked bit on buffers unless RevokeValid is also | 421 | * do not trust the Revoked bit on buffers unless RevokeValid is also |
403 | * set. | 422 | * set. |
404 | * | ||
405 | * The caller must have the journal locked. | ||
406 | */ | 423 | */ |
407 | int jbd2_journal_cancel_revoke(handle_t *handle, struct journal_head *jh) | 424 | int jbd2_journal_cancel_revoke(handle_t *handle, struct journal_head *jh) |
408 | { | 425 | { |
@@ -480,10 +497,7 @@ void jbd2_journal_switch_revoke_table(journal_t *journal) | |||
480 | /* | 497 | /* |
481 | * Write revoke records to the journal for all entries in the current | 498 | * Write revoke records to the journal for all entries in the current |
482 | * revoke hash, deleting the entries as we go. | 499 | * revoke hash, deleting the entries as we go. |
483 | * | ||
484 | * Called with the journal lock held. | ||
485 | */ | 500 | */ |
486 | |||
487 | void jbd2_journal_write_revoke_records(journal_t *journal, | 501 | void jbd2_journal_write_revoke_records(journal_t *journal, |
488 | transaction_t *transaction) | 502 | transaction_t *transaction) |
489 | { | 503 | { |