Merge branch 'for-linus' of git://git.infradead.org/ubifs-2.6
* 'for-linus' of git://git.infradead.org/ubifs-2.6: UBIFS: seek journal heads to the latest bud in replay UBIFS: do not free write-buffers when in R/O mode
···175175}176176177177/**178178- * ubifs_create_buds_lists - create journal head buds lists for remount rw.179179- * @c: UBIFS file-system description object180180- */181181-void ubifs_create_buds_lists(struct ubifs_info *c)182182-{183183- struct rb_node *p;184184-185185- spin_lock(&c->buds_lock);186186- p = rb_first(&c->buds);187187- while (p) {188188- struct ubifs_bud *bud = rb_entry(p, struct ubifs_bud, rb);189189- struct ubifs_jhead *jhead = &c->jheads[bud->jhead];190190-191191- list_add_tail(&bud->list, &jhead->buds_list);192192- p = rb_next(p);193193- }194194- spin_unlock(&c->buds_lock);195195-}196196-197197-/**198178 * ubifs_add_bud_to_log - add a new bud to the log.199179 * @c: UBIFS file-system description object200180 * @jhead: journal head the bud belongs to
+12-6
fs/ubifs/replay.c
···5959 * @new_size: truncation new size6060 * @free: amount of free space in a bud6161 * @dirty: amount of dirty space in a bud from padding and deletion nodes6262+ * @jhead: journal head number of the bud6263 *6364 * UBIFS journal replay must compare node sequence numbers, which means it must6465 * build a tree of node information to insert into the TNC.···8180 struct {8281 int free;8382 int dirty;8383+ int jhead;8484 };8585 };8686};···161159 err = PTR_ERR(lp);162160 goto out;163161 }162162+163163+ /* Make sure the journal head points to the latest bud */164164+ err = ubifs_wbuf_seek_nolock(&c->jheads[r->jhead].wbuf, r->lnum,165165+ c->leb_size - r->free, UBI_SHORTTERM);166166+164167out:165168 ubifs_release_lprops(c);166169 return err;···634627 ubifs_assert(sleb->endpt - offs >= used);635628 ubifs_assert(sleb->endpt % c->min_io_size == 0);636629637637- if (sleb->endpt + c->min_io_size <= c->leb_size && !c->ro_mount)638638- err = ubifs_wbuf_seek_nolock(&c->jheads[jhead].wbuf, lnum,639639- sleb->endpt, UBI_SHORTTERM);640640-641630 *dirty = sleb->endpt - offs - used;642631 *free = c->leb_size - sleb->endpt;643632···656653 * @sqnum: sequence number657654 * @free: amount of free space in bud658655 * @dirty: amount of dirty space from padding and deletion nodes656656+ * @jhead: journal head number for the bud659657 *660658 * This function inserts a reference node to the replay tree and returns zero661659 * in case of success or a negative error code in case of failure.662660 */663661static int insert_ref_node(struct ubifs_info *c, int lnum, int offs,664664- unsigned long long sqnum, int free, int dirty)662662+ unsigned long long sqnum, int free, int dirty,663663+ int jhead)665664{666665 struct rb_node **p = &c->replay_tree.rb_node, *parent = NULL;667666 struct replay_entry *r;···693688 r->flags = REPLAY_REF;694689 r->free = free;695690 r->dirty = dirty;691691+ r->jhead = jhead;696692697693 rb_link_node(&r->rb, parent, p);698694 rb_insert_color(&r->rb, &c->replay_tree);···718712 if (err)719713 return err;720714 err = insert_ref_node(c, b->bud->lnum, b->bud->start, b->sqnum,721721- free, dirty);715715+ free, dirty, b->bud->jhead);722716 if (err)723717 return err;724718 }
+4-11
fs/ubifs/super.c
···12571257 goto out_free;12581258 }1259125912601260+ err = alloc_wbufs(c);12611261+ if (err)12621262+ goto out_cbuf;12631263+12601264 sprintf(c->bgt_name, BGT_NAME_PATTERN, c->vi.ubi_num, c->vi.vol_id);12611265 if (!c->ro_mount) {12621262- err = alloc_wbufs(c);12631263- if (err)12641264- goto out_cbuf;12651265-12661266 /* Create background thread */12671267 c->bgt = kthread_create(ubifs_bg_thread, c, "%s", c->bgt_name);12681268 if (IS_ERR(c->bgt)) {···16311631 if (err)16321632 goto out;1633163316341634- err = alloc_wbufs(c);16351635- if (err)16361636- goto out;16371637-16381638- ubifs_create_buds_lists(c);16391639-16401634 /* Create background thread */16411635 c->bgt = kthread_create(ubifs_bg_thread, c, "%s", c->bgt_name);16421636 if (IS_ERR(c->bgt)) {···17381744 if (err)17391745 ubifs_ro_mode(c, err);1740174617411741- free_wbufs(c);17421747 vfree(c->orph_buf);17431748 c->orph_buf = NULL;17441749 kfree(c->write_reserve_buf);