From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Chandan Rajendra <chandan@linux.ibm.com>
Cc: linux-xfs@vger.kernel.org, sandeen@sandeen.net
Subject: Re: [PATCH V2] mkfs: Round down log device size if aligned value is larger than device size
Date: Tue, 19 Mar 2019 08:17:47 -0700 [thread overview]
Message-ID: <20190319151747.GR4929@magnolia> (raw)
In-Reply-To: <20190319051027.27897-1-chandan@linux.ibm.com>
On Tue, Mar 19, 2019 at 10:40:27AM +0530, Chandan Rajendra wrote:
> When using a disk of size 798903808 bytes as the log device and when
> having a log stripe unit size of 32768, align_log_size() rounds up log
> device size to 195048 4k blocks i.e. 798916608. This value is larger
> than the device size. Hence the last call to write(2) inside
> libxfs_device_zero() would end up returning an error.
>
> To fix this bug, we now round down the log device size if the newly
> computed size is larger than the actual log device size.
>
> Signed-off-by: Chandan Rajendra <chandan@linux.ibm.com>
> ---
> Changelog:
> v1 -> v2:
> 1. Remove extraneous parenthesis around conditions.
>
> mkfs/xfs_mkfs.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
> index d1387ddf..c9e22560 100644
> --- a/mkfs/xfs_mkfs.c
> +++ b/mkfs/xfs_mkfs.c
> @@ -2937,8 +2937,9 @@ _("log size %lld is not a multiple of the log stripe unit %d\n"),
> tmp_logblocks = ((cfg->logblocks + (sunit - 1)) / sunit) * sunit;
>
> /* If the log is too large, round down instead of round up */
> - if ((tmp_logblocks > XFS_MAX_LOG_BLOCKS) ||
> - ((tmp_logblocks << cfg->blocklog) > XFS_MAX_LOG_BYTES)) {
> + if (tmp_logblocks > XFS_MAX_LOG_BLOCKS ||
> + tmp_logblocks > cfg->logblocks ||
> + (tmp_logblocks << cfg->blocklog) > XFS_MAX_LOG_BYTES) {
> tmp_logblocks = (cfg->logblocks / sunit) * sunit;
Looks better,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
--D
> }
> cfg->logblocks = tmp_logblocks;
> --
> 2.19.1
>
prev parent reply other threads:[~2019-03-19 15:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-17 9:19 [PATCH] mkfs: Round down log device size if aligned value is larger than device size Chandan Rajendra
2019-03-18 15:57 ` Darrick J. Wong
2019-03-19 5:10 ` [PATCH V2] " Chandan Rajendra
2019-03-19 15:17 ` Darrick J. Wong [this message]
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=20190319151747.GR4929@magnolia \
--to=darrick.wong@oracle.com \
--cc=chandan@linux.ibm.com \
--cc=linux-xfs@vger.kernel.org \
--cc=sandeen@sandeen.net \
/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