-/**@brief Allocate a new transaction
- * @param journal current journal session
- * @return transaction allocated*/
-struct jbd_trans *
-jbd_journal_new_trans(struct jbd_journal *journal)
-{
- struct jbd_trans *trans = calloc(1, sizeof(struct jbd_trans));
- if (!trans)
- return NULL;
-
- /* We will assign a trans_id to this transaction,
- * once it has been committed.*/
- trans->journal = journal;
- trans->data_csum = EXT4_CRC32_INIT;
- trans->error = EOK;
- TAILQ_INIT(&trans->buf_queue);
- return trans;
-}
-
-/**@brief gain access to it before making any modications.
- * @param journal current journal session
- * @param trans transaction
- * @param block descriptor
- * @return standard error code.*/
-int jbd_trans_get_access(struct jbd_journal *journal,
- struct jbd_trans *trans,
- struct ext4_block *block)
-{
- int r = EOK;
- struct ext4_fs *fs = journal->jbd_fs->inode_ref.fs;
- struct jbd_buf *jbd_buf = block->buf->end_write_arg;
-
- /* If the buffer has already been modified, we should
- * flush dirty data in this buffer to disk.*/
- if (ext4_bcache_test_flag(block->buf, BC_DIRTY) &&
- block->buf->end_write == jbd_trans_end_write) {
- ext4_assert(jbd_buf);
- if (jbd_buf->trans != trans)
- r = ext4_block_flush_buf(fs->bdev, block->buf);
-
- }
- return r;
-}
-