* [PATCH 4/4] btrfs: Return bool from btrfs_should_end_transaction
@ 2020-11-24 14:49 Nikolay Borisov
2020-11-25 11:54 ` David Sterba
0 siblings, 1 reply; 2+ messages in thread
From: Nikolay Borisov @ 2020-11-24 14:49 UTC (permalink / raw)
To: linux-btrfs; +Cc: Nikolay Borisov
Results in slightly smaller code.
add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-11 (-11)
Function old new delta
btrfs_should_end_transaction 96 85 -11
Total: Before=20070, After=20059, chg -0.05%
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
fs/btrfs/transaction.c | 4 ++--
fs/btrfs/transaction.h | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index f7b7f18c6ab9..e425451c5811 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -907,14 +907,14 @@ static bool should_end_transaction(struct btrfs_trans_handle *trans)
return !!btrfs_block_rsv_check(&fs_info->global_block_rsv, 5);
}
-int btrfs_should_end_transaction(struct btrfs_trans_handle *trans)
+bool btrfs_should_end_transaction(struct btrfs_trans_handle *trans)
{
struct btrfs_transaction *cur_trans = trans->transaction;
if (READ_ONCE(cur_trans->state) >= TRANS_STATE_COMMIT_START ||
test_bit(BTRFS_DELAYED_REFS_FLUSHING,
&cur_trans->delayed_refs.flags))
- return 1;
+ return true;
return should_end_transaction(trans);
}
diff --git a/fs/btrfs/transaction.h b/fs/btrfs/transaction.h
index 8241c050ba71..31ca81bad822 100644
--- a/fs/btrfs/transaction.h
+++ b/fs/btrfs/transaction.h
@@ -218,7 +218,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans);
int btrfs_commit_transaction_async(struct btrfs_trans_handle *trans,
int wait_for_unblock);
int btrfs_end_transaction_throttle(struct btrfs_trans_handle *trans);
-int btrfs_should_end_transaction(struct btrfs_trans_handle *trans);
+bool btrfs_should_end_transaction(struct btrfs_trans_handle *trans);
void btrfs_throttle(struct btrfs_fs_info *fs_info);
int btrfs_record_root_in_trans(struct btrfs_trans_handle *trans,
struct btrfs_root *root);
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 4/4] btrfs: Return bool from btrfs_should_end_transaction
2020-11-24 14:49 [PATCH 4/4] btrfs: Return bool from btrfs_should_end_transaction Nikolay Borisov
@ 2020-11-25 11:54 ` David Sterba
0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2020-11-25 11:54 UTC (permalink / raw)
To: Nikolay Borisov; +Cc: linux-btrfs
On Tue, Nov 24, 2020 at 04:49:25PM +0200, Nikolay Borisov wrote:
> Results in slightly smaller code.
>
> add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-11 (-11)
> Function old new delta
> btrfs_should_end_transaction 96 85 -11
> Total: Before=20070, After=20059, chg -0.05%
>
>
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Added to misc-next, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-11-25 11:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-24 14:49 [PATCH 4/4] btrfs: Return bool from btrfs_should_end_transaction Nikolay Borisov
2020-11-25 11:54 ` David Sterba
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox