示例#1
0
文件: info_obj.c 项目: juncgu/nvml
/*
 * lane_need_recovery_tx -- return 1 if transaction's section needs recovery
 */
static int
lane_need_recovery_tx(struct pmem_info *pip,
	struct lane_section_layout *layout)
{
	struct lane_tx_layout *section = (struct lane_tx_layout *)layout;

	int set_cache = 0;

	struct list_entry *entryp = PLIST_FIRST(pip->obj.pop,
			&section->undo_set_cache);
	if (entryp) {
		struct tx_range_cache *cache = ENTRY_TO_DATA(entryp);
		struct tx_range *range = (struct tx_range *)&cache->range[0];

		set_cache = (range->offset && range->size);
	}

	/*
	 * The transaction section needs recovery
	 * if state is not committed and
	 * any undo log not empty
	 */
	return section->state == TX_STATE_NONE &&
		(!PLIST_EMPTY(&section->undo_alloc) ||
		!PLIST_EMPTY(&section->undo_free) ||
		!PLIST_EMPTY(&section->undo_set) ||
		set_cache);
}
示例#2
0
文件: info_obj.c 项目: perone/nvml
/*
 * lane_need_recovery_tx -- return 1 if transaction's section needs recovery
 */
static int
lane_need_recovery_tx(struct pmem_info *pip,
		struct lane_section_layout *layout)
{
	struct lane_tx_layout *section = (struct lane_tx_layout *)layout;

	/*
	 * The transaction section needs recovery
	 * if state is not committed and
	 * any undo log not empty
	 */
	return section->state == TX_STATE_NONE &&
		(!PLIST_EMPTY(&section->undo_alloc) ||
		!PLIST_EMPTY(&section->undo_free) ||
		!PLIST_EMPTY(&section->undo_set));
}