[sheepdog] [PATCH v4 15/18] collie/farm: implement farm
Liu Yuan
namei.unix at gmail.com
Fri May 17 11:16:31 CEST 2013
On 05/17/2013 02:27 PM, Kai Zhang wrote:
> +static struct vdi_entry *new_vdi(const char *name, uint64_t vdi_size,
> + uint32_t vdi_id, uint32_t snap_id,
> + uint8_t nr_copies)
> +{
> + struct vdi_entry *vdi;
> + vdi = xmalloc(sizeof(struct vdi_entry));
> + pstrcpy(vdi->name, sizeof(vdi->name), name);
> + vdi->vdi_size = vdi_size;
> + vdi->vdi_id = vdi_id;
> + vdi->snap_id = snap_id;
> + vdi->nr_copies = nr_copies;
> + INIT_LIST_HEAD(&vdi->list);
> + return vdi;
> +}
> +
> +static void insert_vdi(const char *name, uint64_t vdi_size,
> + uint32_t vdi_id, uint32_t snap_id,
> + uint8_t nr_copies)
> +{
> + struct vdi_entry *vdi;
> + vdi = find_vdi(name);
> + if (!vdi) {
> + vdi = new_vdi(name, vdi_size, vdi_id, snap_id, nr_copies);
> + list_add(&vdi->list, &last_snapshots.list);
> + } else if (vdi->snap_id < snap_id) {
> + vdi->vdi_size = vdi_size;
> + vdi->vdi_id = vdi_id;
> + vdi->snap_id = snap_id;
> + vdi->nr_copies = nr_copies;
> + }
pass inode directly to insert_vdi() as parameter will reduce the
parameter to 1.
Thanks,
Yuan
More information about the sheepdog
mailing list