Browse Source

ext4_journal: add jbd_trans_try_revoke_block routine.

pull/11/head
ngkaho1234 9 years ago
parent
commit
9fe8815522
  1. 22
      lwext4/ext4_journal.c
  2. 2
      lwext4/ext4_journal.h

22
lwext4/ext4_journal.c

@ -1222,6 +1222,28 @@ int jbd_trans_revoke_block(struct jbd_trans *trans,
return EOK; return EOK;
} }
/**@brief Try to add block to be revoked to a transaction.
* If @lba still remains in an transaction on checkpoint
* queue, add @lba as a revoked block to the transaction.
* @param trans transaction
* @param lba logical block address
* @return standard error code*/
int jbd_trans_try_revoke_block(struct jbd_trans *trans,
ext4_fsblk_t lba)
{
int r = EOK;
struct jbd_trans *tmp;
struct jbd_journal *journal = trans->journal;
TAILQ_FOREACH(tmp, &journal->cp_queue, trans_node) {
struct jbd_block_rec *block_rec =
jbd_trans_block_rec_lookup(trans, lba);
if (block_rec)
jbd_trans_revoke_block(trans, lba);
}
return r;
}
/**@brief Free a transaction /**@brief Free a transaction
* @param journal current journal session * @param journal current journal session
* @param trans transaction * @param trans transaction

2
lwext4/ext4_journal.h

@ -62,6 +62,8 @@ int jbd_trans_set_block_dirty(struct jbd_trans *trans,
struct ext4_block *block); struct ext4_block *block);
int jbd_trans_revoke_block(struct jbd_trans *trans, int jbd_trans_revoke_block(struct jbd_trans *trans,
ext4_fsblk_t lba); ext4_fsblk_t lba);
int jbd_trans_try_revoke_block(struct jbd_trans *trans,
ext4_fsblk_t lba);
void jbd_journal_free_trans(struct jbd_journal *journal, void jbd_journal_free_trans(struct jbd_journal *journal,
struct jbd_trans *trans, struct jbd_trans *trans,
bool abort); bool abort);

Loading…
Cancel
Save