Exemplo n.º 1
0
int start_jbd_tx(struct jbd_kstm_tx *j, int commit) {
	int err = 0;
	if(j->durable && j->nblocks > 0 && commit) {
		struct _super_block *sb = tx_cache_get_super(j->sb);

#ifdef CONFIG_TX_KSTM_SYNC_DURABLE
		journal_force_commit(EXT3_SB(j->sb)->s_journal);
#endif

#ifdef CONFIG_TX_KSTM_XJBD_DYNAMIC
		j->handle =
			ext3_journal_start_sb(parent(sb), JBD_DEFAULT_GUESS);
#else
		/* Add a buffer credit for the superblock */
		j->nblocks++;
		j->handle =
			ext3_journal_start_sb(parent(sb), j->nblocks);
#endif

		if(IS_ERR(j->handle)) {
			err = PTR_ERR(j->handle);
			j->handle = NULL;
		}

#ifdef CONFIG_TX_KSTM_XJBD
		j->handle->h_extensible = 1;
#endif

		/* Mark this handle synchronous: anything we put it in should get
		 * written to the log by the time we finish with journal_stop */
		j->handle->h_sync = 1;
		j->durable = TX_COMMITTING_DURABLE;
	}

	j->nblocks = 0;

	return err;
}
Exemplo n.º 2
0
static int ocfs2_sync_file(struct file *file,
			   struct dentry *dentry,
			   int datasync)
{
	int err = 0;
	journal_t *journal;
	struct inode *inode = dentry->d_inode;
	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);

	mlog_entry("(0x%p, 0x%p, %d, '%.*s')\n", file, dentry, datasync,
		   dentry->d_name.len, dentry->d_name.name);

	err = ocfs2_sync_inode(dentry->d_inode);
	if (err)
		goto bail;

	journal = osb->journal->j_journal;
	err = journal_force_commit(journal);

bail:
	mlog_exit(err);

	return (err < 0) ? -EIO : 0;
}