Skip to contentSkip to conversation

f2fs:Make the function check_dnode have a return type of bool

PATCH In review Nicholas Krause 2 participants 5 messages Jun 29, 2015 – Jul 1, 2015 F2FS file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 f2fs:Make the function check_dnode have a return type of bool

This makes the function check_dnode have a return type of bool due to this particular function only ever returning either one or zero as its return value.

---
 fs/f2fs/gc.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
fs/f2fs/gc.c +5 -5
index e1e7361..ebd4c6c 100644
@@ -487,7 +487,7 @@ block_t start_bidx_of_node(unsigned int node_ofs, struct f2fs_inode_info *fi)
 	return bidx * ADDRS_PER_BLOCK + ADDRS_PER_INODE(fi);
 }
 
-static int check_dnode(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,
+static bool check_dnode(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,
 		struct node_info *dni, block_t blkaddr, unsigned int *nofs)
 {
 	struct page *node_page;
@@ -500,13 +500,13 @@ static int check_dnode(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,
 
 	node_page = get_node_page(sbi, nid);
 	if (IS_ERR(node_page))
-		return 0;
+		return false;
 
 	get_node_info(sbi, nid, dni);
 
 	if (sum->version != dni->version) {
 		f2fs_put_page(node_page, 1);
-		return 0;
+		return false;
 	}
 
 	*nofs = ofs_of_node(node_page);
@@ -514,8 +514,8 @@ static int check_dnode(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,
 	f2fs_put_page(node_page, 1);
 
 	if (source_blkaddr != blkaddr)
-		return 0;
-	return 1;
+		return false;
+	return true;
 }
 
 static void move_encrypted_block(struct inode *inode, block_t bidx)
Signature · 9 lines
2.1.4


------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
maintainer
#1 lore raw

Hi,

Quoted 14 lines · Nicholas Krause

This makes the function check_dnode have a return type of bool due to this particular function only ever returning either one or zero as its return value.

---
 fs/f2fs/gc.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
fs/f2fs/gc.c +0 -0
index e1e7361..ebd4c6c 100644

fs/f2fs/gc.c block_t start_bidx_of_node(unsigned int node_ofs, struct f2fs_inode_info *fi) · line 490

Quoted 5 lines
fs/f2fs/gc.c +1 -1
@@ -487,7 +487,7 @@ block_t start_bidx_of_node(unsigned int node_ofs, struct f2fs_inode_info *fi)
 	return bidx * ADDRS_PER_BLOCK + ADDRS_PER_INODE(fi);
 }
 
-static int check_dnode(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,
+static bool check_dnode(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,

Then, what about bool is_data_alive() ?

Thanks,

author
#2 lore raw
Quoted 20 lines · Jaegeuk Kim

Hi,

Quoted 17 lines · Nicholas Krause

This makes the function check_dnode have a return type of bool due to this particular function only ever returning either one or zero as its return value.

---
 fs/f2fs/gc.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
fs/f2fs/gc.c +0 -0
index e1e7361..ebd4c6c 100644
@@ -487,7 +487,7 @@ block_t start_bidx_of_node(unsigned int node_ofs, struct f2fs_inode_info *fi)
 	return bidx * ADDRS_PER_BLOCK + ADDRS_PER_INODE(fi);
 }
 
Quoted 7 lines

fs/f2fs/gc.c block_t start_bidx_of_node(unsigned int node_ofs, struct f2fs_inode_info *fi) · line 490

Quoted 2 lines
fs/f2fs/gc.c +1 -1
-static int check_dnode(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,
+static bool check_dnode(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,

Then, what about bool is_data_alive() ?

Thanks,

There is no function of this name in my searching with either lxr or cscope. Either my tools aren't finding it or the function you are requesting I make bool has been removed.
Nick

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/

maintainer
#3 lore raw
Quoted 28 lines · nick
Quoted 25 lines · Jaegeuk Kim

Hi,

Quoted 14 lines · Nicholas Krause

This makes the function check_dnode have a return type of bool due to this particular function only ever returning either one or zero as its return value.

---
 fs/f2fs/gc.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
fs/f2fs/gc.c +0 -0
index e1e7361..ebd4c6c 100644

fs/f2fs/gc.c block_t start_bidx_of_node(unsigned int node_ofs, struct f2fs_inode_info *fi) · line 490

Quoted 5 lines
fs/f2fs/gc.c +1 -1
@@ -487,7 +487,7 @@ block_t start_bidx_of_node(unsigned int node_ofs, struct f2fs_inode_info *fi)
 	return bidx * ADDRS_PER_BLOCK + ADDRS_PER_INODE(fi);
 }
 
-static int check_dnode(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,
+static bool check_dnode(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,

Then, what about bool is_data_alive() ?

Quoted 6 lines
Quoted 2 lines

Thanks,

There is no function of this name in my searching with either lxr or cscope. Either my tools aren't finding it or the function you are requesting I make bool has been removed.
Nick

I meant;
if you want to change the return type as a bool type, what about changing its function name too? (e.g., is_data_alive())

author
#4 lore raw
Quoted 31 lines · Jaegeuk Kim
Quoted 30 lines · nick
Quoted 27 lines · Jaegeuk Kim

Hi,

Quoted 14 lines · Nicholas Krause

This makes the function check_dnode have a return type of bool due to this particular function only ever returning either one or zero as its return value.

---
 fs/f2fs/gc.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
fs/f2fs/gc.c +0 -0
index e1e7361..ebd4c6c 100644

fs/f2fs/gc.c block_t start_bidx_of_node(unsigned int node_ofs, struct f2fs_inode_info *fi) · line 490

Quoted 5 lines
fs/f2fs/gc.c +1 -1
@@ -487,7 +487,7 @@ block_t start_bidx_of_node(unsigned int node_ofs, struct f2fs_inode_info *fi)
 	return bidx * ADDRS_PER_BLOCK + ADDRS_PER_INODE(fi);
 }
 
-static int check_dnode(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,
+static bool check_dnode(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,

Then, what about bool is_data_alive() ?

Thanks,

Quoted 9 lines
Quoted 4 lines

There is no function of this name in my searching with either lxr or cscope. Either my tools aren't finding it or the function you are requesting I make bool has been removed.
Nick

I meant;
if you want to change the return type as a bool type, what about changing its function name too? (e.g., is_data_alive())

Sorry Jaeguek,
I misunderstood what you wanted. In addition thanks for the quick reply. Nick

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/