mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Gou Hao <gouhao@uniontech.com>
Cc: tytso@mit.edu, adilger.kernel@dilger.ca, jack@suse.cz,
	linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org,
	gouhaojake@163.com
Subject: Re: [PATCH] ext4: delete redundant calculations in ext4_mb_get_buddy_page_lock()
Date: Mon, 23 Oct 2023 13:44:47 +0200	[thread overview]
Message-ID: <20231023114447.crn3bt4qdmkxkrxi@quack3> (raw)
In-Reply-To: <20231023013416.17246-1-gouhao@uniontech.com>

On Mon 23-10-23 09:34:16, Gou Hao wrote:
> 'blocks_per_page' is always 1 after 'if (blocks_per_page >= 2)',
> 'pnum' and 'block' is equal in this case.
> 
> Signed-off-by: Gou Hao <gouhao@uniontech.com>
> Signed-off-by: Gou Hao <gouhaojake@163.com>

No need for two signed-off-by here. Any one from you is enough :)

> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> index 454d5612641e..8442f5474b25 100644
> --- a/fs/ext4/mballoc.c
> +++ b/fs/ext4/mballoc.c
> @@ -1456,9 +1456,7 @@ static int ext4_mb_get_buddy_page_lock(struct super_block *sb,
>  		return 0;
>  	}
>  
> -	block++;
> -	pnum = block / blocks_per_page;
> -	page = find_or_create_page(inode->i_mapping, pnum, gfp);
> +	page = find_or_create_page(inode->i_mapping, ++block, gfp);
						     ^^^ perhaps just
"block + 1" here? Maybe also add a comment before this call like:

	/* blocks_per_page == 1, hence we need another page for the buddy */

Otherwise the patch looks good!

								Honza

-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

  reply	other threads:[~2023-10-23 11:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-23  1:34 Gou Hao
2023-10-23 11:44 ` Jan Kara [this message]
2023-10-24  2:35   ` Gou Hao
2023-10-24  3:52 ` [PATCH V2] " Gou Hao
2024-01-09  2:53   ` Theodore Ts'o

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231023114447.crn3bt4qdmkxkrxi@quack3 \
    --to=jack@suse.cz \
    --cc=adilger.kernel@dilger.ca \
    --cc=gouhao@uniontech.com \
    --cc=gouhaojake@163.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®