Clean up some extra unused arguments in fs/ubifs/
Subsystems (2)
PATCH 1/1 Clean up some extra unused arguments in fs/ubifs/
Hi,
"const struct ubifs_info *c" exists as an extra argument for major function definitions under the "fs/ubifs/*" code. The reason why this extra argument exists is based on assumtion that there will be several key schemes. It is possible to add more than one, but we use only one. When there is practically no usage of them presently, they can be removed, and if needed can be added later.
The following patch does that by removing:
1) "const struct ubifs_info *c" where it is not used/necessary,
2) remove xent_key_init_hash() function, as it is also not used,
3) remove data_key_init_flash() function, as it is also not used anywhere,
Recent discussion on this can be found at:
http://lkml.org/lkml/2009/7/16/164,
http://lkml.org/lkml/2009/7/16/166,
---
fs/ubifs/commit.c +12 -12
@@ -572,10 +572,10 @@ int dbg_check_old_index(struct ubifs_inf/* Set last values as though root had a parent */ last_level =le16_to_cpu (idx->level) +1 ; last_sqnum =le64_to_cpu (idx->ch.sqnum) +1 ; -key_read (c,ubifs_idx_key (c, idx), &lower_key); -highest_ino_key (c, &upper_key,INUM_WATERMARK ); +key_read (ubifs_idx_key (idx), &lower_key); +highest_ino_key (&upper_key,INUM_WATERMARK ); } -key_copy (c, &upper_key, &i->upper_key); +key_copy (&upper_key, &i->upper_key);if (le16_to_cpu (idx->level) != last_level -1 ) { err =3 ; goto out_dump;
@@ -589,19 +589,19 @@ int dbg_check_old_index(struct ubifs_inf goto out_dump; }/* Check key range */ -key_read (c,ubifs_idx_key (c, idx), &l_key); +key_read (ubifs_idx_key (idx), &l_key); br =ubifs_idx_branch (c, idx, child_cnt -1 ); -key_read (c, &br->key, &u_key); -if (keys_cmp (c, &lower_key, &l_key) >0 ) { +key_read (&br->key, &u_key); +if (keys_cmp (&lower_key, &l_key) >0 ) { err =5 ; goto out_dump; } -if (keys_cmp (c, &upper_key, &u_key) <0 ) { +if (keys_cmp (&upper_key, &u_key) <0 ) { err =6 ; goto out_dump; } -if (keys_cmp (c, &upper_key, &u_key) ==0 ) -if (!is_hash_key (c, &u_key)) { +if (keys_cmp (&upper_key, &u_key) ==0 ) +if (!is_hash_key (&u_key)) { err =7 ; goto out_dump; }
@@ -640,12 +640,12 @@ int dbg_check_old_index(struct ubifs_inf lnum =le32_to_cpu (br->lnum); offs =le32_to_cpu (br->offs); len =le32_to_cpu (br->len); -key_read (c, &br->key, &lower_key); +key_read (&br->key, &lower_key);if (iip +1 <le16_to_cpu (idx->child_cnt)) { br =ubifs_idx_branch (c, idx, iip +1 ); -key_read (c, &br->key, &upper_key); +key_read (&br->key, &upper_key); }else -key_copy (c, &i->upper_key, &upper_key); +key_copy (&i->upper_key, &upper_key); } out: err =dbg_old_index_check_init (c, zroot);
fs/ubifs/debug.c +35 -35
246 lines not on this page · raw message
fs/ubifs/dir.c +8 -8
@@ -394,7 +394,7 @@ static int ubifs_readdir(struct file *fireturn 0 ;/* Find the first entry in TNC and save it */ -lowest_dent_key (c, &key, dir->i_ino); +lowest_dent_key (&key, dir->i_ino); nm.name =NULL ; dent =ubifs_tnc_next_ent (c, &key, &nm);if (IS_ERR (dent)) {
@@ -402,7 +402,7 @@ static int ubifs_readdir(struct file *fi goto out; } - file->f_pos =key_hash_flash (c, &dent->key); + file->f_pos =key_hash_flash (&dent->key); file->private_data = dent; }
@@ -413,21 +413,21 @@ static int ubifs_readdir(struct file *fi* Find the entry corresponding to @file->f_pos or the * closest one. */ -dent_key_init_hash (c, &key, dir->i_ino, file->f_pos); +dent_key_init_hash (&key, dir->i_ino, file->f_pos); nm.name =NULL ; dent =ubifs_tnc_next_ent (c, &key, &nm);if (IS_ERR (dent)) { err =PTR_ERR (dent); goto out; } - file->f_pos =key_hash_flash (c, &dent->key); + file->f_pos =key_hash_flash (&dent->key); file->private_data = dent; }while (1 ) {dbg_gen ("feed '%s', ino %llu, new f_pos %#x" , dent->name, (unsigned long long )le64_to_cpu (dent->inum), -key_hash_flash (c, &dent->key)); +key_hash_flash (&dent->key));ubifs_assert (le64_to_cpu (dent->ch.sqnum) >ubifs_inode (dir)->creat_sqnum);
@@ -439,7 +439,7 @@ static int ubifs_readdir(struct file *fireturn 0 ;/* Switch to the next entry */ -key_read (c, &dent->key, &key); +key_read (&dent->key, &key); nm.name = dent->name; dent =ubifs_tnc_next_ent (c, &key, &nm);if (IS_ERR (dent)) {
@@ -448,7 +448,7 @@ static int ubifs_readdir(struct file *fi }kfree (file->private_data); - file->f_pos =key_hash_flash (c, &dent->key); + file->f_pos =key_hash_flash (&dent->key); file->private_data = dent;cond_resched (); }
@@ -659,7 +659,7 @@ static int check_dir_empty(struct ubifs_union ubifs_key key;int err; -lowest_dent_key (c, &key, dir->i_ino); +lowest_dent_key (&key, dir->i_ino); dent =ubifs_tnc_next_ent (c, &key, &nm);if (IS_ERR (dent)) { err =PTR_ERR (dent);
fs/ubifs/file.c +5 -5
@@ -63,7 +63,7 @@ static int read_block(struct inode *inodunion ubifs_key key;unsigned int dlen; -data_key_init (c, &key, inode->i_ino, block); +data_key_init (&key, inode->i_ino, block); err =ubifs_tnc_lookup (c, &key, dn);if (err) {if (err == -ENOENT )
@@ -631,7 +631,7 @@ static int populate_page(struct ubifs_inif (nn >= bu->cnt) { hole =1 ;memset (addr,0 ,UBIFS_BLOCK_SIZE ); - }else if (key_block (c, &bu->zbranch[nn].key) == page_block) { + }else if (key_block (&bu->zbranch[nn].key) == page_block) {struct ubifs_data_node *dn; dn = bu->buf + (bu->zbranch[nn].offs - offs);
@@ -655,7 +655,7 @@ static int populate_page(struct ubifs_in nn +=1 ; read = (i <<UBIFS_BLOCK_SHIFT ) + len; - }else if (key_block (c, &bu->zbranch[nn].key) < page_block) { + }else if (key_block (&bu->zbranch[nn].key) < page_block) { nn +=1 ;continue ; }else {
@@ -866,7 +866,7 @@ static int ubifs_bulk_read(struct page * } bu->buf_len = c->max_bu_buf_len; -data_key_init (c, &bu->key, inode->i_ino, +data_key_init (&bu->key, inode->i_ino, page->index <<UBIFS_BLOCKS_PER_PAGE_SHIFT ); err =ubifs_do_bulk_read (c, bu, page);
@@ -912,7 +912,7 @@ static int do_writepage(struct page *pag i =0 ;while (len) { blen =min_t (int, len,UBIFS_BLOCK_SIZE ); -data_key_init (c, &key, inode->i_ino, block); +data_key_init (&key, inode->i_ino, block); err =ubifs_jnl_write_data (c, inode, &key, addr, blen);if (err)break ;
fs/ubifs/gc.c +15 -17
@@ -214,21 +214,20 @@ static void list_sort(void *priv, structint data_nodes_cmp (void *priv,struct list_head *a,struct list_head *b) {ino_t inuma, inumb; -struct ubifs_info *c = priv;struct ubifs_scan_node *sa, *sb;cond_resched (); sa = list_entry(a, struct ubifs_scan_node, list); sb = list_entry(b, struct ubifs_scan_node, list); -ubifs_assert (key_type (c, &sa->key) ==UBIFS_DATA_KEY ); -ubifs_assert (key_type (c, &sb->key) ==UBIFS_DATA_KEY ); +ubifs_assert (key_type (&sa->key) ==UBIFS_DATA_KEY ); +ubifs_assert (key_type (&sb->key) ==UBIFS_DATA_KEY ); - inuma =key_inum (c, &sa->key); - inumb =key_inum (c, &sb->key); + inuma =key_inum (&sa->key); + inumb =key_inum (&sb->key);if (inuma == inumb) { -unsigned int blka =key_block (c, &sa->key); -unsigned int blkb =key_block (c, &sb->key); +unsigned int blka =key_block (&sa->key); +unsigned int blkb =key_block (&sb->key);if (blka <= blkb)return -1 ;
@@ -252,14 +251,13 @@ int nondata_nodes_cmp(void *priv, struct {int typea, typeb;ino_t inuma, inumb; -struct ubifs_info *c = priv;struct ubifs_scan_node *sa, *sb;cond_resched (); sa = list_entry(a, struct ubifs_scan_node, list); sb = list_entry(b, struct ubifs_scan_node, list); - typea =key_type (c, &sa->key); - typeb =key_type (c, &sb->key); + typea =key_type (&sa->key); + typeb =key_type (&sb->key);ubifs_assert (typea !=UBIFS_DATA_KEY && typeb !=UBIFS_DATA_KEY );/* Inodes go before directory entries */
@@ -272,12 +270,12 @@ int nondata_nodes_cmp(void *priv, structreturn 1 ;ubifs_assert (typea ==UBIFS_DENT_KEY && typeb ==UBIFS_DENT_KEY ); - inuma =key_inum (c, &sa->key); - inumb =key_inum (c, &sb->key); + inuma =key_inum (&sa->key); + inumb =key_inum (&sb->key);if (inuma == inumb) { -uint32_t hasha =key_hash (c, &sa->key); -uint32_t hashb =key_hash (c, &sb->key); +uint32_t hasha =key_hash (&sa->key); +uint32_t hashb =key_hash (&sb->key);if (hasha <= hashb)return -1 ;
@@ -344,7 +342,7 @@ static int sort_nodes(struct ubifs_infoif (snod->len < *min) *min = snod->len; -if (key_type (c, &snod->key) !=UBIFS_DATA_KEY ) +if (key_type (&snod->key) !=UBIFS_DATA_KEY )list_move_tail (&snod->list, nondata); }
@@ -447,7 +445,7 @@ static int move_nodes(struct ubifs_info* nodes and direntry nodes are roughly of the * same size. */ -if (key_type (c, &snod->key) ==UBIFS_DENT_KEY || +if (key_type (&snod->key) ==UBIFS_DENT_KEY || snod->len ==UBIFS_INO_NODE_SZ )break ;continue ;
@@ -546,7 +544,7 @@ int ubifs_garbage_collect_leb(struct ubiint level =le16_to_cpu (idx->level);ubifs_assert (snod->type ==UBIFS_IDX_NODE ); -key_read (c,ubifs_idx_key (c, idx), &snod->key); +key_read (ubifs_idx_key (idx), &snod->key); err =ubifs_dirty_idx_node (c, &snod->key, level, lnum, snod->offs);if (err)
fs/ubifs/journal.c +21 -21
156 lines not on this page · raw message
fs/ubifs/key.h +30 -85
296 lines not on this page · raw message
fs/ubifs/lprops.c +7 -7
@@ -59,7 +59,7 @@ static int get_heap_comp_val(struct ubif* is either the amount of free space or the amount of dirty space, depending * on the category. */ -static void move_up_lpt_heap (struct ubifs_info *c,struct ubifs_lpt_heap *heap, +static void move_up_lpt_heap (struct ubifs_lpt_heap *heap,struct ubifs_lprops *lprops,int cat) {int val1, val2, hpos;
@@ -96,7 +96,7 @@ static void move_up_lpt_heap(struct ubif* greater. In the case of LPT's category heaps, the value is either the amount * of free space or the amount of dirty space, depending on the category. */ -static void adjust_lpt_heap (struct ubifs_info *c,struct ubifs_lpt_heap *heap, +static void adjust_lpt_heap (struct ubifs_lpt_heap *heap,struct ubifs_lprops *lprops,int hpos,int cat) {int val1, val2, val3, cpos;
@@ -202,7 +202,7 @@ static int add_to_lpt_heap(struct ubifs_list_add (&lp->list, &c->uncat_list); lprops->hpos = cpos; heap->arr[cpos] = lprops; -move_up_lpt_heap (c, heap, lprops, cat); +move_up_lpt_heap (heap, lprops, cat);dbg_check_heap (c, heap, cat, lprops->hpos);return 1 ;/* Added to heap */ }
@@ -211,7 +211,7 @@ static int add_to_lpt_heap(struct ubifs_ }else { lprops->hpos = heap->cnt++; heap->arr[lprops->hpos] = lprops; -move_up_lpt_heap (c, heap, lprops, cat); +move_up_lpt_heap (heap, lprops, cat);dbg_check_heap (c, heap, cat, lprops->hpos);return 1 ;/* Added to heap */ }
@@ -236,7 +236,7 @@ static void remove_from_lpt_heap(structif (hpos < heap->cnt) { heap->arr[hpos] = heap->arr[heap->cnt]; heap->arr[hpos]->hpos = hpos; -adjust_lpt_heap (c, heap, heap->arr[hpos], hpos, cat); +adjust_lpt_heap (heap, heap->arr[hpos], hpos, cat); }dbg_check_heap (c, heap, cat,-1 ); }
@@ -453,7 +453,7 @@ static void change_category(struct ubifsif (new_cat <1 || new_cat >LPROPS_HEAP_CNT )return ;/* Not on a heap */ heap = &c->lpt_heap[new_cat -1 ]; -adjust_lpt_heap (c, heap, lprops, lprops->hpos, new_cat); +adjust_lpt_heap (heap, lprops, lprops->hpos, new_cat); }else {ubifs_remove_from_cat (c, lprops, old_cat);ubifs_add_to_cat (c, lprops, new_cat);
@@ -1142,7 +1142,7 @@ static int scan_check_cb(struct ubifs_inif (snod->type ==UBIFS_IDX_NODE ) {struct ubifs_idx_node *idx = snod->node; -key_read (c,ubifs_idx_key (c, idx), &snod->key); +key_read (ubifs_idx_key (idx), &snod->key); level =le16_to_cpu (idx->level); }
fs/ubifs/misc.h +1 -2
@@ -277,8 +277,7 @@ struct ubifs_branch *ubifs_idx_branch(co* @c: the UBIFS file-system description object * @idx: index node */ -static inline void *ubifs_idx_key (const struct ubifs_info *c, -const struct ubifs_idx_node *idx) +static inline void *ubifs_idx_key (const struct ubifs_idx_node *idx) {return (void *)((struct ubifs_branch *)idx->branches)->key; }
fs/ubifs/orphan.c +3 -3
@@ -839,12 +839,12 @@ static int dbg_orphan_check(struct ubifsino_t inum;int err; - inum =key_inum (c, &zbr->key); + inum =key_inum (&zbr->key);if (inum != ci->last_ino) {/* Lowest node type is the inode node, so it comes first */ -if (key_type (c, &zbr->key) !=UBIFS_INO_KEY ) +if (key_type (&zbr->key) !=UBIFS_INO_KEY )ubifs_err ("found orphan node ino %lu, type %d" , - (unsigned long )inum,key_type (c, &zbr->key)); + (unsigned long )inum,key_type (&zbr->key)); ci->last_ino = inum; ci->tot_inos +=1 ; err =ubifs_tnc_read_node (c, zbr, ci->node);
fs/ubifs/recovery.c +5 -5
@@ -597,7 +597,7 @@ struct ubifs_scan_leb *ubifs_recover_lebstruct ubifs_ch *ch = buf;int node_len; - err =ubifs_add_snod (c, sleb, buf, offs); + err =ubifs_add_snod (sleb, buf, offs);if (err) goto error; node_len =ALIGN (le32_to_cpu (ch->len),8 );
@@ -1311,11 +1311,11 @@ void ubifs_destroy_size_tree(struct ubifint ubifs_recover_size_accum (struct ubifs_info *c,union ubifs_key *key,int deletion,loff_t new_size) { -ino_t inum =key_inum (c, key); +ino_t inum =key_inum (key);struct size_entry *e;int err; -switch (key_type (c, key)) { +switch (key_type (key)) {case UBIFS_INO_KEY :if (deletion)remove_ino (c, inum);
@@ -1366,7 +1366,7 @@ static int fix_size_in_place(struct ubifuint32_t crc;/* Locate the inode node LEB number and offset */ -ino_key_init (c, &key, e->inum); +ino_key_init (&key, e->inum); err =ubifs_tnc_locate (c, &key, ino, &lnum, &offs);if (err) goto out;
@@ -1428,7 +1428,7 @@ int ubifs_recover_size(struct ubifs_infoif (!e->exists) {union ubifs_key key; -ino_key_init (c, &key, e->inum); +ino_key_init (&key, e->inum); err =ubifs_tnc_lookup (c, &key, c->sbuf);if (err && err != -ENOENT )return err;
fs/ubifs/replay.c +18 -19
@@ -183,10 +183,10 @@ static int trun_remove_range(struct ubifif ((r->old_size & (UBIFS_BLOCK_SIZE -1 )) ==0 ) max_blk -=1 ; - ino =key_inum (c, &r->key); + ino =key_inum (&r->key); -data_key_init (c, &min_key, ino, min_blk); -data_key_init (c, &max_key, ino, max_blk); +data_key_init (&min_key, ino, min_blk); +data_key_init (&max_key, ino, max_blk);return ubifs_tnc_remove_range (c, &min_key, &max_key); }
@@ -210,7 +210,7 @@ static int apply_replay_entry(struct ubiif (r->flags &REPLAY_REF ) err =set_bud_lprops (c, r); -else if (is_hash_key (c, &r->key)) { +else if (is_hash_key (&r->key)) {if (deletion) err =ubifs_tnc_remove_nm (c, &r->key, &r->nm);else
@@ -218,10 +218,10 @@ static int apply_replay_entry(struct ubi r->len, &r->nm); }else {if (deletion) -switch (key_type (c, &r->key)) { +switch (key_type (&r->key)) {case UBIFS_INO_KEY : { -ino_t inum =key_inum (c, &r->key); +ino_t inum =key_inum (&r->key); err =ubifs_tnc_remove_ino (c, inum);break ;
@@ -274,7 +274,7 @@ static void destroy_replay_tree(struct uelse this->rb_right =NULL ; } -if (is_hash_key (c, &r->key)) +if (is_hash_key (&r->key))kfree (r->nm.name);kfree (r); }
@@ -336,8 +336,8 @@ static int insert_node(struct ubifs_infostruct rb_node **p = &c->replay_tree.rb_node, *parent =NULL ;struct replay_entry *r; -if (key_inum (c, key) >= c->highest_inum) - c->highest_inum =key_inum (c, key); +if (key_inum (key) >= c->highest_inum) + c->highest_inum =key_inum (key);dbg_mnt ("add LEB %d:%d, key %s" , lnum, offs,DBGKEY (key));while (*p) {
@@ -367,7 +367,7 @@ static int insert_node(struct ubifs_info r->flags = (deletion ?REPLAY_DELETION :0 ); r->old_size = old_size; r->new_size = new_size; -key_copy (c, key, &r->key); +key_copy (key, &r->key);rb_link_node (&r->rb, parent, p);rb_insert_color (&r->rb, &c->replay_tree);
@@ -402,8 +402,8 @@ static int insert_dent(struct ubifs_infostruct replay_entry *r;char *nbuf; -if (key_inum (c, key) >= c->highest_inum) - c->highest_inum =key_inum (c, key); +if (key_inum (key) >= c->highest_inum) + c->highest_inum =key_inum (key);dbg_mnt ("add LEB %d:%d, key %s" , lnum, offs,DBGKEY (key));while (*p) {
@@ -441,7 +441,7 @@ static int insert_dent(struct ubifs_info nbuf[nlen] ='\0' ; r->nm.name = nbuf; r->flags = (deletion ?REPLAY_DELETION :0 ); -key_copy (c, key, &r->key); +key_copy (key, &r->key);ubifs_assert (!*p);rb_link_node (&r->rb, parent, p);
@@ -457,10 +457,9 @@ static int insert_dent(struct ubifs_info* This function validates directory or extended attribute entry node @dent. * Returns zero if the node is all right and a %-EINVAL if not. */ -int ubifs_validate_entry (struct ubifs_info *c, -const struct ubifs_dent_node *dent) +int ubifs_validate_entry (const struct ubifs_dent_node *dent) { -int key_type =key_type_flash (c, dent->key); +int key_type =key_type_flash (dent->key);int nlen =le16_to_cpu (dent->nlen); if (le32_to_cpu(dent->ch.len) != nlen + UBIFS_DENT_NODE_SZ + 1 ||
@@ -562,7 +561,7 @@ static int replay_bud(struct ubifs_info {struct ubifs_data_node *dn = snod->node;loff_t new_size =le32_to_cpu (dn->size) + -key_block (c, &snod->key) * +key_block (&snod->key) *UBIFS_BLOCK_SIZE ; err = insert_node(c, lnum, snod->offs, snod->len,
@@ -575,7 +574,7 @@ static int replay_bud(struct ubifs_info {struct ubifs_dent_node *dent = snod->node; - err =ubifs_validate_entry (c, dent); + err =ubifs_validate_entry (dent);if (err) goto out_dump;
@@ -604,7 +603,7 @@ static int replay_bud(struct ubifs_info* Create a fake truncation key just to use the same * functions which expect nodes to have keys. */ -trun_key_init (c, &key,le32_to_cpu (trun->inum)); +trun_key_init (&key,le32_to_cpu (trun->inum)); err =insert_node (c, lnum, snod->offs, snod->len, &key, snod->sqnum,1 , &used, old_size, new_size);
fs/ubifs/sb.c +3 -3
@@ -276,9 +276,9 @@ static int create_default_filesystem(str idx->ch.node_type =UBIFS_IDX_NODE ; idx->child_cnt =cpu_to_le16 (1 ); -ino_key_init (c, &key,UBIFS_ROOT_INO ); +ino_key_init (&key,UBIFS_ROOT_INO ); br =ubifs_idx_branch (c, idx,0 ); -key_write_idx (c, &key, &br->key); +key_write_idx (&key, &br->key); br->lnum =cpu_to_le32 (main_first +DEFAULT_DATA_LEB ); br->len =cpu_to_le32 (UBIFS_INO_NODE_SZ ); err = ubifs_write_node(c, idx, tmp, main_first + DEFAULT_IDX_LEB, 0,
@@ -296,7 +296,7 @@ static int create_default_filesystem(strif (!ino)return -ENOMEM ; -ino_key_init_flash (c, &ino->key,UBIFS_ROOT_INO ); +ino_key_init_flash (&ino->key,UBIFS_ROOT_INO ); ino->ch.node_type =UBIFS_INO_NODE ; ino->creat_sqnum =cpu_to_le64 (++c->max_sqnum); ino->nlink =cpu_to_le32 (2 );
fs/ubifs/scan.c +3 -4
@@ -191,8 +191,7 @@ void ubifs_end_scan(const struct ubifs_i* * This function returns %0 on success and a negative error code on failure. */ -int ubifs_add_snod (const struct ubifs_info *c,struct ubifs_scan_leb *sleb, -void *buf,int offs) +int ubifs_add_snod (struct ubifs_scan_leb *sleb,void *buf,int offs) {struct ubifs_ch *ch = buf;struct ubifs_ino_node *ino = buf;
@@ -218,7 +217,7 @@ int ubifs_add_snod(const struct ubifs_in* The key is in the same place in all keyed * nodes. */ -key_read (c, &ino->key, &snod->key); +key_read (&ino->key, &snod->key);break ; }list_add_tail (&snod->list, &sleb->nodes);
@@ -309,7 +308,7 @@ struct ubifs_scan_leb *ubifs_scan(const goto error; } - err =ubifs_add_snod (c, sleb, buf, offs); + err =ubifs_add_snod (sleb, buf, offs);if (err) goto error;
fs/ubifs/super.c +1 -1
@@ -123,7 +123,7 @@ struct inode *ubifs_iget(struct super_bl goto out; } -ino_key_init (c, &key, inode->i_ino); +ino_key_init (&key, inode->i_ino); err =ubifs_tnc_lookup (c, &key, ino);if (err)
fs/ubifs/tnc.c +63 -64
420 lines not on this page · raw message
fs/ubifs/tnc_commit.c +3 -3
@@ -47,7 +47,7 @@ static int make_idx_node(struct ubifs_instruct ubifs_branch *br =ubifs_idx_branch (c, idx, i);struct ubifs_zbranch *zbr = &znode->zbranch[i]; -key_write_idx (c, &zbr->key, &br->key); +key_write_idx (&zbr->key, &br->key); br->lnum =cpu_to_le32 (zbr->lnum); br->offs =cpu_to_le32 (zbr->offs); br->len =cpu_to_le32 (zbr->len);
@@ -256,7 +256,7 @@ static int layout_leb_in_gaps(struct ubiubifs_assert (snod->type ==UBIFS_IDX_NODE ); idx = snod->node; -key_read (c,ubifs_idx_key (c, idx), &snod->key); +key_read (ubifs_idx_key (idx), &snod->key); level =le16_to_cpu (idx->level);/* Determine if the index node is in use (not obsolete) */ in_use = is_idx_node_in_use(c, &snod->key, level, lnum,
@@ -874,7 +874,7 @@ static int write_index(struct ubifs_infostruct ubifs_branch *br =ubifs_idx_branch (c, idx, i);struct ubifs_zbranch *zbr = &znode->zbranch[i]; -key_write_idx (c, &zbr->key, &br->key); +key_write_idx (&zbr->key, &br->key); br->lnum =cpu_to_le32 (zbr->lnum); br->offs =cpu_to_le32 (zbr->offs); br->len =cpu_to_le32 (zbr->len);
fs/ubifs/tnc_misc.c +13 -14
@@ -132,8 +132,7 @@ struct ubifs_znode *ubifs_tnc_levelorder* closest branch is returned in @n; the slot if all keys in this znode are * greater than @key, then %-1 is returned in @n. */ -int ubifs_search_zbranch (const struct ubifs_info *c, -const struct ubifs_znode *znode, +int ubifs_search_zbranch (const struct ubifs_znode *znode,const union ubifs_key *key,int *n) {int beg =0 , end = znode->child_cnt,uninitialized_var (mid );
@@ -144,7 +143,7 @@ int ubifs_search_zbranch(const struct ubwhile (end > beg) { mid = (beg + end) >>1 ; - cmp =keys_cmp (c, key, &zbr[mid].key); + cmp =keys_cmp (key, &zbr[mid].key);if (cmp >0 ) beg = mid +1 ;else if (cmp <0 )
@@ -160,11 +159,11 @@ int ubifs_search_zbranch(const struct ub/* The insert point is after *n */ ubifs_assert (*n >=-1 && *n < znode->child_cnt);if (*n ==-1 ) -ubifs_assert (keys_cmp (c, key, &zbr[0 ].key) <0 ); +ubifs_assert (keys_cmp (key, &zbr[0 ].key) <0 );else -ubifs_assert (keys_cmp (c, key, &zbr[*n].key) >0 ); +ubifs_assert (keys_cmp (key, &zbr[*n].key) >0 );if (*n +1 < znode->child_cnt) -ubifs_assert (keys_cmp (c, key, &zbr[*n +1 ].key) <0 ); +ubifs_assert (keys_cmp (key, &zbr[*n +1 ].key) <0 );return 0 ; }
@@ -305,7 +304,7 @@ static int read_znode(struct ubifs_infoconst struct ubifs_branch *br =ubifs_idx_branch (c, idx, i);struct ubifs_zbranch *zbr = &znode->zbranch[i]; -key_read (c, &br->key, &zbr->key); +key_read (&br->key, &zbr->key); zbr->lnum =le32_to_cpu (br->lnum); zbr->offs =le32_to_cpu (br->offs); zbr->len =le32_to_cpu (br->len);
@@ -321,7 +320,7 @@ static int read_znode(struct ubifs_info goto out_dump; } -switch (key_type (c, &zbr->key)) { +switch (key_type (&zbr->key)) {case UBIFS_INO_KEY :case UBIFS_DATA_KEY :case UBIFS_DENT_KEY :
@@ -337,7 +336,7 @@ static int read_znode(struct ubifs_infoif (znode->level)continue ; - type =key_type (c, &zbr->key); + type =key_type (&zbr->key);if (c->ranges[type].max_len ==0 ) {if (zbr->len != c->ranges[type].len) { dbg_err("bad target node (type %d) length (%d)",
@@ -368,12 +367,12 @@ static int read_znode(struct ubifs_info key1 = &znode->zbranch[i].key; key2 = &znode->zbranch[i +1 ].key; - cmp =keys_cmp (c, key1, key2); + cmp =keys_cmp (key1, key2);if (cmp >0 ) {dbg_err ("bad key order (keys %d and %d)" , i, i +1 ); err =6 ; goto out_dump; - }else if (cmp ==0 && !is_hash_key (c, key1)) { + }else if (cmp ==0 && !is_hash_key (key1)) {/* These can only be keys with colliding hash */ dbg_err ("keys %d and %d are not hashed but equivalent" , i, i +1 );
@@ -459,7 +458,7 @@ int ubifs_tnc_read_node(struct ubifs_inf void *node) {union ubifs_key key1, *key = &zbr->key; -int err, type =key_type (c, key); +int err, type =key_type (key);struct ubifs_wbuf *wbuf;/*
@@ -480,8 +479,8 @@ int ubifs_tnc_read_node(struct ubifs_inf }/* Make sure the key of the read node is correct */ -key_read (c, node +UBIFS_KEY_OFFSET , &key1); -if (!keys_eq (c, key, &key1)) { +key_read (node +UBIFS_KEY_OFFSET , &key1); +if (!keys_eq (key, &key1)) {ubifs_err ("bad key in node at LEB %d:%d" , zbr->lnum, zbr->offs); dbg_tnc("looked for key %s found node's key %s",
fs/ubifs/ubifs.h +4 -7
@@ -1256,7 +1256,7 @@ struct ubifs_info {long long main_bytes;uint8_t key_hash_type; -uint32_t (*key_hash)(const char *str,int len); +uint32_t (*key_hash)(int len);int key_fmt;int key_len;int fanout;
@@ -1459,8 +1459,7 @@ struct ubifs_scan_leb *ubifs_start_scan( int offs, void *sbuf);void ubifs_end_scan (const struct ubifs_info *c,struct ubifs_scan_leb *sleb,int lnum,int offs); -int ubifs_add_snod (const struct ubifs_info *c,struct ubifs_scan_leb *sleb, -void *buf,int offs); +int ubifs_add_snod (struct ubifs_scan_leb *sleb,void *buf,int offs);void ubifs_scanned_corruption (const struct ubifs_info *c,int lnum,int offs,void *buf);
@@ -1559,8 +1558,7 @@ int ubifs_tnc_bulk_read(struct ubifs_inf/* tnc_misc.c */ struct ubifs_znode *ubifs_tnc_levelorder_next (struct ubifs_znode *zr,struct ubifs_znode *znode); -int ubifs_search_zbranch (const struct ubifs_info *c, -const struct ubifs_znode *znode, +int ubifs_search_zbranch (const struct ubifs_znode *znode,const union ubifs_key *key,int *n);struct ubifs_znode *ubifs_tnc_postorder_first (struct ubifs_znode *znode);struct ubifs_znode *ubifs_tnc_postorder_next (struct ubifs_znode *znode);
@@ -1597,8 +1595,7 @@ struct ubifs_sb_node *ubifs_read_sb_nodeint ubifs_write_sb_node (struct ubifs_info *c,struct ubifs_sb_node *sup);/* replay.c */ -int ubifs_validate_entry (struct ubifs_info *c, -const struct ubifs_dent_node *dent); +int ubifs_validate_entry (const struct ubifs_dent_node *dent);int ubifs_replay_journal (struct ubifs_info *c);/* gc.c */
fs/ubifs/xattr.c +2 -2
@@ -441,7 +441,7 @@ ssize_t ubifs_listxattr(struct dentry *dif (len > size)return -ERANGE ; -lowest_xent_key (c, &key, host->i_ino); +lowest_xent_key (&key, host->i_ino);while (1 ) {int type;
@@ -468,7 +468,7 @@ ssize_t ubifs_listxattr(struct dentry *dkfree (pxent); pxent = xent; -key_read (c, &xent->key, &key); +key_read (&xent->key, &key); }kfree (pxent);
---
Regards--
Subrata
Quoted 9 lines · Subrata Modak
Hi,
"const struct
ubifs_info*c" exists as an extra argument for major function definitions under the "fs/ubifs/*" code. The reason why this extra argument exists is based on assumtion that there will be several key schemes. It is possible to add more than one, but we use only one. When there is practically no usage of them presently, they can be removed, and if needed can be added later.
Quoted 4 lines
The following patch does that by removing:
1) "const structubifs_info*c" where it is not used/necessary,
2) removexent_key_init_hash()function, as it is also not used,
3) removedata_key_init_flash()function, as it is also not used anywhere,
Fine with 2 and 3. Not fine with 1, unless it makes the code smaller or more optimal.
Signature · 2 lines
Best regards, Artem Bityutskiy (Битюцкий Артём)
Quoted 10 lines · Artem Bityutskiy
Quoted 9 lines · Subrata Modak
Hi,
"const struct
ubifs_info*c" exists as an extra argument for major function definitions under the "fs/ubifs/*" code. The reason why this extra argument exists is based on assumtion that there will be several key schemes. It is possible to add more than one, but we use only one. When there is practically no usage of them presently, they can be removed, and if needed can be added later.
Quoted 7 lines
Quoted 4 lines
The following patch does that by removing:
1) "const structubifs_info*c" where it is not used/necessary,
2) removexent_key_init_hash()function, as it is also not used,
3) removedata_key_init_flash()function, as it is also not used anywhere,Fine with 2 and 3. Not fine with 1, unless it makes the code smaller or more optimal.
Hmmm. I see. But, it took 95% of my effort. Ok then, do you want me to send a separate patch for 2) & 3), or, you will automatically isolate them from the sent one.
Regards--
Subrata
Quoted 1 line
Quoted 11 lines · Subrata Modak
Quoted 10 lines · Artem Bityutskiy
Quoted 9 lines · Subrata Modak
Hi,
"const struct
ubifs_info*c" exists as an extra argument for major function definitions under the "fs/ubifs/*" code. The reason why this extra argument exists is based on assumtion that there will be several key schemes. It is possible to add more than one, but we use only one. When there is practically no usage of them presently, they can be removed, and if needed can be added later.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
The following patch does that by removing:
1) "const structubifs_info*c" where it is not used/necessary,
2) removexent_key_init_hash()function, as it is also not used,
3) removedata_key_init_flash()function, as it is also not used anywhere,Fine with 2 and 3. Not fine with 1, unless it makes the code smaller or more optimal.
Hmmm. I see. But, it took 95% of my effort.
But yesterday I said that I would not like to remove that argument unless it makes the code larger. You answered you would check this. And then you came up with this patches.
Quoted 3 lines
Ok then, do you want me to
send a separate patch for 2) & 3), or, you will automatically isolate them from the sent one.
I can isolate them myself, thanks for the patch.
Signature · 2 lines
Best Regards, Artem Bityutskiy (Артём Битюцкий)
Quoted 5 lines · Artem Bityutskiy
Quoted 3 lines
Ok then, do you want me to
send a separate patch for 2) & 3), or, you will automatically isolate them from the sent one.I can isolate them myself, thanks for the patch.
Is this OK?
http://git.infradead.org/ubifs-2.6.git?a=commit;h=d71df6df5752abe700d547016baea801ce868844
Signature · 2 lines
Best regards, Artem Bityutskiy (Битюцкий Артём)
Quoted 9 lines · Artem Bityutskiy
Quoted 5 lines · Artem Bityutskiy
Quoted 3 lines
Ok then, do you want me to
send a separate patch for 2) & 3), or, you will automatically isolate them from the sent one.I can isolate them myself, thanks for the patch.
Is this OK?
http://git.infradead.org/ubifs-2.6.git?a=commit;h=d71df6df5752abe700d547016baea801ce868844
Yes. Thanks.
Regards--
Subrata