diff options
author | Jiri Kosina <jkosina@suse.cz> | 2011-05-18 11:06:31 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2011-05-18 11:06:49 -0400 |
commit | 6b7b8e488bbdedeccabdd001a78ffcbe43bb8a3a (patch) | |
tree | f2f77cc31b4548745778fca6a51b09e1d8a49804 /fs/jbd2 | |
parent | b50f315cbb865079a16a12fd9ae6083f98fd592c (diff) | |
parent | c1d10d18c542278b7fbc413c289d3cb6219da6b3 (diff) |
Merge branch 'master' into upstream.
This is sync with Linus' tree to receive KEY_IMAGES definition
that went in through input tree.
Diffstat (limited to 'fs/jbd2')
-rw-r--r-- | fs/jbd2/commit.c | 28 | ||||
-rw-r--r-- | fs/jbd2/journal.c | 7 | ||||
-rw-r--r-- | fs/jbd2/revoke.c | 2 | ||||
-rw-r--r-- | fs/jbd2/transaction.c | 2 |
4 files changed, 20 insertions, 19 deletions
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index f3ad1598b201..6e28000a4b21 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c | |||
@@ -105,6 +105,8 @@ static int journal_submit_commit_record(journal_t *journal, | |||
105 | int ret; | 105 | int ret; |
106 | struct timespec now = current_kernel_time(); | 106 | struct timespec now = current_kernel_time(); |
107 | 107 | ||
108 | *cbh = NULL; | ||
109 | |||
108 | if (is_journal_aborted(journal)) | 110 | if (is_journal_aborted(journal)) |
109 | return 0; | 111 | return 0; |
110 | 112 | ||
@@ -137,9 +139,9 @@ static int journal_submit_commit_record(journal_t *journal, | |||
137 | if (journal->j_flags & JBD2_BARRIER && | 139 | if (journal->j_flags & JBD2_BARRIER && |
138 | !JBD2_HAS_INCOMPAT_FEATURE(journal, | 140 | !JBD2_HAS_INCOMPAT_FEATURE(journal, |
139 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)) | 141 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)) |
140 | ret = submit_bh(WRITE_SYNC_PLUG | WRITE_FLUSH_FUA, bh); | 142 | ret = submit_bh(WRITE_SYNC | WRITE_FLUSH_FUA, bh); |
141 | else | 143 | else |
142 | ret = submit_bh(WRITE_SYNC_PLUG, bh); | 144 | ret = submit_bh(WRITE_SYNC, bh); |
143 | 145 | ||
144 | *cbh = bh; | 146 | *cbh = bh; |
145 | return ret; | 147 | return ret; |
@@ -329,7 +331,7 @@ void jbd2_journal_commit_transaction(journal_t *journal) | |||
329 | int tag_bytes = journal_tag_bytes(journal); | 331 | int tag_bytes = journal_tag_bytes(journal); |
330 | struct buffer_head *cbh = NULL; /* For transactional checksums */ | 332 | struct buffer_head *cbh = NULL; /* For transactional checksums */ |
331 | __u32 crc32_sum = ~0; | 333 | __u32 crc32_sum = ~0; |
332 | int write_op = WRITE_SYNC; | 334 | struct blk_plug plug; |
333 | 335 | ||
334 | /* | 336 | /* |
335 | * First job: lock down the current transaction and wait for | 337 | * First job: lock down the current transaction and wait for |
@@ -363,13 +365,6 @@ void jbd2_journal_commit_transaction(journal_t *journal) | |||
363 | write_lock(&journal->j_state_lock); | 365 | write_lock(&journal->j_state_lock); |
364 | commit_transaction->t_state = T_LOCKED; | 366 | commit_transaction->t_state = T_LOCKED; |
365 | 367 | ||
366 | /* | ||
367 | * Use plugged writes here, since we want to submit several before | ||
368 | * we unplug the device. We don't do explicit unplugging in here, | ||
369 | * instead we rely on sync_buffer() doing the unplug for us. | ||
370 | */ | ||
371 | if (commit_transaction->t_synchronous_commit) | ||
372 | write_op = WRITE_SYNC_PLUG; | ||
373 | trace_jbd2_commit_locking(journal, commit_transaction); | 368 | trace_jbd2_commit_locking(journal, commit_transaction); |
374 | stats.run.rs_wait = commit_transaction->t_max_wait; | 369 | stats.run.rs_wait = commit_transaction->t_max_wait; |
375 | stats.run.rs_locked = jiffies; | 370 | stats.run.rs_locked = jiffies; |
@@ -410,7 +405,7 @@ void jbd2_journal_commit_transaction(journal_t *journal) | |||
410 | * we do not require it to remember exactly which old buffers it | 405 | * we do not require it to remember exactly which old buffers it |
411 | * has reserved. This is consistent with the existing behaviour | 406 | * has reserved. This is consistent with the existing behaviour |
412 | * that multiple jbd2_journal_get_write_access() calls to the same | 407 | * that multiple jbd2_journal_get_write_access() calls to the same |
413 | * buffer are perfectly permissable. | 408 | * buffer are perfectly permissible. |
414 | */ | 409 | */ |
415 | while (commit_transaction->t_reserved_list) { | 410 | while (commit_transaction->t_reserved_list) { |
416 | jh = commit_transaction->t_reserved_list; | 411 | jh = commit_transaction->t_reserved_list; |
@@ -469,8 +464,10 @@ void jbd2_journal_commit_transaction(journal_t *journal) | |||
469 | if (err) | 464 | if (err) |
470 | jbd2_journal_abort(journal, err); | 465 | jbd2_journal_abort(journal, err); |
471 | 466 | ||
467 | blk_start_plug(&plug); | ||
472 | jbd2_journal_write_revoke_records(journal, commit_transaction, | 468 | jbd2_journal_write_revoke_records(journal, commit_transaction, |
473 | write_op); | 469 | WRITE_SYNC); |
470 | blk_finish_plug(&plug); | ||
474 | 471 | ||
475 | jbd_debug(3, "JBD: commit phase 2\n"); | 472 | jbd_debug(3, "JBD: commit phase 2\n"); |
476 | 473 | ||
@@ -497,6 +494,7 @@ void jbd2_journal_commit_transaction(journal_t *journal) | |||
497 | err = 0; | 494 | err = 0; |
498 | descriptor = NULL; | 495 | descriptor = NULL; |
499 | bufs = 0; | 496 | bufs = 0; |
497 | blk_start_plug(&plug); | ||
500 | while (commit_transaction->t_buffers) { | 498 | while (commit_transaction->t_buffers) { |
501 | 499 | ||
502 | /* Find the next buffer to be journaled... */ | 500 | /* Find the next buffer to be journaled... */ |
@@ -658,7 +656,7 @@ start_journal_io: | |||
658 | clear_buffer_dirty(bh); | 656 | clear_buffer_dirty(bh); |
659 | set_buffer_uptodate(bh); | 657 | set_buffer_uptodate(bh); |
660 | bh->b_end_io = journal_end_buffer_io_sync; | 658 | bh->b_end_io = journal_end_buffer_io_sync; |
661 | submit_bh(write_op, bh); | 659 | submit_bh(WRITE_SYNC, bh); |
662 | } | 660 | } |
663 | cond_resched(); | 661 | cond_resched(); |
664 | stats.run.rs_blocks_logged += bufs; | 662 | stats.run.rs_blocks_logged += bufs; |
@@ -699,6 +697,8 @@ start_journal_io: | |||
699 | __jbd2_journal_abort_hard(journal); | 697 | __jbd2_journal_abort_hard(journal); |
700 | } | 698 | } |
701 | 699 | ||
700 | blk_finish_plug(&plug); | ||
701 | |||
702 | /* Lo and behold: we have just managed to send a transaction to | 702 | /* Lo and behold: we have just managed to send a transaction to |
703 | the log. Before we can commit it, wait for the IO so far to | 703 | the log. Before we can commit it, wait for the IO so far to |
704 | complete. Control buffers being written are on the | 704 | complete. Control buffers being written are on the |
@@ -808,7 +808,7 @@ wait_for_iobuf: | |||
808 | if (err) | 808 | if (err) |
809 | __jbd2_journal_abort_hard(journal); | 809 | __jbd2_journal_abort_hard(journal); |
810 | } | 810 | } |
811 | if (!err && !is_journal_aborted(journal)) | 811 | if (cbh) |
812 | err = journal_wait_on_commit_record(journal, cbh); | 812 | err = journal_wait_on_commit_record(journal, cbh); |
813 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, | 813 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, |
814 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT) && | 814 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT) && |
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index 90407b8fece7..e0ec3db1c395 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c | |||
@@ -917,7 +917,7 @@ journal_t * jbd2_journal_init_dev(struct block_device *bdev, | |||
917 | journal->j_wbufsize = n; | 917 | journal->j_wbufsize = n; |
918 | journal->j_wbuf = kmalloc(n * sizeof(struct buffer_head*), GFP_KERNEL); | 918 | journal->j_wbuf = kmalloc(n * sizeof(struct buffer_head*), GFP_KERNEL); |
919 | if (!journal->j_wbuf) { | 919 | if (!journal->j_wbuf) { |
920 | printk(KERN_ERR "%s: Cant allocate bhs for commit thread\n", | 920 | printk(KERN_ERR "%s: Can't allocate bhs for commit thread\n", |
921 | __func__); | 921 | __func__); |
922 | goto out_err; | 922 | goto out_err; |
923 | } | 923 | } |
@@ -983,7 +983,7 @@ journal_t * jbd2_journal_init_inode (struct inode *inode) | |||
983 | journal->j_wbufsize = n; | 983 | journal->j_wbufsize = n; |
984 | journal->j_wbuf = kmalloc(n * sizeof(struct buffer_head*), GFP_KERNEL); | 984 | journal->j_wbuf = kmalloc(n * sizeof(struct buffer_head*), GFP_KERNEL); |
985 | if (!journal->j_wbuf) { | 985 | if (!journal->j_wbuf) { |
986 | printk(KERN_ERR "%s: Cant allocate bhs for commit thread\n", | 986 | printk(KERN_ERR "%s: Can't allocate bhs for commit thread\n", |
987 | __func__); | 987 | __func__); |
988 | goto out_err; | 988 | goto out_err; |
989 | } | 989 | } |
@@ -2413,10 +2413,12 @@ const char *jbd2_dev_to_name(dev_t device) | |||
2413 | new_dev = kmalloc(sizeof(struct devname_cache), GFP_KERNEL); | 2413 | new_dev = kmalloc(sizeof(struct devname_cache), GFP_KERNEL); |
2414 | if (!new_dev) | 2414 | if (!new_dev) |
2415 | return "NODEV-ALLOCFAILURE"; /* Something non-NULL */ | 2415 | return "NODEV-ALLOCFAILURE"; /* Something non-NULL */ |
2416 | bd = bdget(device); | ||
2416 | spin_lock(&devname_cache_lock); | 2417 | spin_lock(&devname_cache_lock); |
2417 | if (devcache[i]) { | 2418 | if (devcache[i]) { |
2418 | if (devcache[i]->device == device) { | 2419 | if (devcache[i]->device == device) { |
2419 | kfree(new_dev); | 2420 | kfree(new_dev); |
2421 | bdput(bd); | ||
2420 | ret = devcache[i]->devname; | 2422 | ret = devcache[i]->devname; |
2421 | spin_unlock(&devname_cache_lock); | 2423 | spin_unlock(&devname_cache_lock); |
2422 | return ret; | 2424 | return ret; |
@@ -2425,7 +2427,6 @@ const char *jbd2_dev_to_name(dev_t device) | |||
2425 | } | 2427 | } |
2426 | devcache[i] = new_dev; | 2428 | devcache[i] = new_dev; |
2427 | devcache[i]->device = device; | 2429 | devcache[i]->device = device; |
2428 | bd = bdget(device); | ||
2429 | if (bd) { | 2430 | if (bd) { |
2430 | bdevname(bd, devcache[i]->devname); | 2431 | bdevname(bd, devcache[i]->devname); |
2431 | bdput(bd); | 2432 | bdput(bd); |
diff --git a/fs/jbd2/revoke.c b/fs/jbd2/revoke.c index 9ad321fd63fd..69fd93588118 100644 --- a/fs/jbd2/revoke.c +++ b/fs/jbd2/revoke.c | |||
@@ -71,7 +71,7 @@ | |||
71 | * switching hash tables under them. For operations on the lists of entries in | 71 | * switching hash tables under them. For operations on the lists of entries in |
72 | * the hash table j_revoke_lock is used. | 72 | * the hash table j_revoke_lock is used. |
73 | * | 73 | * |
74 | * Finally, also replay code uses the hash tables but at this moment noone else | 74 | * Finally, also replay code uses the hash tables but at this moment no one else |
75 | * can touch them (filesystem isn't mounted yet) and hence no locking is | 75 | * can touch them (filesystem isn't mounted yet) and hence no locking is |
76 | * needed. | 76 | * needed. |
77 | */ | 77 | */ |
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c index 1d1191050f99..05fa77a23711 100644 --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c | |||
@@ -1403,7 +1403,7 @@ int jbd2_journal_stop(handle_t *handle) | |||
1403 | 1403 | ||
1404 | /* | 1404 | /* |
1405 | * Once we drop t_updates, if it goes to zero the transaction | 1405 | * Once we drop t_updates, if it goes to zero the transaction |
1406 | * could start commiting on us and eventually disappear. So | 1406 | * could start committing on us and eventually disappear. So |
1407 | * once we do this, we must not dereference transaction | 1407 | * once we do this, we must not dereference transaction |
1408 | * pointer again. | 1408 | * pointer again. |
1409 | */ | 1409 | */ |