From: Ben Myers <bpm@sgi.com>
To: Dave Chinner <david@fromorbit.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 3/4] xfs: Remote attr validation fixes and optimisations
Date: Tue, 30 Apr 2013 16:31:09 -0500 [thread overview]
Message-ID: <20130430213109.GL29359@sgi.com> (raw)
In-Reply-To: <1367321976-18268-4-git-send-email-david@fromorbit.com>
Hi Dave,
On Tue, Apr 30, 2013 at 09:39:35PM +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> - optimise the calcuation for the number of blocks in a remote
> xattr.
> - check attribute length against MAX_XATTR_SIZE, not MAXPATHLEN
> - whitespace fixes
>
> Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by:
I guess this is what you intended?
Else, looks good to me.
Reviewed-by: Ben Myers <bpm@sgi.com>
Thanks,
Ben
> ---
> fs/xfs/xfs_attr_remote.c | 19 +++++--------------
> 1 file changed, 5 insertions(+), 14 deletions(-)
>
> diff --git a/fs/xfs/xfs_attr_remote.c b/fs/xfs/xfs_attr_remote.c
> index 53da46b..dee8446 100644
> --- a/fs/xfs/xfs_attr_remote.c
> +++ b/fs/xfs/xfs_attr_remote.c
> @@ -52,15 +52,9 @@ xfs_attr3_rmt_blocks(
> struct xfs_mount *mp,
> int attrlen)
> {
> - int fsblocks = 0;
> - int len = attrlen;
> -
> - do {
> - fsblocks++;
> - len -= XFS_ATTR3_RMT_BUF_SPACE(mp, mp->m_sb.sb_blocksize);
> - } while (len > 0);
> -
> - return fsblocks;
> + int buflen = XFS_ATTR3_RMT_BUF_SPACE(mp,
> + mp->m_sb.sb_blocksize);
> + return (attrlen + buflen - 1) / buflen;
> }
>
> static bool
> @@ -79,7 +73,7 @@ xfs_attr3_rmt_verify(
> if (bp->b_bn != be64_to_cpu(rmt->rm_blkno))
> return false;
> if (be32_to_cpu(rmt->rm_offset) +
> - be32_to_cpu(rmt->rm_bytes) >= MAXPATHLEN)
> + be32_to_cpu(rmt->rm_bytes) >= XATTR_SIZE_MAX)
> return false;
> if (rmt->rm_owner == 0)
> return false;
> @@ -183,7 +177,6 @@ xfs_attr3_rmt_hdr_ok(
>
> /* ok */
> return true;
> -
> }
>
> /*
> @@ -367,7 +360,6 @@ xfs_attr_rmtval_set(
> * spill for another block every 9 headers we require in this
> * loop.
> */
> -
> if (crcs && blkcnt == 0) {
> int total_len;
>
> @@ -422,9 +414,8 @@ xfs_attr_rmtval_set(
>
> byte_cnt = BBTOB(bp->b_length);
> byte_cnt = XFS_ATTR3_RMT_BUF_SPACE(mp, byte_cnt);
> - if (valuelen < byte_cnt) {
> + if (valuelen < byte_cnt)
> byte_cnt = valuelen;
> - }
>
> buf = bp->b_addr;
> buf += xfs_attr3_rmt_hdr_set(mp, dp->i_ino, offset,
> --
> 1.7.10.4
>
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2013-04-30 21:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-30 11:39 [PATCH 0/4] xfs: fixes for 3.10 merge window Dave Chinner
2013-04-30 11:39 ` [PATCH 1/4] xfs: Teach dquot recovery about CONFIG_XFS_QUOTA Dave Chinner
2013-04-30 18:22 ` Ben Myers
2013-04-30 11:39 ` [PATCH 2/4] xfs: introduce CONFIG_XFS_WARN Dave Chinner
2013-05-08 0:02 ` Ben Myers
2013-04-30 11:39 ` [PATCH 3/4] xfs: Remote attr validation fixes and optimisations Dave Chinner
2013-04-30 21:31 ` Ben Myers [this message]
2013-04-30 22:16 ` Dave Chinner
2013-04-30 11:39 ` [PATCH 4/4] xfs: fix da node magic number mismatches Dave Chinner
2013-04-30 21:33 ` Ben Myers
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=20130430213109.GL29359@sgi.com \
--to=bpm@sgi.com \
--cc=david@fromorbit.com \
--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.