* [PATCH] ext4: reduce arguments of ext4_fc_add_dentry_tlv
@ 2021-07-27 8:07 Guoqing Jiang
2021-07-27 17:36 ` harshad shirwadkar
2021-08-13 14:56 ` Theodore Ts'o
0 siblings, 2 replies; 4+ messages in thread
From: Guoqing Jiang @ 2021-07-27 8:07 UTC (permalink / raw)
To: tytso, adilger.kernel; +Cc: linux-ext4
From: Guoqing Jiang <jiangguoqing@kylinos.cn>
Let's pass fc_dentry directly since those arguments (tag, parent_ino and
ino etc) can be deferenced from it.
Signed-off-by: Guoqing Jiang <jiangguoqing@kylinos.cn>
---
fs/ext4/fast_commit.c | 27 +++++++++------------------
1 file changed, 9 insertions(+), 18 deletions(-)
diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c
index 5106c9fe2e19..797105adcabf 100644
--- a/fs/ext4/fast_commit.c
+++ b/fs/ext4/fast_commit.c
@@ -775,28 +775,27 @@ static bool ext4_fc_add_tlv(struct super_block *sb, u16 tag, u16 len, u8 *val,
}
/* Same as above, but adds dentry tlv. */
-static bool ext4_fc_add_dentry_tlv(struct super_block *sb, u16 tag,
- int parent_ino, int ino, int dlen,
- const unsigned char *dname,
- u32 *crc)
+static bool ext4_fc_add_dentry_tlv(struct super_block *sb, u32 *crc,
+ struct ext4_fc_dentry_update *fc_dentry)
{
struct ext4_fc_dentry_info fcd;
struct ext4_fc_tl tl;
+ int dlen = fc_dentry->fcd_name.len;
u8 *dst = ext4_fc_reserve_space(sb, sizeof(tl) + sizeof(fcd) + dlen,
crc);
if (!dst)
return false;
- fcd.fc_parent_ino = cpu_to_le32(parent_ino);
- fcd.fc_ino = cpu_to_le32(ino);
- tl.fc_tag = cpu_to_le16(tag);
+ fcd.fc_parent_ino = cpu_to_le32(fc_dentry->fcd_parent);
+ fcd.fc_ino = cpu_to_le32(fc_dentry->fcd_ino);
+ tl.fc_tag = cpu_to_le16(fc_dentry->fcd_op);
tl.fc_len = cpu_to_le16(sizeof(fcd) + dlen);
ext4_fc_memcpy(sb, dst, &tl, sizeof(tl), crc);
dst += sizeof(tl);
ext4_fc_memcpy(sb, dst, &fcd, sizeof(fcd), crc);
dst += sizeof(fcd);
- ext4_fc_memcpy(sb, dst, dname, dlen, crc);
+ ext4_fc_memcpy(sb, dst, fc_dentry->fcd_name.name, dlen, crc);
dst += dlen;
return true;
@@ -991,11 +990,7 @@ __acquires(&sbi->s_fc_lock)
&sbi->s_fc_dentry_q[FC_Q_MAIN], fcd_list) {
if (fc_dentry->fcd_op != EXT4_FC_TAG_CREAT) {
spin_unlock(&sbi->s_fc_lock);
- if (!ext4_fc_add_dentry_tlv(
- sb, fc_dentry->fcd_op,
- fc_dentry->fcd_parent, fc_dentry->fcd_ino,
- fc_dentry->fcd_name.len,
- fc_dentry->fcd_name.name, crc)) {
+ if (!ext4_fc_add_dentry_tlv(sb, crc, fc_dentry)) {
ret = -ENOSPC;
goto lock_and_exit;
}
@@ -1034,11 +1029,7 @@ __acquires(&sbi->s_fc_lock)
if (ret)
goto lock_and_exit;
- if (!ext4_fc_add_dentry_tlv(
- sb, fc_dentry->fcd_op,
- fc_dentry->fcd_parent, fc_dentry->fcd_ino,
- fc_dentry->fcd_name.len,
- fc_dentry->fcd_name.name, crc)) {
+ if (!ext4_fc_add_dentry_tlv(sb, crc, fc_dentry)) {
ret = -ENOSPC;
goto lock_and_exit;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ext4: reduce arguments of ext4_fc_add_dentry_tlv
2021-07-27 8:07 [PATCH] ext4: reduce arguments of ext4_fc_add_dentry_tlv Guoqing Jiang
@ 2021-07-27 17:36 ` harshad shirwadkar
2021-07-29 9:35 ` Guoqing Jiang
2021-08-13 14:56 ` Theodore Ts'o
1 sibling, 1 reply; 4+ messages in thread
From: harshad shirwadkar @ 2021-07-27 17:36 UTC (permalink / raw)
To: Guoqing Jiang; +Cc: Theodore Y. Ts'o, Andreas Dilger, Ext4 Developers List
Thanks for the cleanup! Looks good.
Reviewed-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
On Tue, Jul 27, 2021 at 1:11 AM Guoqing Jiang <guoqing.jiang@linux.dev> wrote:
>
> From: Guoqing Jiang <jiangguoqing@kylinos.cn>
>
> Let's pass fc_dentry directly since those arguments (tag, parent_ino and
> ino etc) can be deferenced from it.
>
> Signed-off-by: Guoqing Jiang <jiangguoqing@kylinos.cn>
> ---
> fs/ext4/fast_commit.c | 27 +++++++++------------------
> 1 file changed, 9 insertions(+), 18 deletions(-)
>
> diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c
> index 5106c9fe2e19..797105adcabf 100644
> --- a/fs/ext4/fast_commit.c
> +++ b/fs/ext4/fast_commit.c
> @@ -775,28 +775,27 @@ static bool ext4_fc_add_tlv(struct super_block *sb, u16 tag, u16 len, u8 *val,
> }
>
> /* Same as above, but adds dentry tlv. */
> -static bool ext4_fc_add_dentry_tlv(struct super_block *sb, u16 tag,
> - int parent_ino, int ino, int dlen,
> - const unsigned char *dname,
> - u32 *crc)
> +static bool ext4_fc_add_dentry_tlv(struct super_block *sb, u32 *crc,
> + struct ext4_fc_dentry_update *fc_dentry)
> {
> struct ext4_fc_dentry_info fcd;
> struct ext4_fc_tl tl;
> + int dlen = fc_dentry->fcd_name.len;
> u8 *dst = ext4_fc_reserve_space(sb, sizeof(tl) + sizeof(fcd) + dlen,
> crc);
>
> if (!dst)
> return false;
>
> - fcd.fc_parent_ino = cpu_to_le32(parent_ino);
> - fcd.fc_ino = cpu_to_le32(ino);
> - tl.fc_tag = cpu_to_le16(tag);
> + fcd.fc_parent_ino = cpu_to_le32(fc_dentry->fcd_parent);
> + fcd.fc_ino = cpu_to_le32(fc_dentry->fcd_ino);
> + tl.fc_tag = cpu_to_le16(fc_dentry->fcd_op);
> tl.fc_len = cpu_to_le16(sizeof(fcd) + dlen);
> ext4_fc_memcpy(sb, dst, &tl, sizeof(tl), crc);
> dst += sizeof(tl);
> ext4_fc_memcpy(sb, dst, &fcd, sizeof(fcd), crc);
> dst += sizeof(fcd);
> - ext4_fc_memcpy(sb, dst, dname, dlen, crc);
> + ext4_fc_memcpy(sb, dst, fc_dentry->fcd_name.name, dlen, crc);
> dst += dlen;
>
> return true;
> @@ -991,11 +990,7 @@ __acquires(&sbi->s_fc_lock)
> &sbi->s_fc_dentry_q[FC_Q_MAIN], fcd_list) {
> if (fc_dentry->fcd_op != EXT4_FC_TAG_CREAT) {
> spin_unlock(&sbi->s_fc_lock);
> - if (!ext4_fc_add_dentry_tlv(
> - sb, fc_dentry->fcd_op,
> - fc_dentry->fcd_parent, fc_dentry->fcd_ino,
> - fc_dentry->fcd_name.len,
> - fc_dentry->fcd_name.name, crc)) {
> + if (!ext4_fc_add_dentry_tlv(sb, crc, fc_dentry)) {
> ret = -ENOSPC;
> goto lock_and_exit;
> }
> @@ -1034,11 +1029,7 @@ __acquires(&sbi->s_fc_lock)
> if (ret)
> goto lock_and_exit;
>
> - if (!ext4_fc_add_dentry_tlv(
> - sb, fc_dentry->fcd_op,
> - fc_dentry->fcd_parent, fc_dentry->fcd_ino,
> - fc_dentry->fcd_name.len,
> - fc_dentry->fcd_name.name, crc)) {
> + if (!ext4_fc_add_dentry_tlv(sb, crc, fc_dentry)) {
> ret = -ENOSPC;
> goto lock_and_exit;
> }
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ext4: reduce arguments of ext4_fc_add_dentry_tlv
2021-07-27 17:36 ` harshad shirwadkar
@ 2021-07-29 9:35 ` Guoqing Jiang
0 siblings, 0 replies; 4+ messages in thread
From: Guoqing Jiang @ 2021-07-29 9:35 UTC (permalink / raw)
To: harshad shirwadkar
Cc: Theodore Y. Ts'o, Andreas Dilger, Ext4 Developers List
On 7/28/21 1:36 AM, harshad shirwadkar wrote:
> Thanks for the cleanup! Looks good.
>
> Reviewed-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
Thanks for your review!
Guoqing
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ext4: reduce arguments of ext4_fc_add_dentry_tlv
2021-07-27 8:07 [PATCH] ext4: reduce arguments of ext4_fc_add_dentry_tlv Guoqing Jiang
2021-07-27 17:36 ` harshad shirwadkar
@ 2021-08-13 14:56 ` Theodore Ts'o
1 sibling, 0 replies; 4+ messages in thread
From: Theodore Ts'o @ 2021-08-13 14:56 UTC (permalink / raw)
To: adilger.kernel, Guoqing Jiang; +Cc: Theodore Ts'o, linux-ext4
On Tue, 27 Jul 2021 16:07:08 +0800, Guoqing Jiang wrote:
> Let's pass fc_dentry directly since those arguments (tag, parent_ino and
> ino etc) can be deferenced from it.
Applied, thanks!
[1/1] ext4: reduce arguments of ext4_fc_add_dentry_tlv
commit: 78e89124cc42a0cbaf214ecd5021ee19ca4f9294
Best regards,
--
Theodore Ts'o <tytso@mit.edu>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-08-13 14:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-27 8:07 [PATCH] ext4: reduce arguments of ext4_fc_add_dentry_tlv Guoqing Jiang
2021-07-27 17:36 ` harshad shirwadkar
2021-07-29 9:35 ` Guoqing Jiang
2021-08-13 14:56 ` Theodore Ts'o
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.