Exemple #1
0
/* keep it simple for now by always updating both data structures */
errcode_t o2fsck_icount_set(o2fsck_icount *icount, uint64_t blkno, 
			    uint16_t count)
{
	icount_node *in;
	errcode_t ret = 0;

	if (count == 1)
		o2fsck_bitmap_set(icount->ic_single_bm, blkno, NULL);
	else
		o2fsck_bitmap_clear(icount->ic_single_bm, blkno, NULL);

	in = icount_search(icount, blkno, NULL);
	if (in) {
		if (count < 2) {
			rb_erase(&in->in_node, &icount->ic_multiple_tree);
			free(in);
		} else {
			in->in_icount = count;
		}
	} else if (count > 1) {
		in = calloc(1, sizeof(*in));
		if (in == NULL) {
			ret = OCFS2_ET_NO_MEMORY;
			goto out;
		}

		in->in_blkno = blkno;
		in->in_icount = count;
		icount_insert(icount, in);
	}

out:
	return ret;
}
Exemple #2
0
void o2fsck_mark_cluster_unallocated(o2fsck_state *ost, uint32_t cluster)
{
    int was_set;

    o2fsck_bitmap_clear(ost->ost_allocated_clusters, cluster, &was_set);
}