Re: [PATCH take 2 06/28] UBIFS: add journal replay

From: Marcin Slusarz
Date: Tue May 06 2008 - 18:06:27 EST


On Tue, May 06, 2008 at 01:35:37PM +0300, Artem Bityutskiy wrote:
> +/**
> + * insert_ref_node - insert a ref node to the replay tree.
> + * @c: UBIFS file-system description object
> + * @lnum: node logical eraseblock number
> + * @offs: node offset
> + * @sqnum: sequence number
> + * @free: amount of free space in bud
> + * @dirty: amount of dirty space from padding and deletion nodes
> + */
> +static int insert_ref_node(struct ubifs_info *c, int lnum, int offs,
> + unsigned long long sqnum, int free, int dirty)
> +{
> + struct rb_node **p = &c->replay_tree.rb_node, *parent = NULL;
> + struct replay_entry *r;
> + union ubifs_key key;
> + int cmp;
> +
> + dbg_mnt("add ref LEB %d:%d", lnum, offs);
> + highest_ino_key(c, &key, -1);
> + while (*p) {
> + parent = *p;
> + r = rb_entry(parent, struct replay_entry, rb);
> + cmp = keys_cmp(c, &key, &r->key);

return value of keys_cmp is never used in this function

> + if (sqnum < r->sqnum) {
> + p = &(*p)->rb_left;
> + continue;
> + } else if (sqnum > r->sqnum) {
> + p = &(*p)->rb_right;
> + continue;
> + }
> + ubifs_err("duplicate sqnum in r");
> + return -EINVAL;
> + }
> +
> + r = kzalloc(sizeof(struct replay_entry), GFP_KERNEL);
> + if (!r)
> + return -ENOMEM;
> +
> + r->lnum = lnum;
> + r->offs = offs;
> + r->sqnum = sqnum;
> + r->flags = REPLAY_REF;
> + r->free = free;
> + r->dirty = dirty;
> + key_copy(c, &key, &r->key);
> +
> + rb_link_node(&r->rb, parent, p);
> + rb_insert_color(&r->rb, &c->replay_tree);
> + return 0;
> +}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/