Skip to contentSkip to conversation

ubifs: Remove uncallable debug code

PATCH In review [email protected] 2 participants 2 messages Jun 8, 2025 – Jun 9, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ubifs: Remove uncallable debug code

From: "Dr. David Alan Gilbert" <[email protected]>

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.

---
 fs/ubifs/debug.c | 36 ------------------------------------
 fs/ubifs/debug.h |  2 --
 2 files changed, 38 deletions(-)
fs/ubifs/debug.c +0 -36
index b01f382ce8db..05124392d1d9 100644
@@ -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
fs/ubifs/debug.h +0 -2
index d425861e6b82..1d5c8ee8b64a 100644
@@ -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,
Signature · 1 line
2.49.0
reviewer
#1 lore raw
Quoted 9 lines · 在 2025/6/9 7:08, [email protected] 写道:

From: "Dr. David Alan Gilbert" <[email protected]>

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.

Quoted 7 lines

Remove them.

---
  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.

Quoted 76 lines
fs/ubifs/debug.c +0 -36
index b01f382ce8db..05124392d1d9 100644
@@ -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
fs/ubifs/debug.h +0 -2
index d425861e6b82..1d5c8ee8b64a 100644
@@ -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,