[PATCH] ubifs: Remove uncallable debug code

Zhihao Cheng chengzhihao1 at huawei.com
Sun Jun 8 20:31:00 PDT 2025


在 2025/6/9 7:08, linux at treblig.org 写道:
> From: "Dr. David Alan Gilbert" <linux at treblig.org>
> 
> ubifs_dump_budget_req() and ubifs_dump_index() have been unused
> since they were originally added back in 2008's
> commit 1e51764a3c2a ("UBIFS: add new flash file system")
> 
> They were renamed from dbg_dump_budget_req() and dbg_dump_index() in
> 2012.
> 
> Remove them.
> 
> Signed-off-by: Dr. David Alan Gilbert <linux at treblig.org>
> ---
>   fs/ubifs/debug.c | 36 ------------------------------------
>   fs/ubifs/debug.h |  2 --
>   2 files changed, 38 deletions(-)

I guess these functions are used to debug in early development. I use 
them somtimes for debugging/developing. IMO, no need to drop them.
> 
> diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c
> index b01f382ce8db..05124392d1d9 100644
> --- a/fs/ubifs/debug.c
> +++ b/fs/ubifs/debug.c
> @@ -580,23 +580,6 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node, int node_len)
>   	spin_unlock(&dbg_lock);
>   }
>   
> -void ubifs_dump_budget_req(const struct ubifs_budget_req *req)
> -{
> -	spin_lock(&dbg_lock);
> -	pr_err("Budgeting request: new_ino %d, dirtied_ino %d\n",
> -	       req->new_ino, req->dirtied_ino);
> -	pr_err("\tnew_ino_d   %d, dirtied_ino_d %d\n",
> -	       req->new_ino_d, req->dirtied_ino_d);
> -	pr_err("\tnew_page    %d, dirtied_page %d\n",
> -	       req->new_page, req->dirtied_page);
> -	pr_err("\tnew_dent    %d, mod_dent     %d\n",
> -	       req->new_dent, req->mod_dent);
> -	pr_err("\tidx_growth  %d\n", req->idx_growth);
> -	pr_err("\tdata_growth %d dd_growth     %d\n",
> -	       req->data_growth, req->dd_growth);
> -	spin_unlock(&dbg_lock);
> -}
> -
>   void ubifs_dump_lstats(const struct ubifs_lp_stats *lst)
>   {
>   	spin_lock(&dbg_lock);
> @@ -963,25 +946,6 @@ void ubifs_dump_tnc(struct ubifs_info *c)
>   	pr_err("(pid %d) finish dumping TNC tree\n", current->pid);
>   }
>   
> -static int dump_znode(struct ubifs_info *c, struct ubifs_znode *znode,
> -		      void *priv)
> -{
> -	ubifs_dump_znode(c, znode);
> -	return 0;
> -}
> -
> -/**
> - * ubifs_dump_index - dump the on-flash index.
> - * @c: UBIFS file-system description object
> - *
> - * This function dumps whole UBIFS indexing B-tree, unlike 'ubifs_dump_tnc()'
> - * which dumps only in-memory znodes and does not read znodes which from flash.
> - */
> -void ubifs_dump_index(struct ubifs_info *c)
> -{
> -	dbg_walk_index(c, NULL, dump_znode, NULL);
> -}
> -
>   /**
>    * dbg_save_space_info - save information about flash space.
>    * @c: UBIFS file-system description object
> diff --git a/fs/ubifs/debug.h b/fs/ubifs/debug.h
> index d425861e6b82..1d5c8ee8b64a 100644
> --- a/fs/ubifs/debug.h
> +++ b/fs/ubifs/debug.h
> @@ -245,7 +245,6 @@ const char *dbg_snprintf_key(const struct ubifs_info *c,
>   void ubifs_dump_inode(struct ubifs_info *c, const struct inode *inode);
>   void ubifs_dump_node(const struct ubifs_info *c, const void *node,
>   		     int node_len);
> -void ubifs_dump_budget_req(const struct ubifs_budget_req *req);
>   void ubifs_dump_lstats(const struct ubifs_lp_stats *lst);
>   void ubifs_dump_budg(struct ubifs_info *c, const struct ubifs_budg_info *bi);
>   void ubifs_dump_lprop(const struct ubifs_info *c,
> @@ -260,7 +259,6 @@ void ubifs_dump_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap,
>   void ubifs_dump_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode,
>   		      struct ubifs_nnode *parent, int iip);
>   void ubifs_dump_tnc(struct ubifs_info *c);
> -void ubifs_dump_index(struct ubifs_info *c);
>   void ubifs_dump_lpt_lebs(const struct ubifs_info *c);
>   
>   int dbg_walk_index(struct ubifs_info *c, dbg_leaf_callback leaf_cb,
> 




More information about the linux-mtd mailing list