int journal_force_commit(journal_t *journal) { handle_t *handle; int ret; handle = journal_start(journal, 1); if (IS_ERR(handle)) { ret = PTR_ERR(handle); } else { handle->h_sync = 1; ret = journal_stop(handle); } return ret; }
static int _mlowerfs_ext3_journal_stop(handle_t *handle) { struct super_block *sb; int err; int rc; sb = handle->h_transaction->t_journal->j_private; err = handle->h_err; rc = journal_stop(handle); if (!err) err = rc; return err; }
int ocfs2_commit_trans(struct ocfs2_super *osb, handle_t *handle) { int ret; struct ocfs2_journal *journal = osb->journal; BUG_ON(!handle); ret = journal_stop(handle); if (ret < 0) mlog_errno(ret); up_read(&journal->j_trans_barrier); return ret; }
static int ext3fs_create(struct node *parent_node, struct node *node) { struct fs_driver *drv; struct ext2_fs_info *fsi; journal_handle_t *handle; int res = -1; if(NULL == (drv = fs_driver_find_drv(EXT2_NAME))) { return -1; } fsi = parent_node->nas->fs->fsi; /** * ext3_trans_blocks(1) - to modify parent_node's data block * 2 blocks for child = 1 inode + 1 inode bitmap. * 2 * (ext3_trans_blocks(1) + 2) blocks to create "." and ".." */ if (!(handle = journal_start(fsi->journal, 3 * (ext3_trans_blocks(1) + 2)))) { return -1; } res = drv->fsop->create_node(parent_node, node); journal_stop(handle); return res; }
static size_t ext3fs_write(struct file_desc *desc, void *buff, size_t size) { struct fs_driver *drv; int res; size_t datablocks; struct ext2_fs_info *fsi; journal_handle_t *handle; if (NULL == (drv = fs_driver_find_drv(EXT2_NAME))) { return -1; } assert(desc->node); fsi = desc->node->nas->fs->fsi; /* N * SECTOR_SIZE + K bytes of data can dirty N + 2 only if K >= 2 */ datablocks = (size + SECTOR_SIZE - 2) / SECTOR_SIZE + 1; /* TODO recalculate */ if (!(handle = journal_start(fsi->journal, 4 * ext3_trans_blocks(datablocks)))) { return -1; } res = drv->file_op->write(desc, buff, size); journal_stop(handle); return res; }
static int ext3fs_delete(struct node *node) { struct fs_driver *drv; struct ext2_fs_info *fsi; journal_handle_t *handle; int res; if(NULL == (drv = fs_driver_find_drv(EXT2_NAME))) { return -1; } fsi = node->nas->fs->fsi; /** * Same as in ext3fs_create: * ext3_trans_blocks(1) - to modify parent_node's data block * 2 blocks for child = 1 inode + 1 inode bitmap */ if (!(handle = journal_start(fsi->journal, ext3_trans_blocks(1) + 2))) { return -1; } res = drv->fsop->delete_node(node); journal_stop(handle); return res; }