Skip to contentSkip to conversation

btrfs: avoid passing int param to start_transaction which takes u64

PATCH In review Alexandru Moise 2 participants 4 messages Sep 13, 2015 – Sep 22, 2015 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 btrfs: avoid passing int param to start_transaction which takes u64

---
v2: Forgot to add transaction.h when I made the commit, many thanks Holger for pointing it out.

 fs/btrfs/transaction.c | 2 +-
 fs/btrfs/transaction.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
fs/btrfs/transaction.c +1 -1
index 8f259b3..8a83acd 100644
@@ -570,7 +570,7 @@ reserve_fail:
 }
 
 struct btrfs_trans_handle *btrfs_start_transaction(struct btrfs_root *root,
-						   int num_items)
+						   u64 num_items)
 {
 	return start_transaction(root, num_items, TRANS_START,
 				 BTRFS_RESERVE_FLUSH_ALL);
fs/btrfs/transaction.h +1 -1
index edc2fbc..51ba39f 100644
@@ -182,7 +182,7 @@ static inline void btrfs_clear_skip_qgroup(struct btrfs_trans_handle *trans)
 int btrfs_end_transaction(struct btrfs_trans_handle *trans,
 			  struct btrfs_root *root);
 struct btrfs_trans_handle *btrfs_start_transaction(struct btrfs_root *root,
-						   int num_items);
+						   u64 num_items);
 struct btrfs_trans_handle *btrfs_start_transaction_lflush(
 					struct btrfs_root *root, int num_items);
 struct btrfs_trans_handle *btrfs_join_transaction(struct btrfs_root *root);
Signature · 1 line
2.5.1
#1 lore raw
Quoted 14 lines · Alexandru Moise

---
v2: Forgot to add transaction.h when I made the commit, many thanks Holger for pointing it out.

 fs/btrfs/transaction.c | 2 +-
 fs/btrfs/transaction.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
fs/btrfs/transaction.c +0 -0
index 8f259b3..8a83acd 100644

fs/btrfs/transaction.c reserve_fail: · line 573

Quoted 5 lines
fs/btrfs/transaction.c +1 -1
@@ -570,7 +570,7 @@ reserve_fail:
 }
 
 struct btrfs_trans_handle *btrfs_start_transaction(struct btrfs_root *root,
-						   int num_items)
+						   u64 num_items)

I think it's better to do it the other way around, ie. let all the equivalents of 'num_items' be an int. We know that this is a small number, using u64 for that is an overkill. As the number is always positive, please make it 'unsigned'.

#2 lore raw
Quoted 17 lines · David Sterba
Quoted 16 lines · Alexandru Moise

---
v2: Forgot to add transaction.h when I made the commit, many thanks Holger for pointing it out.

 fs/btrfs/transaction.c | 2 +-
 fs/btrfs/transaction.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
fs/btrfs/transaction.c +0 -0
index 8f259b3..8a83acd 100644
@@ -570,7 +570,7 @@ reserve_fail:
 }
 
Quoted 8 lines

fs/btrfs/transaction.c reserve_fail: · line 573

Quoted 3 lines
fs/btrfs/transaction.c +1 -1
 struct btrfs_trans_handle *btrfs_start_transaction(struct btrfs_root *root,
-						   int num_items)
+						   u64 num_items)

I think it's better to do it the other way around, ie. let all the equivalents of 'num_items' be an int. We know that this is a small number, using u64 for that is an overkill. As the number is always positive, please make it 'unsigned'.

So you'd want it to be "unsigned int" or "u32"?

#3 lore raw
Quoted 6 lines · Alexandru Moise
Quoted 4 lines

I think it's better to do it the other way around, ie. let all the equivalents of 'num_items' be an int. We know that this is a small number, using u64 for that is an overkill. As the number is always positive, please make it 'unsigned'.

So you'd want it to be "unsigned int" or "u32"?

'unsigned int' please