~ubuntu-branches/ubuntu/trusty/linux-linaro-omap/trusty

« back to all changes in this revision

Viewing changes to fs/ubifs/lpt_commit.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-57i0gl3v99b3lkfg
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:
29
29
#include <linux/slab.h>
30
30
#include "ubifs.h"
31
31
 
 
32
#ifdef CONFIG_UBIFS_FS_DEBUG
 
33
static int dbg_populate_lsave(struct ubifs_info *c);
 
34
#else
 
35
#define dbg_populate_lsave(c) 0
 
36
#endif
 
37
 
32
38
/**
33
39
 * first_dirty_cnode - find first dirty cnode.
34
40
 * @c: UBIFS file-system description object
586
592
                        if (nnode->nbranch[iip].lnum)
587
593
                                break;
588
594
                }
589
 
       } while (iip >= UBIFS_LPT_FANOUT);
 
595
        } while (iip >= UBIFS_LPT_FANOUT);
590
596
 
591
597
        /* Go right */
592
598
        nnode = ubifs_get_nnode(c, nnode, iip);
815
821
                c->lpt_drty_flgs |= LSAVE_DIRTY;
816
822
                ubifs_add_lpt_dirt(c, c->lsave_lnum, c->lsave_sz);
817
823
        }
 
824
 
 
825
        if (dbg_populate_lsave(c))
 
826
                return;
 
827
 
818
828
        list_for_each_entry(lprops, &c->empty_list, list) {
819
829
                c->lsave[cnt++] = lprops->lnum;
820
830
                if (cnt >= c->lsave_cnt)
1994
2004
               current->pid);
1995
2005
}
1996
2006
 
 
2007
/**
 
2008
 * dbg_populate_lsave - debugging version of 'populate_lsave()'
 
2009
 * @c: UBIFS file-system description object
 
2010
 *
 
2011
 * This is a debugging version for 'populate_lsave()' which populates lsave
 
2012
 * with random LEBs instead of useful LEBs, which is good for test coverage.
 
2013
 * Returns zero if lsave has not been populated (this debugging feature is
 
2014
 * disabled) an non-zero if lsave has been populated.
 
2015
 */
 
2016
static int dbg_populate_lsave(struct ubifs_info *c)
 
2017
{
 
2018
        struct ubifs_lprops *lprops;
 
2019
        struct ubifs_lpt_heap *heap;
 
2020
        int i;
 
2021
 
 
2022
        if (!(ubifs_chk_flags & UBIFS_CHK_GEN))
 
2023
                return 0;
 
2024
        if (random32() & 3)
 
2025
                return 0;
 
2026
 
 
2027
        for (i = 0; i < c->lsave_cnt; i++)
 
2028
                c->lsave[i] = c->main_first;
 
2029
 
 
2030
        list_for_each_entry(lprops, &c->empty_list, list)
 
2031
                c->lsave[random32() % c->lsave_cnt] = lprops->lnum;
 
2032
        list_for_each_entry(lprops, &c->freeable_list, list)
 
2033
                c->lsave[random32() % c->lsave_cnt] = lprops->lnum;
 
2034
        list_for_each_entry(lprops, &c->frdi_idx_list, list)
 
2035
                c->lsave[random32() % c->lsave_cnt] = lprops->lnum;
 
2036
 
 
2037
        heap = &c->lpt_heap[LPROPS_DIRTY_IDX - 1];
 
2038
        for (i = 0; i < heap->cnt; i++)
 
2039
                c->lsave[random32() % c->lsave_cnt] = heap->arr[i]->lnum;
 
2040
        heap = &c->lpt_heap[LPROPS_DIRTY - 1];
 
2041
        for (i = 0; i < heap->cnt; i++)
 
2042
                c->lsave[random32() % c->lsave_cnt] = heap->arr[i]->lnum;
 
2043
        heap = &c->lpt_heap[LPROPS_FREE - 1];
 
2044
        for (i = 0; i < heap->cnt; i++)
 
2045
                c->lsave[random32() % c->lsave_cnt] = heap->arr[i]->lnum;
 
2046
 
 
2047
        return 1;
 
2048
}
 
2049
 
1997
2050
#endif /* CONFIG_UBIFS_FS_DEBUG */