Skip to content

Commit

Permalink
Merge branch 'linux-next' of git://git.infradead.org/ubifs-2.6
Browse files Browse the repository at this point in the history
* 'linux-next' of git://git.infradead.org/ubifs-2.6: (25 commits)
  UBIFS: fix ubifs_compress commentary
  UBIFS: amend printk
  UBIFS: do not read unnecessary bytes when unpacking bits
  UBIFS: check buffer length when scanning for LPT nodes
  UBIFS: correct condition to eliminate unecessary assignment
  UBIFS: add more debugging messages for LPT
  UBIFS: fix bulk-read handling uptodate pages
  UBIFS: improve garbage collection
  UBIFS: allow for sync_fs when read-only
  UBIFS: commit on sync_fs
  UBIFS: correct comment for commit_on_unmount
  UBIFS: update dbg_dump_inode
  UBIFS: fix commentary
  UBIFS: fix races in bit-fields
  UBIFS: ensure data read beyond i_size is zeroed out correctly
  UBIFS: correct key comparison
  UBIFS: use bit-fields when possible
  UBIFS: check data CRC when in error state
  UBIFS: improve znode splitting rules
  UBIFS: add no_chk_data_crc mount option
  ...
  • Loading branch information
Linus Torvalds committed Oct 20, 2008
2 parents ed402af + 54779aa commit 396b122
Show file tree
Hide file tree
Showing 21 changed files with 1,187 additions and 167 deletions.
9 changes: 9 additions & 0 deletions Documentation/filesystems/ubifs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,15 @@ norm_unmount (*) commit on unmount; the journal is committed
fast_unmount do not commit on unmount; this option makes
unmount faster, but the next mount slower
because of the need to replay the journal.
bulk_read read more in one go to take advantage of flash
media that read faster sequentially
no_bulk_read (*) do not bulk-read
no_chk_data_crc skip checking of CRCs on data nodes in order to
improve read performance. Use this option only
if the flash media is highly reliable. The effect
of this option is that corruption of the contents
of a file can go unnoticed.
chk_data_crc (*) do not skip checking CRCs on data nodes


Quick usage instructions
Expand Down
26 changes: 14 additions & 12 deletions fs/ubifs/budget.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,19 +414,21 @@ static int do_budget_space(struct ubifs_info *c)
* @c->lst.empty_lebs + @c->freeable_cnt + @c->idx_gc_cnt -
* @c->lst.taken_empty_lebs
*
* @empty_lebs are available because they are empty. @freeable_cnt are
* available because they contain only free and dirty space and the
* index allocation always occurs after wbufs are synch'ed.
* @idx_gc_cnt are available because they are index LEBs that have been
* garbage collected (including trivial GC) and are awaiting the commit
* before they can be unmapped - note that the in-the-gaps method will
* grab these if it needs them. @taken_empty_lebs are empty_lebs that
* have already been allocated for some purpose (also includes those
* LEBs on the @idx_gc list).
* @c->lst.empty_lebs are available because they are empty.
* @c->freeable_cnt are available because they contain only free and
* dirty space, @c->idx_gc_cnt are available because they are index
* LEBs that have been garbage collected and are awaiting the commit
* before they can be used. And the in-the-gaps method will grab these
* if it needs them. @c->lst.taken_empty_lebs are empty LEBs that have
* already been allocated for some purpose.
*
* Note, @taken_empty_lebs may temporarily be higher by one because of
* the way we serialize LEB allocations and budgeting. See a comment in
* 'ubifs_find_free_space()'.
* Note, @c->idx_gc_cnt is included to both @c->lst.empty_lebs (because
* these LEBs are empty) and to @c->lst.taken_empty_lebs (because they
* are taken until after the commit).
*
* Note, @c->lst.taken_empty_lebs may temporarily be higher by one
* because of the way we serialize LEB allocations and budgeting. See a
* comment in 'ubifs_find_free_space()'.
*/
lebs = c->lst.empty_lebs + c->freeable_cnt + c->idx_gc_cnt -
c->lst.taken_empty_lebs;
Expand Down
2 changes: 0 additions & 2 deletions fs/ubifs/compress.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ struct ubifs_compressor *ubifs_compressors[UBIFS_COMPR_TYPES_CNT];
*
* Note, if the input buffer was not compressed, it is copied to the output
* buffer and %UBIFS_COMPR_NONE is returned in @compr_type.
*
* This functions returns %0 on success or a negative error code on failure.
*/
void ubifs_compress(const void *in_buf, int in_len, void *out_buf, int *out_len,
int *compr_type)
Expand Down
79 changes: 62 additions & 17 deletions fs/ubifs/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,30 +222,38 @@ void dbg_dump_inode(const struct ubifs_info *c, const struct inode *inode)
{
const struct ubifs_inode *ui = ubifs_inode(inode);

printk(KERN_DEBUG "inode %lu\n", inode->i_ino);
printk(KERN_DEBUG "size %llu\n",
printk(KERN_DEBUG "Dump in-memory inode:");
printk(KERN_DEBUG "\tinode %lu\n", inode->i_ino);
printk(KERN_DEBUG "\tsize %llu\n",
(unsigned long long)i_size_read(inode));
printk(KERN_DEBUG "nlink %u\n", inode->i_nlink);
printk(KERN_DEBUG "uid %u\n", (unsigned int)inode->i_uid);
printk(KERN_DEBUG "gid %u\n", (unsigned int)inode->i_gid);
printk(KERN_DEBUG "atime %u.%u\n",
printk(KERN_DEBUG "\tnlink %u\n", inode->i_nlink);
printk(KERN_DEBUG "\tuid %u\n", (unsigned int)inode->i_uid);
printk(KERN_DEBUG "\tgid %u\n", (unsigned int)inode->i_gid);
printk(KERN_DEBUG "\tatime %u.%u\n",
(unsigned int)inode->i_atime.tv_sec,
(unsigned int)inode->i_atime.tv_nsec);
printk(KERN_DEBUG "mtime %u.%u\n",
printk(KERN_DEBUG "\tmtime %u.%u\n",
(unsigned int)inode->i_mtime.tv_sec,
(unsigned int)inode->i_mtime.tv_nsec);
printk(KERN_DEBUG "ctime %u.%u\n",
printk(KERN_DEBUG "\tctime %u.%u\n",
(unsigned int)inode->i_ctime.tv_sec,
(unsigned int)inode->i_ctime.tv_nsec);
printk(KERN_DEBUG "creat_sqnum %llu\n", ui->creat_sqnum);
printk(KERN_DEBUG "xattr_size %u\n", ui->xattr_size);
printk(KERN_DEBUG "xattr_cnt %u\n", ui->xattr_cnt);
printk(KERN_DEBUG "xattr_names %u\n", ui->xattr_names);
printk(KERN_DEBUG "dirty %u\n", ui->dirty);
printk(KERN_DEBUG "xattr %u\n", ui->xattr);
printk(KERN_DEBUG "flags %d\n", ui->flags);
printk(KERN_DEBUG "compr_type %d\n", ui->compr_type);
printk(KERN_DEBUG "data_len %d\n", ui->data_len);
printk(KERN_DEBUG "\tcreat_sqnum %llu\n", ui->creat_sqnum);
printk(KERN_DEBUG "\txattr_size %u\n", ui->xattr_size);
printk(KERN_DEBUG "\txattr_cnt %u\n", ui->xattr_cnt);
printk(KERN_DEBUG "\txattr_names %u\n", ui->xattr_names);
printk(KERN_DEBUG "\tdirty %u\n", ui->dirty);
printk(KERN_DEBUG "\txattr %u\n", ui->xattr);
printk(KERN_DEBUG "\tbulk_read %u\n", ui->xattr);
printk(KERN_DEBUG "\tsynced_i_size %llu\n",
(unsigned long long)ui->synced_i_size);
printk(KERN_DEBUG "\tui_size %llu\n",
(unsigned long long)ui->ui_size);
printk(KERN_DEBUG "\tflags %d\n", ui->flags);
printk(KERN_DEBUG "\tcompr_type %d\n", ui->compr_type);
printk(KERN_DEBUG "\tlast_page_read %lu\n", ui->last_page_read);
printk(KERN_DEBUG "\tread_in_a_row %lu\n", ui->read_in_a_row);
printk(KERN_DEBUG "\tdata_len %d\n", ui->data_len);
}

void dbg_dump_node(const struct ubifs_info *c, const void *node)
Expand Down Expand Up @@ -647,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)
{
struct ubifs_scan_leb *sleb;
Expand Down
6 changes: 6 additions & 0 deletions fs/ubifs/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_lprop(const struct ubifs_info *c, const struct ubifs_lprops *lp);
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_znode(const struct ubifs_info *c,
const struct ubifs_znode *znode);
Expand All @@ -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_cats(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_dir_size(struct ubifs_info *c, const struct inode *dir);
int dbg_check_tnc(struct ubifs_info *c, int extra);
Expand Down Expand Up @@ -367,6 +370,7 @@ static inline int dbg_change(struct ubi_volume_desc *desc, int lnum,
#define dbg_dump_budg(c) ({})
#define dbg_dump_lprop(c, lp) ({})
#define dbg_dump_lprops(c) ({})
#define dbg_dump_lpt_info(c) ({})
#define dbg_dump_leb(c, lnum) ({})
#define dbg_dump_znode(c, znode) ({})
#define dbg_dump_heap(c, heap, cat) ({})
Expand All @@ -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_cats(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_dir_size(c, dir) 0
#define dbg_check_tnc(c, x) 0
Expand Down
Loading

0 comments on commit 396b122

Please sign in to comment.