Commit 73944a6d authored by Adrian Hunter's avatar Adrian Hunter Committed by Artem Bityutskiy

UBIFS: add more debugging messages for LPT

Also add debugging checks for LPT size and separate
out c->check_lpt_free from unrelated bitfields.
Signed-off-by: default avatarAdrian Hunter <ext-adrian.hunter@nokia.com>
parent 5c0013c1
...@@ -655,6 +655,43 @@ void dbg_dump_lprops(struct ubifs_info *c) ...@@ -655,6 +655,43 @@ void dbg_dump_lprops(struct ubifs_info *c)
} }
} }
void dbg_dump_lpt_info(struct ubifs_info *c)
{
int i;
spin_lock(&dbg_lock);
printk(KERN_DEBUG "\tlpt_sz: %lld\n", c->lpt_sz);
printk(KERN_DEBUG "\tpnode_sz: %d\n", c->pnode_sz);
printk(KERN_DEBUG "\tnnode_sz: %d\n", c->nnode_sz);
printk(KERN_DEBUG "\tltab_sz: %d\n", c->ltab_sz);
printk(KERN_DEBUG "\tlsave_sz: %d\n", c->lsave_sz);
printk(KERN_DEBUG "\tbig_lpt: %d\n", c->big_lpt);
printk(KERN_DEBUG "\tlpt_hght: %d\n", c->lpt_hght);
printk(KERN_DEBUG "\tpnode_cnt: %d\n", c->pnode_cnt);
printk(KERN_DEBUG "\tnnode_cnt: %d\n", c->nnode_cnt);
printk(KERN_DEBUG "\tdirty_pn_cnt: %d\n", c->dirty_pn_cnt);
printk(KERN_DEBUG "\tdirty_nn_cnt: %d\n", c->dirty_nn_cnt);
printk(KERN_DEBUG "\tlsave_cnt: %d\n", c->lsave_cnt);
printk(KERN_DEBUG "\tspace_bits: %d\n", c->space_bits);
printk(KERN_DEBUG "\tlpt_lnum_bits: %d\n", c->lpt_lnum_bits);
printk(KERN_DEBUG "\tlpt_offs_bits: %d\n", c->lpt_offs_bits);
printk(KERN_DEBUG "\tlpt_spc_bits: %d\n", c->lpt_spc_bits);
printk(KERN_DEBUG "\tpcnt_bits: %d\n", c->pcnt_bits);
printk(KERN_DEBUG "\tlnum_bits: %d\n", c->lnum_bits);
printk(KERN_DEBUG "\tLPT root is at %d:%d\n", c->lpt_lnum, c->lpt_offs);
printk(KERN_DEBUG "\tLPT head is at %d:%d\n",
c->nhead_lnum, c->nhead_offs);
printk(KERN_DEBUG "\tLPT ltab is at %d:%d\n", c->ltab_lnum, c->ltab_offs);
if (c->big_lpt)
printk(KERN_DEBUG "\tLPT lsave is at %d:%d\n",
c->lsave_lnum, c->lsave_offs);
for (i = 0; i < c->lpt_lebs; i++)
printk(KERN_DEBUG "\tLPT LEB %d free %d dirty %d tgc %d "
"cmt %d\n", i + c->lpt_first, c->ltab[i].free,
c->ltab[i].dirty, c->ltab[i].tgc, c->ltab[i].cmt);
spin_unlock(&dbg_lock);
}
void dbg_dump_leb(const struct ubifs_info *c, int lnum) void dbg_dump_leb(const struct ubifs_info *c, int lnum)
{ {
struct ubifs_scan_leb *sleb; struct ubifs_scan_leb *sleb;
......
...@@ -224,6 +224,7 @@ void dbg_dump_lstats(const struct ubifs_lp_stats *lst); ...@@ -224,6 +224,7 @@ void dbg_dump_lstats(const struct ubifs_lp_stats *lst);
void dbg_dump_budg(struct ubifs_info *c); void dbg_dump_budg(struct ubifs_info *c);
void dbg_dump_lprop(const struct ubifs_info *c, const struct ubifs_lprops *lp); void dbg_dump_lprop(const struct ubifs_info *c, const struct ubifs_lprops *lp);
void dbg_dump_lprops(struct ubifs_info *c); void dbg_dump_lprops(struct ubifs_info *c);
void dbg_dump_lpt_info(struct ubifs_info *c);
void dbg_dump_leb(const struct ubifs_info *c, int lnum); void dbg_dump_leb(const struct ubifs_info *c, int lnum);
void dbg_dump_znode(const struct ubifs_info *c, void dbg_dump_znode(const struct ubifs_info *c,
const struct ubifs_znode *znode); const struct ubifs_znode *znode);
...@@ -249,6 +250,8 @@ int dbg_old_index_check_init(struct ubifs_info *c, struct ubifs_zbranch *zroot); ...@@ -249,6 +250,8 @@ int dbg_old_index_check_init(struct ubifs_info *c, struct ubifs_zbranch *zroot);
int dbg_check_old_index(struct ubifs_info *c, struct ubifs_zbranch *zroot); int dbg_check_old_index(struct ubifs_info *c, struct ubifs_zbranch *zroot);
int dbg_check_cats(struct ubifs_info *c); int dbg_check_cats(struct ubifs_info *c);
int dbg_check_ltab(struct ubifs_info *c); int dbg_check_ltab(struct ubifs_info *c);
int dbg_chk_lpt_free_spc(struct ubifs_info *c);
int dbg_chk_lpt_sz(struct ubifs_info *c, int action, int len);
int dbg_check_synced_i_size(struct inode *inode); int dbg_check_synced_i_size(struct inode *inode);
int dbg_check_dir_size(struct ubifs_info *c, const struct inode *dir); int dbg_check_dir_size(struct ubifs_info *c, const struct inode *dir);
int dbg_check_tnc(struct ubifs_info *c, int extra); int dbg_check_tnc(struct ubifs_info *c, int extra);
...@@ -367,6 +370,7 @@ static inline int dbg_change(struct ubi_volume_desc *desc, int lnum, ...@@ -367,6 +370,7 @@ static inline int dbg_change(struct ubi_volume_desc *desc, int lnum,
#define dbg_dump_budg(c) ({}) #define dbg_dump_budg(c) ({})
#define dbg_dump_lprop(c, lp) ({}) #define dbg_dump_lprop(c, lp) ({})
#define dbg_dump_lprops(c) ({}) #define dbg_dump_lprops(c) ({})
#define dbg_dump_lpt_info(c) ({})
#define dbg_dump_leb(c, lnum) ({}) #define dbg_dump_leb(c, lnum) ({})
#define dbg_dump_znode(c, znode) ({}) #define dbg_dump_znode(c, znode) ({})
#define dbg_dump_heap(c, heap, cat) ({}) #define dbg_dump_heap(c, heap, cat) ({})
...@@ -379,6 +383,8 @@ static inline int dbg_change(struct ubi_volume_desc *desc, int lnum, ...@@ -379,6 +383,8 @@ static inline int dbg_change(struct ubi_volume_desc *desc, int lnum,
#define dbg_check_old_index(c, zroot) 0 #define dbg_check_old_index(c, zroot) 0
#define dbg_check_cats(c) 0 #define dbg_check_cats(c) 0
#define dbg_check_ltab(c) 0 #define dbg_check_ltab(c) 0
#define dbg_chk_lpt_free_spc(c) 0
#define dbg_chk_lpt_sz(c, action, len) 0
#define dbg_check_synced_i_size(inode) 0 #define dbg_check_synced_i_size(inode) 0
#define dbg_check_dir_size(c, dir) 0 #define dbg_check_dir_size(c, dir) 0
#define dbg_check_tnc(c, x) 0 #define dbg_check_tnc(c, x) 0
......
...@@ -109,7 +109,8 @@ static void do_calc_lpt_geom(struct ubifs_info *c) ...@@ -109,7 +109,8 @@ static void do_calc_lpt_geom(struct ubifs_info *c)
c->lpt_sz = (long long)c->pnode_cnt * c->pnode_sz; c->lpt_sz = (long long)c->pnode_cnt * c->pnode_sz;
c->lpt_sz += (long long)c->nnode_cnt * c->nnode_sz; c->lpt_sz += (long long)c->nnode_cnt * c->nnode_sz;
c->lpt_sz += c->ltab_sz; c->lpt_sz += c->ltab_sz;
c->lpt_sz += c->lsave_sz; if (c->big_lpt)
c->lpt_sz += c->lsave_sz;
/* Add wastage */ /* Add wastage */
sz = c->lpt_sz; sz = c->lpt_sz;
......
This diff is collapsed.
...@@ -943,7 +943,6 @@ struct ubifs_mount_opts { ...@@ -943,7 +943,6 @@ struct ubifs_mount_opts {
* *
* @fast_unmount: do not run journal commit before un-mounting * @fast_unmount: do not run journal commit before un-mounting
* @big_lpt: flag that LPT is too big to write whole during commit * @big_lpt: flag that LPT is too big to write whole during commit
* @check_lpt_free: flag that indicates LPT GC may be needed
* @no_chk_data_crc: do not check CRCs when reading data nodes (except during * @no_chk_data_crc: do not check CRCs when reading data nodes (except during
* recovery) * recovery)
* @bulk_read: enable bulk-reads * @bulk_read: enable bulk-reads
...@@ -1102,6 +1101,7 @@ struct ubifs_mount_opts { ...@@ -1102,6 +1101,7 @@ struct ubifs_mount_opts {
* @lpt_drty_flgs: dirty flags for LPT special nodes e.g. ltab * @lpt_drty_flgs: dirty flags for LPT special nodes e.g. ltab
* @dirty_nn_cnt: number of dirty nnodes * @dirty_nn_cnt: number of dirty nnodes
* @dirty_pn_cnt: number of dirty pnodes * @dirty_pn_cnt: number of dirty pnodes
* @check_lpt_free: flag that indicates LPT GC may be needed
* @lpt_sz: LPT size * @lpt_sz: LPT size
* @lpt_nod_buf: buffer for an on-flash nnode or pnode * @lpt_nod_buf: buffer for an on-flash nnode or pnode
* @lpt_buf: buffer of LEB size used by LPT * @lpt_buf: buffer of LEB size used by LPT
...@@ -1191,7 +1191,6 @@ struct ubifs_info { ...@@ -1191,7 +1191,6 @@ struct ubifs_info {
unsigned int fast_unmount:1; unsigned int fast_unmount:1;
unsigned int big_lpt:1; unsigned int big_lpt:1;
unsigned int check_lpt_free:1;
unsigned int no_chk_data_crc:1; unsigned int no_chk_data_crc:1;
unsigned int bulk_read:1; unsigned int bulk_read:1;
...@@ -1340,6 +1339,7 @@ struct ubifs_info { ...@@ -1340,6 +1339,7 @@ struct ubifs_info {
int lpt_drty_flgs; int lpt_drty_flgs;
int dirty_nn_cnt; int dirty_nn_cnt;
int dirty_pn_cnt; int dirty_pn_cnt;
int check_lpt_free;
long long lpt_sz; long long lpt_sz;
void *lpt_nod_buf; void *lpt_nod_buf;
void *lpt_buf; void *lpt_buf;
...@@ -1394,6 +1394,12 @@ struct ubifs_info { ...@@ -1394,6 +1394,12 @@ struct ubifs_info {
unsigned long fail_timeout; unsigned long fail_timeout;
unsigned int fail_cnt; unsigned int fail_cnt;
unsigned int fail_cnt_max; unsigned int fail_cnt_max;
long long chk_lpt_sz;
long long chk_lpt_sz2;
long long chk_lpt_wastage;
int chk_lpt_lebs;
int new_nhead_lnum;
int new_nhead_offs;
#endif #endif
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment