From: Ben Myers <bpm@sgi.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 02/11] xfs: cleanup xfs_iomap_eof_align_last_fsb
Date: Wed, 4 Jan 2012 14:32:32 -0600 [thread overview]
Message-ID: <20120104203232.GB6390@sgi.com> (raw)
In-Reply-To: <20111218200130.970786897@bombadil.infradead.org>
On Sun, Dec 18, 2011 at 03:00:05PM -0500, Christoph Hellwig wrote:
> Replace the nasty if, else if, elseif condition with more natural C flow
> that expressed the logic we want here better.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Dave Chinner <dchinner@redhat.com>
>
> ---
> fs/xfs/xfs_iomap.c | 36 ++++++++++++++++++------------------
> 1 file changed, 18 insertions(+), 18 deletions(-)
>
> Index: xfs/fs/xfs/xfs_iomap.c
> ===================================================================
> --- xfs.orig/fs/xfs/xfs_iomap.c 2011-11-17 12:07:52.580802800 +0100
> +++ xfs/fs/xfs/xfs_iomap.c 2011-11-30 10:57:35.649224495 +0100
> @@ -57,26 +57,26 @@ xfs_iomap_eof_align_last_fsb(
> xfs_fileoff_t *last_fsb)
> {
> xfs_fileoff_t new_last_fsb = 0;
> - xfs_extlen_t align;
> + xfs_extlen_t align = 0;
> int eof, error;
>
> - if (XFS_IS_REALTIME_INODE(ip))
> - ;
> - /*
> - * If mounted with the "-o swalloc" option, roundup the allocation
> - * request to a stripe width boundary if the file size is >=
> - * stripe width and we are allocating past the allocation eof.
> - */
> - else if (mp->m_swidth && (mp->m_flags & XFS_MOUNT_SWALLOC) &&
> - (ip->i_size >= XFS_FSB_TO_B(mp, mp->m_swidth)))
> - new_last_fsb = roundup_64(*last_fsb, mp->m_swidth);
> - /*
> - * Roundup the allocation request to a stripe unit (m_dalign) boundary
> - * if the file size is >= stripe unit size, and we are allocating past
> - * the allocation eof.
> - */
> - else if (mp->m_dalign && (ip->i_size >= XFS_FSB_TO_B(mp, mp->m_dalign)))
> - new_last_fsb = roundup_64(*last_fsb, mp->m_dalign);
> + if (!XFS_IS_REALTIME_INODE(ip)) {
> + /*
> + * Round up the allocation request to a stripe unit
> + * (m_dalign) boundary if the file size is >= stripe unit
> + * size, and we are allocating past the allocation eof.
> + *
> + * If mounted with the "-o swalloc" option the alignment is
> + * increased from the strip unit size to the stripe width.
> + */
> + if (mp->m_swidth && (mp->m_flags & XFS_MOUNT_SWALLOC))
> + align = mp->m_swidth;
> + else if (mp->m_dalign)
> + align = mp->m_dalign;
> +
> + if (align && ip->i_size >= XFS_FSB_TO_B(mp, align))
> + new_last_fsb = roundup_64(*last_fsb, align);
> + }
The behavior looks equivalent and this is much easier on the eyes.
Looks good.
Reviewed-by: Ben Myers <bpm@sgi.com>
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2012-01-04 20:32 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-18 20:00 [PATCH 00/11] inode shrink and misc updates V2 Christoph Hellwig
2011-12-18 20:00 ` [PATCH 01/11] xfs: remove xfs_itruncate_data Christoph Hellwig
2012-01-03 21:53 ` Ben Myers
2012-01-04 9:27 ` Christoph Hellwig
2011-12-18 20:00 ` [PATCH 02/11] xfs: cleanup xfs_iomap_eof_align_last_fsb Christoph Hellwig
2012-01-04 20:32 ` Ben Myers [this message]
2011-12-18 20:00 ` [PATCH 03/11] xfs: remove the unused dm_attrs structure Christoph Hellwig
2012-01-04 21:13 ` Ben Myers
2011-12-18 20:00 ` [PATCH 04/11] xfs: remove the if_ext_max field in struct xfs_ifork Christoph Hellwig
2012-01-06 16:58 ` Ben Myers
2012-01-16 22:45 ` Ben Myers
2012-01-17 15:16 ` Ben Myers
2012-01-17 17:04 ` Mark Tinguely
2011-12-18 20:00 ` [PATCH 05/11] xfs: make i_flags an unsigned long Christoph Hellwig
2011-12-18 20:00 ` [PATCH 06/11] xfs: replace i_flock with a sleeping bitlock Christoph Hellwig
2012-01-13 21:49 ` Ben Myers
2011-12-18 20:00 ` [PATCH 07/11] xfs: replace i_pin_wait with a bit waitqueue Christoph Hellwig
2012-01-13 22:42 ` Ben Myers
2011-12-18 20:00 ` [PATCH 08/11] xfs: remove the i_size field in struct xfs_inode Christoph Hellwig
2012-01-16 18:32 ` Ben Myers
2012-01-16 19:45 ` Ben Myers
2011-12-18 20:00 ` [PATCH 09/11] xfs: remove the i_new_size " Christoph Hellwig
2011-12-18 22:13 ` Dave Chinner
2012-01-16 22:41 ` Ben Myers
2012-01-17 20:14 ` Ben Myers
2011-12-18 20:00 ` [PATCH 10/11] xfs: always return with the iolock held from xfs_file_aio_write_checks Christoph Hellwig
2012-01-17 20:18 ` Ben Myers
2012-01-20 12:51 ` Jeff Liu
2011-12-18 20:00 ` [PATCH 11/11] xfs: cleanup xfs_file_aio_write Christoph Hellwig
2012-01-17 20:42 ` Ben Myers
-- strict thread matches above, loose matches on Subject: below --
2011-12-08 15:57 [PATCH 00/11] inode shrink and misc updates Christoph Hellwig
2011-12-08 15:57 ` [PATCH 02/11] xfs: cleanup xfs_iomap_eof_align_last_fsb Christoph Hellwig
2011-12-13 21:25 ` Dave Chinner
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=20120104203232.GB6390@sgi.com \
--to=bpm@sgi.com \
--cc=hch@infradead.org \
--cc=xfs@oss.sgi.com \
/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 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.