~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to fs/ubifs/log.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
100
100
}
101
101
 
102
102
/**
103
 
 * next_log_lnum - switch to the next log LEB.
104
 
 * @c: UBIFS file-system description object
105
 
 * @lnum: current log LEB
106
 
 */
107
 
static inline int next_log_lnum(const struct ubifs_info *c, int lnum)
108
 
{
109
 
        lnum += 1;
110
 
        if (lnum > c->log_last)
111
 
                lnum = UBIFS_LOG_LNUM;
112
 
 
113
 
        return lnum;
114
 
}
115
 
 
116
 
/**
117
103
 * empty_log_bytes - calculate amount of empty space in the log.
118
104
 * @c: UBIFS file-system description object
119
105
 */
175
161
}
176
162
 
177
163
/**
178
 
 * ubifs_create_buds_lists - create journal head buds lists for remount rw.
179
 
 * @c: UBIFS file-system description object
180
 
 */
181
 
void ubifs_create_buds_lists(struct ubifs_info *c)
182
 
{
183
 
        struct rb_node *p;
184
 
 
185
 
        spin_lock(&c->buds_lock);
186
 
        p = rb_first(&c->buds);
187
 
        while (p) {
188
 
                struct ubifs_bud *bud = rb_entry(p, struct ubifs_bud, rb);
189
 
                struct ubifs_jhead *jhead = &c->jheads[bud->jhead];
190
 
 
191
 
                list_add_tail(&bud->list, &jhead->buds_list);
192
 
                p = rb_next(p);
193
 
        }
194
 
        spin_unlock(&c->buds_lock);
195
 
}
196
 
 
197
 
/**
198
164
 * ubifs_add_bud_to_log - add a new bud to the log.
199
165
 * @c: UBIFS file-system description object
200
166
 * @jhead: journal head the bud belongs to
277
243
        ref->jhead = cpu_to_le32(jhead);
278
244
 
279
245
        if (c->lhead_offs > c->leb_size - c->ref_node_alsz) {
280
 
                c->lhead_lnum = next_log_lnum(c, c->lhead_lnum);
 
246
                c->lhead_lnum = ubifs_next_log_lnum(c, c->lhead_lnum);
281
247
                c->lhead_offs = 0;
282
248
        }
283
249
 
445
411
 
446
412
        /* Switch to the next log LEB */
447
413
        if (c->lhead_offs) {
448
 
                c->lhead_lnum = next_log_lnum(c, c->lhead_lnum);
 
414
                c->lhead_lnum = ubifs_next_log_lnum(c, c->lhead_lnum);
449
415
                c->lhead_offs = 0;
450
416
        }
451
417
 
466
432
 
467
433
        c->lhead_offs += len;
468
434
        if (c->lhead_offs == c->leb_size) {
469
 
                c->lhead_lnum = next_log_lnum(c, c->lhead_lnum);
 
435
                c->lhead_lnum = ubifs_next_log_lnum(c, c->lhead_lnum);
470
436
                c->lhead_offs = 0;
471
437
        }
472
438
 
553
519
        }
554
520
        mutex_lock(&c->log_mutex);
555
521
        for (lnum = old_ltail_lnum; lnum != c->ltail_lnum;
556
 
             lnum = next_log_lnum(c, lnum)) {
 
522
             lnum = ubifs_next_log_lnum(c, lnum)) {
557
523
                dbg_log("unmap log LEB %d", lnum);
558
524
                err = ubifs_leb_unmap(c, lnum);
559
525
                if (err)
662
628
                err = ubifs_leb_change(c, *lnum, buf, sz, UBI_SHORTTERM);
663
629
                if (err)
664
630
                        return err;
665
 
                *lnum = next_log_lnum(c, *lnum);
 
631
                *lnum = ubifs_next_log_lnum(c, *lnum);
666
632
                *offs = 0;
667
633
        }
668
634
        memcpy(buf + *offs, node, len);
732
698
                ubifs_scan_destroy(sleb);
733
699
                if (lnum == c->lhead_lnum)
734
700
                        break;
735
 
                lnum = next_log_lnum(c, lnum);
 
701
                lnum = ubifs_next_log_lnum(c, lnum);
736
702
        }
737
703
        if (offs) {
738
704
                int sz = ALIGN(offs, c->min_io_size);
752
718
        /* Unmap remaining LEBs */
753
719
        lnum = write_lnum;
754
720
        do {
755
 
                lnum = next_log_lnum(c, lnum);
 
721
                lnum = ubifs_next_log_lnum(c, lnum);
756
722
                err = ubifs_leb_unmap(c, lnum);
757
723
                if (err)
758
724
                        return err;