• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/fs/hfsplus_journal/

Lines Matching defs:transaction

2  * linux/fs/transaction.c
12 * Generic filesystem transaction handling code; part of the ext2fs
33 * Simply allocate and initialise a new transaction. Create it in
35 * have an existing running transaction: we only make a new transaction
40 * new transaction and we can't block without protecting against other
47 get_transaction(hfsplus_jbd_t *journal, hfsplus_transaction_t *transaction)
49 transaction->t_journal = journal;
50 transaction->t_state = HFSPLUS_T_RUNNING;
51 transaction->t_tid = journal->j_transaction_sequence++;
52 transaction->t_expires = jiffies + journal->j_commit_interval;
53 spin_lock_init(&transaction->t_handle_lock);
55 /* Set up the commit timer for the new transaction. */
56 journal->j_commit_timer->expires = transaction->t_expires;
60 journal->j_running_transaction = transaction;
62 return transaction;
76 * to begin. Attach the handle to a transaction and set up the
77 * transaction's buffer credits.
82 hfsplus_transaction_t *transaction;
124 /* Wait on the journal's transaction barrier if necessary */
141 transaction = journal->j_running_transaction;
144 * If the current transaction is locked down for commit, wait for the
147 if (transaction->t_state == HFSPLUS_T_LOCKED) {
163 spin_lock(&transaction->t_handle_lock);
164 needed = transaction->t_outstanding_credits + nblocks;
168 * If the current transaction is already too large, then start
170 * a new transaction.
175 spin_unlock(&transaction->t_handle_lock);
178 __hfsplus__log_start_commit(journal, transaction->t_tid);
189 * associated with a committing transaction creates a deadlock,
194 * in the new transaction.
196 * The worst part is, any transaction currently committing can
204 * the committing transaction. Really, we only need to give it
212 spin_unlock(&transaction->t_handle_lock);
218 * use and add the handle to the running transaction. */
220 handle->h_transaction = transaction;
221 transaction->t_outstanding_credits += nblocks;
222 transaction->t_updates++;
223 transaction->t_handle_count++;
225 handle, nblocks, transaction->t_outstanding_credits,
227 spin_unlock(&transaction->t_handle_lock);
249 * @journal: Journal to start transaction on.
252 * We make sure that the transaction can guarantee at least nblocks of
308 * return code > 0 implies normal transaction-full status.
312 hfsplus_transaction_t *transaction = handle->h_transaction;
313 hfsplus_jbd_t *journal = transaction->t_journal;
325 /* Don't extend a locked-down transaction! */
328 "transaction not running\n", handle, nblocks);
332 spin_lock(&transaction->t_handle_lock);
333 wanted = transaction->t_outstanding_credits + nblocks;
337 "transaction too large\n", handle, nblocks);
348 transaction->t_outstanding_credits += nblocks;
353 spin_unlock(&transaction->t_handle_lock);
366 * Restart a handle for a multi-transaction filesystem
371 * handle's transaction so far and reattach the handle to a new
372 * transaction capabable of guaranteeing the requested number of
378 hfsplus_transaction_t *transaction = handle->h_transaction;
379 hfsplus_jbd_t *journal = transaction->t_journal;
389 * First unlink the handle from its current transaction, and start the
392 HFSPLUS_J_ASSERT(transaction->t_updates > 0);
397 spin_lock(&transaction->t_handle_lock);
398 transaction->t_outstanding_credits -= handle->h_buffer_credits;
399 transaction->t_updates--;
401 if (!transaction->t_updates)
403 spin_unlock(&transaction->t_handle_lock);
406 __hfsplus__log_start_commit(journal, transaction->t_tid);
416 * void hfsplus_jbd_lock_updates () - establish a transaction barrier.
434 hfsplus_transaction_t *transaction = journal->j_running_transaction;
436 if (!transaction)
439 spin_lock(&transaction->t_handle_lock);
440 if (!transaction->t_updates) {
441 spin_unlock(&transaction->t_handle_lock);
446 spin_unlock(&transaction->t_handle_lock);
467 * Release a transaction barrier obtained with hfsplus_jbd_lock_updates().
513 * If the buffer is already part of the current transaction, then there
515 * transaction which we are still committing to disk, then we need to
519 * part of the transaction, that is).
527 hfsplus_transaction_t *transaction;
536 transaction = handle->h_transaction;
537 journal = transaction->t_journal;
566 * transaction or the existing committing transaction?
570 jh->b_transaction == transaction ||
575 transaction);
596 * The buffer is already part of this transaction if b_transaction or
599 if (jh->b_transaction == transaction ||
600 jh->b_next_transaction == transaction)
610 jh->b_next_transaction = transaction;
616 if (jh->b_transaction && jh->b_transaction != transaction) {
617 HFSPLUS_JBUFFER_TRACE(jh, "owned by older transaction");
623 * If the committing transaction is currently writing
651 /* Only do the copy if the currently-owning transaction
653 * committing transaction is past that stage. The
662 * transaction, so we HAVE to force the frozen_data copy
687 jh->b_next_transaction = transaction;
697 HFSPLUS_JBUFFER_TRACE(jh, "no transaction");
699 jh->b_transaction = transaction;
702 __hfsplus_jbd_file_buffer(jh, transaction, HFSPLUS_BJ_Reserved);
737 * @handle: transaction to add buffer modifications to
767 * the bh is not already part of an existing transaction.
775 * @handle: transaction to new buffer to
782 hfsplus_transaction_t *transaction = handle->h_transaction;
783 hfsplus_jbd_t *journal = transaction->t_journal;
795 * The buffer may already belong to this transaction due to pre-zeroing
797 * committing transaction's lists, but it HAS to be in Forget state in
798 * that case: the transaction must have deleted the buffer for it to be
803 HFSPLUS_J_ASSERT_JH(jh, (jh->b_transaction == transaction ||
812 jh->b_transaction = transaction;
814 __hfsplus_jbd_file_buffer(jh, transaction, HFSPLUS_BJ_Reserved);
816 HFSPLUS_JBUFFER_TRACE(jh, "set next transaction");
817 jh->b_next_transaction = transaction;
839 * @handle: transaction
856 * We never need to know which transaction the committed data is part
858 * will be committed to a new transaction in due course, at which point
915 * current transaction.
916 * @handle: transaction
919 * The buffer is placed on the transaction's data list and is marked as
920 * belonging to the transaction.
946 * What if the buffer is already part of a running transaction?
949 * 1) It is part of the current running transaction. Refile it,
952 * 2) It is part of the previous, still-committing transaction.
954 * written to disk before this new transaction commits, then
955 * being sure that the *previous* transaction has this same
957 * transaction.
960 * --- that would violate write ordering (a transaction is free
962 * committing transaction has committed). The caller must
969 HFSPLUS_JBUFFER_TRACE(jh, "has transaction");
971 HFSPLUS_JBUFFER_TRACE(jh, "belongs to older transaction");
978 * in data=journal mode. The buffer's transaction has
997 * or shadow against the committing transaction. Now,
1002 * don't tie the page's buffers to the new transaction
1038 * transaction; move it to this one so
1049 * committing transaction, so might still be left on that
1050 * transaction's metadata lists.
1062 HFSPLUS_JBUFFER_TRACE(jh, "not on a transaction");
1079 * @handle: transaction to add buffer to.
1083 * transaction.
1085 * The buffer is placed on the transaction's metadata list and is marked
1086 * as belonging to the transaction.
1091 * current committing transaction (in which case we should have frozen
1093 * buffer: that only gets done when the old transaction finally
1098 hfsplus_transaction_t *transaction = handle->h_transaction;
1099 hfsplus_jbd_t *journal = transaction->t_journal;
1112 * of the transaction. This needs to be done
1113 * once a transaction -bzzz
1122 * on the running transaction's metadata list there is nothing to do.
1127 if (jh->b_transaction == transaction && jh->b_jlist == HFSPLUS_BJ_Metadata) {
1138 * Metadata already on the current transaction list doesn't
1139 * need to be filed. Metadata on another transaction's list must
1143 if (jh->b_transaction != transaction) {
1144 HFSPLUS_JBUFFER_TRACE(jh, "already on other transaction");
1145 hfsplus_jbd_debug(5, "already on other transaction\n");
1148 HFSPLUS_J_ASSERT_JH(jh, jh->b_next_transaction == transaction);
1150 * transaction's data buffer, ever. */
1183 * @handle: transaction handle
1187 * buffer. If the buffer is dirty in the current running transaction we
1200 hfsplus_transaction_t *transaction = handle->h_transaction;
1201 hfsplus_jbd_t *journal = transaction->t_journal;
1224 * The buffer's going from the transaction, we must drop
1233 * of this transaction, then we can just drop it from
1234 * the transaction immediately. */
1238 HFSPLUS_JBUFFER_TRACE(jh, "belongs to current transaction: unfile");
1244 * However, the commit of this transaction is still
1256 __hfsplus_jbd_file_buffer(jh, transaction, HFSPLUS_BJ_Forget);
1272 * (committing) transaction, we can't drop it yet... */
1273 HFSPLUS_JBUFFER_TRACE(jh, "belongs to older transaction");
1274 /* ... but we CAN drop it from the new transaction if we
1278 HFSPLUS_J_ASSERT(jh->b_next_transaction == transaction);
1297 * int hfsplus_jbd_stop() - complete a transaction
1303 * buffer credits to the transaction and remove the handle. The only
1310 * transaction began.
1314 hfsplus_transaction_t *transaction = handle->h_transaction;
1315 hfsplus_jbd_t *journal = transaction->t_journal;
1319 HFSPLUS_J_ASSERT(transaction->t_updates > 0);
1337 * Implement synchronous transaction batching. If the handle
1339 * yield and let another thread piggyback onto this transaction.
1347 old_handle_count = transaction->t_handle_count;
1349 } while (old_handle_count != transaction->t_handle_count);
1354 spin_lock(&transaction->t_handle_lock);
1355 transaction->t_outstanding_credits -= handle->h_buffer_credits;
1356 transaction->t_updates--;
1357 if (!transaction->t_updates) {
1366 * transaction is occupying too much of the log, or if the
1367 * transaction is too old now.
1370 transaction->t_outstanding_credits >
1372 time_after_eq(jiffies, transaction->t_expires)) {
1376 hfsplus_jbd_tid_t tid = transaction->t_tid;
1378 spin_unlock(&transaction->t_handle_lock);
1379 hfsplus_jbd_debug(2, "transaction too old, requesting commit for "
1382 __hfsplus__log_start_commit(journal, transaction->t_tid);
1392 spin_unlock(&transaction->t_handle_lock);
1425 * transaction buffer lists.
1430 * Append a buffer to a transaction list, given the transaction's list head
1454 * Remove a buffer from a transaction list, given the transaction's list
1475 * Remove a buffer from the appropriate transaction list.
1488 hfsplus_transaction_t *transaction;
1492 transaction = jh->b_transaction;
1493 if (transaction)
1494 assert_spin_locked(&transaction->t_journal->j_list_lock);
1498 HFSPLUS_J_ASSERT_JH(jh, transaction != 0);
1504 list = &transaction->t_sync_datalist;
1507 transaction->t_nr_buffers--;
1508 HFSPLUS_J_ASSERT_JH(jh, transaction->t_nr_buffers >= 0);
1509 list = &transaction->t_buffers;
1512 list = &transaction->t_forget;
1515 list = &transaction->t_iobuf_list;
1518 list = &transaction->t_shadow_list;
1521 list = &transaction->t_log_list;
1524 list = &transaction->t_reserved_list;
1527 list = &transaction->t_locked_list;
1612 * running transaction's ->t_datalist via __hfsplus_jbd_unfile_buffer.
1626 * while the data is part of a transaction. Yes?
1664 * This buffer is no longer needed. If it is on an older transaction's
1665 * checkpoint list we need to record it on this transaction's forget list
1666 * to pin this buffer (and hence its checkpointing transaction) down until
1667 * this transaction commits. If the buffer isn't on a checkpoint list, we
1675 static int __dispose_buffer(struct hfsplus_jbd_head *jh, hfsplus_transaction_t *transaction)
1683 HFSPLUS_JBUFFER_TRACE(jh, "on running+cp transaction");
1684 __hfsplus_jbd_file_buffer(jh, transaction, HFSPLUS_BJ_Forget);
1688 HFSPLUS_JBUFFER_TRACE(jh, "on running transaction");
1708 * attached to the current transaction: once the transaction commits,
1712 * previous, committing transaction!
1715 * transaction (and which therefore cannot be discarded immediately) are
1716 * not going to be reused in the new running transaction
1719 * allocated in one transaction and removed in the next will be marked
1721 * the next transaction to delete the block commits. This means that
1730 * transaction commit --- so it is always safe just to discard data
1737 * transaction.
1739 * We're outside-transaction here. Either or both of j_running_transaction
1744 hfsplus_transaction_t *transaction;
1768 transaction = jh->b_transaction;
1769 if (transaction == NULL) {
1770 /* First case: not on any transaction. If it
1775 HFSPLUS_JBUFFER_TRACE(jh, "not on any transaction: zap");
1789 /* ... and once the current transaction has
1801 /* There is no currently-running transaction. So the
1804 * the committing transaction, if it exists. */
1815 /* The orphan record's transaction has
1821 } else if (transaction == journal->j_committing_transaction) {
1824 * The buffer is on the committing transaction's locked
1828 may_free = __dispose_buffer(jh, transaction);
1834 * running transaction if that is set, but nothing
1836 HFSPLUS_JBUFFER_TRACE(jh, "on committing transaction");
1849 /* Good, the buffer belongs to the running transaction.
1850 * We are writing our own transaction's data, not any
1855 HFSPLUS_J_ASSERT_JH(jh, transaction == journal->j_running_transaction);
1856 may_free = __dispose_buffer(jh, transaction);
1927 * File a buffer on the given transaction list.
1930 hfsplus_transaction_t *transaction, int jlist)
1937 assert_spin_locked(&transaction->t_journal->j_list_lock);
1940 HFSPLUS_J_ASSERT_JH(jh, jh->b_transaction == transaction ||
1959 jh->b_transaction = transaction;
1967 list = &transaction->t_sync_datalist;
1970 transaction->t_nr_buffers++;
1971 list = &transaction->t_buffers;
1974 list = &transaction->t_forget;
1977 list = &transaction->t_iobuf_list;
1980 list = &transaction->t_shadow_list;
1983 list = &transaction->t_log_list;
1986 list = &transaction->t_reserved_list;
1989 list = &transaction->t_locked_list;
2001 hfsplus_transaction_t *transaction, int jlist)
2004 spin_lock(&transaction->t_journal->j_list_lock);
2005 __hfsplus_jbd_file_buffer(jh, transaction, jlist);
2006 spin_unlock(&transaction->t_journal->j_list_lock);
2012 * dropping it from its current transaction entirely. If the buffer has
2013 * already started to be used by a subsequent transaction, refile the
2014 * buffer on that transaction's metadata list.
2036 * It has been modified by a later transaction: add it to the new
2037 * transaction's metadata list.