Esempio n. 1
0
static int farm_end_recover(struct siocb *iocb)
{
    unsigned char snap_sha1[SHA1_LEN];
    unsigned char trunk_sha1[SHA1_LEN];
    int epoch = iocb->epoch - 1;

    if (epoch == 0)
        return SD_RES_SUCCESS;
    dprintf("epoch %d\n", epoch);
    if (trunk_file_write_recovery(trunk_sha1) < 0)
        return SD_RES_EIO;

    if (snap_file_write(epoch, trunk_sha1, snap_sha1, 0) < 0)
        return SD_RES_EIO;

    if (snap_log_write(iocb->epoch - 1, snap_sha1, 0) < 0)
        return SD_RES_EIO;

    return SD_RES_SUCCESS;
}
Esempio n. 2
0
File: farm.c Progetto: yamt/sheepdog
static int farm_end_recover(uint32_t old_epoch,
		struct vnode_info *old_vnode_info)
{
	unsigned char snap_sha1[SHA1_LEN];
	unsigned char trunk_sha1[SHA1_LEN];

	if (old_epoch == 0)
		return SD_RES_SUCCESS;

	dprintf("old epoch %d\n", old_epoch);

	if (trunk_file_write_recovery(trunk_sha1) < 0)
		return SD_RES_EIO;

	if (snap_file_write(old_epoch, old_vnode_info->nodes,
			    old_vnode_info->nr_nodes, trunk_sha1,
			    snap_sha1) < 0)
		return SD_RES_EIO;

	if (snap_log_write(old_epoch, snap_sha1, 0) < 0)
		return SD_RES_EIO;

	return SD_RES_SUCCESS;
}