[17/22] ext4: optimize ext4_journal_callback_add
diff mbox series

Message ID 1563758631-29550-18-git-send-email-jsimmons@infradead.org
State New
Headers show
Series
  • ldiskfs patches against 5.2-rc2+
Related show

Commit Message

James Simmons July 22, 2019, 1:23 a.m. UTC
Change list_add_tail to list_add. It gives advantages to ldiskfs
in tgt_cb_last_committed. In the beginning of list will be placed
thandles with the highest transaction numbers. So at the first
iterations we will have the highest transno. It will save from
extra call of ptlrpc_commit_replies.

Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/ext4/ext4_jbd2.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

NeilBrown July 22, 2019, 5:27 a.m. UTC | #1
On Sun, Jul 21 2019, James Simmons wrote:

> Change list_add_tail to list_add. It gives advantages to ldiskfs
> in tgt_cb_last_committed. In the beginning of list will be placed
> thandles with the highest transaction numbers. So at the first
> iterations we will have the highest transno. It will save from
> extra call of ptlrpc_commit_replies.

If only more commit messages were like this !!  Thanks!

I suspect it would be better for that thing that needs to see the
highest transno first, to find a way to look at the end of the list
instead of the beginning.

This isn't the sort of change that can land in ext4.

NeilBrown


>
> Signed-off-by: James Simmons <jsimmons@infradead.org>
> ---
>  fs/ext4/ext4_jbd2.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ext4/ext4_jbd2.h b/fs/ext4/ext4_jbd2.h
> index 75a5309..5ebf8ee 100644
> --- a/fs/ext4/ext4_jbd2.h
> +++ b/fs/ext4/ext4_jbd2.h
> @@ -169,7 +169,7 @@ static inline void _ext4_journal_callback_add(handle_t *handle,
>  			struct ext4_journal_cb_entry *jce)
>  {
>  	/* Add the jce to transaction's private list */
> -	list_add_tail(&jce->jce_list, &handle->h_transaction->t_private_list);
> +	list_add(&jce->jce_list, &handle->h_transaction->t_private_list);
>  }
>  
>  static inline void ext4_journal_callback_add(handle_t *handle,
> -- 
> 1.8.3.1
Andreas Dilger July 23, 2019, 2:01 a.m. UTC | #2
This might be accommodated by a new API variant that allows the caller
to add this commit callback at the head of the list instead of the tail. 

The main question is whether such an API would be accepted upstream
without a user?  

Cheers, Andreas

> On Jul 21, 2019, at 23:27, NeilBrown <neilb@suse.com> wrote:
> 
>> On Sun, Jul 21 2019, James Simmons wrote:
>> 
>> Change list_add_tail to list_add. It gives advantages to ldiskfs
>> in tgt_cb_last_committed. In the beginning of list will be placed
>> thandles with the highest transaction numbers. So at the first
>> iterations we will have the highest transno. It will save from
>> extra call of ptlrpc_commit_replies.
> 
> If only more commit messages were like this !!  Thanks!
> 
> I suspect it would be better for that thing that needs to see the
> highest transno first, to find a way to look at the end of the list
> instead of the beginning.
> 
> This isn't the sort of change that can land in ext4.
> 
> NeilBrown
> 
> 
>> 
>> Signed-off-by: James Simmons <jsimmons@infradead.org>
>> ---
>> fs/ext4/ext4_jbd2.h | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/fs/ext4/ext4_jbd2.h b/fs/ext4/ext4_jbd2.h
>> index 75a5309..5ebf8ee 100644
>> --- a/fs/ext4/ext4_jbd2.h
>> +++ b/fs/ext4/ext4_jbd2.h
>> @@ -169,7 +169,7 @@ static inline void _ext4_journal_callback_add(handle_t *handle,
>>            struct ext4_journal_cb_entry *jce)
>> {
>>    /* Add the jce to transaction's private list */
>> -    list_add_tail(&jce->jce_list, &handle->h_transaction->t_private_list);
>> +    list_add(&jce->jce_list, &handle->h_transaction->t_private_list);
>> }
>> 
>> static inline void ext4_journal_callback_add(handle_t *handle,
>> -- 
>> 1.8.3.1

Patch
diff mbox series

diff --git a/fs/ext4/ext4_jbd2.h b/fs/ext4/ext4_jbd2.h
index 75a5309..5ebf8ee 100644
--- a/fs/ext4/ext4_jbd2.h
+++ b/fs/ext4/ext4_jbd2.h
@@ -169,7 +169,7 @@  static inline void _ext4_journal_callback_add(handle_t *handle,
 			struct ext4_journal_cb_entry *jce)
 {
 	/* Add the jce to transaction's private list */
-	list_add_tail(&jce->jce_list, &handle->h_transaction->t_private_list);
+	list_add(&jce->jce_list, &handle->h_transaction->t_private_list);
 }
 
 static inline void ext4_journal_callback_add(handle_t *handle,