~ubuntu-branches/ubuntu/quantal/linux-linaro-mx51/quantal

« back to all changes in this revision

Viewing changes to fs/ubifs/journal.c

  • Committer: Package Import Robot
  • Author(s): John Rigby, John Rigby
  • Date: 2011-09-26 10:44:23 UTC
  • Revision ID: package-import@ubuntu.com-20110926104423-3o58a3c1bj7x00rs
Tags: 3.0.0-1007.9
[ John Rigby ]

Enable crypto modules and remove crypto-modules from
exclude-module files
LP: #826021

Show diffs side-by-side

added added

removed removed

Lines of Context:
141
141
         * LEB with some empty space.
142
142
         */
143
143
        lnum = ubifs_find_free_space(c, len, &offs, squeeze);
144
 
        if (lnum >= 0) {
145
 
                /* Found an LEB, add it to the journal head */
146
 
                err = ubifs_add_bud_to_log(c, jhead, lnum, offs);
147
 
                if (err)
148
 
                        goto out_return;
149
 
                /* A new bud was successfully allocated and added to the log */
 
144
        if (lnum >= 0)
150
145
                goto out;
151
 
        }
152
146
 
153
147
        err = lnum;
154
148
        if (err != -ENOSPC)
203
197
                return 0;
204
198
        }
205
199
 
206
 
        err = ubifs_add_bud_to_log(c, jhead, lnum, 0);
207
 
        if (err)
208
 
                goto out_return;
209
200
        offs = 0;
210
201
 
211
202
out:
 
203
        /*
 
204
         * Make sure we synchronize the write-buffer before we add the new bud
 
205
         * to the log. Otherwise we may have a power cut after the log
 
206
         * reference node for the last bud (@lnum) is written but before the
 
207
         * write-buffer data are written to the next-to-last bud
 
208
         * (@wbuf->lnum). And the effect would be that the recovery would see
 
209
         * that there is corruption in the next-to-last bud.
 
210
         */
 
211
        err = ubifs_wbuf_sync_nolock(wbuf);
 
212
        if (err)
 
213
                goto out_return;
 
214
        err = ubifs_add_bud_to_log(c, jhead, lnum, offs);
 
215
        if (err)
 
216
                goto out_return;
212
217
        err = ubifs_wbuf_seek_nolock(wbuf, lnum, offs, wbuf->dtype);
213
218
        if (err)
214
219
                goto out_unlock;
380
385
        if (err == -ENOSPC) {
381
386
                /* This are some budgeting problems, print useful information */
382
387
                down_write(&c->commit_sem);
383
 
                spin_lock(&c->space_lock);
384
388
                dbg_dump_stack();
385
 
                dbg_dump_budg(c);
386
 
                spin_unlock(&c->space_lock);
 
389
                dbg_dump_budg(c, &c->bi);
387
390
                dbg_dump_lprops(c);
388
391
                cmt_retries = dbg_check_lprops(c);
389
392
                up_write(&c->commit_sem);
666
669
 
667
670
out_release:
668
671
        release_head(c, BASEHD);
 
672
        kfree(dent);
669
673
out_ro:
670
674
        ubifs_ro_mode(c, err);
671
675
        if (last_reference)