Lines Matching defs:bud
65 * @list: next bud in the list
66 * @bud: bud description object
68 * @free: free bytes in the bud
69 * @dirty: dirty bytes in the bud
73 struct ubifs_bud *bud;
80 * set_bud_lprops - set free and dirty space used by a bud.
82 * @b: bud entry which describes the bud
84 * This function makes sure the LEB properties of bud @b are set correctly
95 lp = ubifs_lpt_lookup_dirty(c, b->bud->lnum);
102 if (b->bud->start == 0 && (lp->free != c->leb_size || lp->dirty != 0)) {
108 * the LEB had been garbage collected before it became the bud,
122 dbg_mnt("bud LEB %d was GC'd (%d free, %d dirty)", b->bud->lnum,
124 dbg_gc("bud LEB %d was GC'd (%d free, %d dirty)", b->bud->lnum,
136 b->bud->lnum, lp->free, lp->dirty, b->free,
146 /* Make sure the journal head points to the latest bud */
147 err = ubifs_wbuf_seek_nolock(&c->jheads[b->bud->jhead].wbuf,
148 b->bud->lnum, c->leb_size - b->free);
505 * is_last_bud - check if the bud is the last in the journal head.
507 * @bud: bud description object
509 * This function checks if bud @bud is the last bud in its journal head. This
510 * information is then used by 'replay_bud()' to decide whether the bud can
512 * cuts. Returns %1 if this is the last bud, and %0 if not.
514 static int is_last_bud(struct ubifs_info *c, struct ubifs_bud *bud)
516 struct ubifs_jhead *jh = &c->jheads[bud->jhead];
521 if (list_is_last(&bud->list, &jh->buds_list))
528 * Normally, the last bud will be the last in the journal head's list
529 * of bud. However, there is one exception if the UBIFS image belongs
535 * before B, and B is the last, bud B is contains no data, and bud A is
537 * journal code switched the next bud (from A to B), it first added a
538 * log reference node for the new bud (B), and only after this it
539 * synchronized the write-buffer of current bud (A). But later this was
541 * the bud (A) before writing the log reference for the new bud (B).
545 * checking the contents of bud B - if it is empty, then A can be
551 next = list_entry(bud->list.next, struct ubifs_bud, list);
638 * the last bud though.
658 * replay_bud - replay a bud logical eraseblock.
660 * @b: bud entry which describes the bud
662 * This function replays bud @bud, recovers it if needed, and adds all nodes
663 * from this bud to the replay list. Returns zero in case of success and a
668 int is_last = is_last_bud(c, b->bud);
669 int err = 0, used = 0, lnum = b->bud->lnum, offs = b->bud->start;
674 dbg_mnt("replay bud LEB %d, head %d, offs %d, is_last %d",
675 lnum, b->bud->jhead, offs, is_last);
684 sleb = ubifs_recover_leb(c, lnum, offs, c->sbuf, b->bud->jhead);
690 n_nodes = authenticate_sleb(c, sleb, b->bud->log_hash, is_last);
696 ubifs_shash_copy_state(c, b->bud->log_hash,
697 c->jheads[b->bud->jhead].log_hash);
700 * The bud does not have to start from offset zero - the beginning of
711 * 'sleb->endpt' is used by bud data. We have to correctly calculate
805 ubifs_err(c, "unexpected node type %d in bud LEB %d:%d",
824 dbg_mnt("bud LEB %d replied: dirty %d, free %d",
879 * add_replay_bud - add a bud to the list of buds to replay.
881 * @lnum: bud logical eraseblock number to replay
882 * @offs: bud start offset
883 * @jhead: journal head to which this bud belongs
892 struct ubifs_bud *bud;
896 dbg_mnt("add replay bud LEB %d:%d, head %d", lnum, offs, jhead);
898 bud = kmalloc(sizeof(struct ubifs_bud), GFP_KERNEL);
899 if (!bud)
908 bud->lnum = lnum;
909 bud->start = offs;
910 bud->jhead = jhead;
911 bud->log_hash = ubifs_hash_get_desc(c);
912 if (IS_ERR(bud->log_hash)) {
913 err = PTR_ERR(bud->log_hash);
917 ubifs_shash_copy_state(c, c->log_hash, bud->log_hash);
919 ubifs_add_bud(c, bud);
921 b->bud = bud;
927 kfree(bud);
938 * This function returns %1 if a bud reference already exists for the LEB. %0 is
944 struct ubifs_bud *bud;
959 /* Make sure we have not already looked at this bud */
960 bud = ubifs_search_bud(c, lnum);
961 if (bud) {
962 if (bud->jhead == jhead && bud->start <= offs)
964 ubifs_err(c, "bud at LEB %d:%d was already referred", lnum, offs);
1085 break; /* Already have this bud */