Ejemplo n.º 1
0
static void entd_flush(struct super_block *super, struct wbq *rq)
{
	reiser4_context ctx;

	init_stack_context(&ctx, super);
	ctx.entd = 1;
	ctx.gfp_mask = GFP_NOFS;

	rq->wbc->range_start = page_offset(rq->page);
	rq->wbc->range_end = rq->wbc->range_start +
		(ENTD_CAPTURE_APAGE_BURST << PAGE_CACHE_SHIFT);


	rq->mapping->a_ops->writepages(rq->mapping, rq->wbc);

	if (rq->wbc->nr_to_write > 0) {
		long result;
		struct bdi_writeback *wb;
		struct wb_writeback_work work = {
			.sb		= super,
			.sync_mode	= WB_SYNC_NONE,
			.nr_pages	= LONG_MAX,
			.range_cyclic	= 0,
			.reason		= WB_REASON_TRY_TO_FREE_PAGES,
		};
		rq->wbc->sync_mode = work.sync_mode,
		rq->wbc->range_cyclic = work.range_cyclic,
		rq->wbc->range_start = 0;
		rq->wbc->range_end = LLONG_MAX;
		/*
		 * we don't need to pin superblock for writeback:
		 * this is implicitly pinned by write_page_by_ent
		 * (via igrab), so that shutdown_super() will wait
		 * (on reiser4_put_super) for entd completion.
		 */
		wb = &rq->mapping->backing_dev_info->wb;

		spin_lock(&wb->list_lock);
		result = generic_writeback_sb_inodes(super,
				             wb,
					     rq->wbc,
					     &work,
					     true);
		spin_unlock(&wb->list_lock);
	}
	rq->wbc->nr_to_write = ENTD_CAPTURE_APAGE_BURST;

	reiser4_writeout(super, rq->wbc);
	context_set_commit_async(&ctx);
	reiser4_exit_context(&ctx);
}
Ejemplo n.º 2
0
/* this is common implementation of vfs's fsync method of struct
   file_operations
*/
int reiser4_sync_common(struct file *file, struct dentry *dentry, int datasync)
{
	reiser4_context *ctx;
	int result;

	ctx = reiser4_init_context(dentry->d_inode->i_sb);
	if (IS_ERR(ctx))
		return PTR_ERR(ctx);
	result = txnmgr_force_commit_all(dentry->d_inode->i_sb, 0);

	context_set_commit_async(ctx);
	reiser4_exit_context(ctx);
	return result;
}