Lines Matching defs:bud

23  * ubifs_search_bud - search bud LEB.
27 * This function searches bud LEB @lnum. Returns bud description object in case
28 * of success and %NULL if there is no bud with this LEB number.
33 struct ubifs_bud *bud;
38 bud = rb_entry(p, struct ubifs_bud, rb);
39 if (lnum < bud->lnum)
41 else if (lnum > bud->lnum)
45 return bud;
62 struct ubifs_bud *bud;
71 bud = rb_entry(p, struct ubifs_bud, rb);
72 if (lnum < bud->lnum)
74 else if (lnum > bud->lnum)
77 jhead = bud->jhead;
108 * ubifs_add_bud - add bud LEB to the tree of buds and its journal head list.
110 * @bud: the bud to add
112 void ubifs_add_bud(struct ubifs_info *c, struct ubifs_bud *bud)
123 ubifs_assert(c, bud->lnum != b->lnum);
124 if (bud->lnum < b->lnum)
130 rb_link_node(&bud->rb, parent, p);
131 rb_insert_color(&bud->rb, &c->buds);
133 jhead = &c->jheads[bud->jhead];
134 list_add_tail(&bud->list, &jhead->buds_list);
139 * Note, although this is a new bud, we anyway account this space now,
141 * guarantee fixed mount time, and this bud will anyway be read and
144 c->bud_bytes += c->leb_size - bud->start;
146 dbg_log("LEB %d:%d, jhead %s, bud_bytes %lld", bud->lnum,
147 bud->start, dbg_jhead(bud->jhead), c->bud_bytes);
152 * ubifs_add_bud_to_log - add a new bud to the log.
154 * @jhead: journal head the bud belongs to
155 * @lnum: LEB number of the bud
156 * @offs: starting offset of the bud
158 * This function writes a reference node for the new bud LEB @lnum to the log,
167 struct ubifs_bud *bud;
170 bud = kmalloc(sizeof(struct ubifs_bud), GFP_NOFS);
171 if (!bud)
175 kfree(bud);
205 dbg_log("bud bytes %lld (%lld max), require commit",
219 dbg_log("bud bytes %lld (%lld max), initiate BG commit",
224 bud->lnum = lnum;
225 bud->start = offs;
226 bud->jhead = jhead;
227 bud->log_hash = NULL;
230 ref->lnum = cpu_to_le32(bud->lnum);
231 ref->offs = cpu_to_le32(bud->start);
247 if (bud->start == 0) {
255 err = ubifs_leb_map(c, bud->lnum);
277 ubifs_add_bud(c, bud);
286 kfree(bud);
307 struct ubifs_bud *bud;
311 bud = rb_entry(p1, struct ubifs_bud, rb);
312 wbuf = &c->jheads[bud->jhead].wbuf;
314 if (wbuf->lnum == bud->lnum) {
319 c->cmt_bud_bytes += wbuf->offs - bud->start;
320 dbg_log("preserve %d:%d, jhead %s, bud bytes %d, cmt_bud_bytes %lld",
321 bud->lnum, bud->start, dbg_jhead(bud->jhead),
322 wbuf->offs - bud->start, c->cmt_bud_bytes);
323 bud->start = wbuf->offs;
325 c->cmt_bud_bytes += c->leb_size - bud->start;
326 dbg_log("remove %d:%d, jhead %s, bud bytes %d, cmt_bud_bytes %lld",
327 bud->lnum, bud->start, dbg_jhead(bud->jhead),
328 c->leb_size - bud->start, c->cmt_bud_bytes);
337 list_move(&bud->list, &c->old_buds);
520 struct ubifs_bud *bud;
522 bud = list_entry(c->old_buds.next, struct ubifs_bud, list);
523 err = ubifs_return_leb(c, bud->lnum);
526 list_del(&bud->list);
527 kfree(bud->log_hash);
528 kfree(bud);
733 * dbg_check_bud_bytes - make sure bud bytes calculation are all right.
743 struct ubifs_bud *bud;
751 list_for_each_entry(bud, &c->jheads[i].buds_list, list)
752 bud_bytes += c->leb_size - bud->start;