From: Brian Foster <bfoster@redhat.com>
To: Dave Chinner <david@fromorbit.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 15/16] xfs: pass xfs_da_args to xfs_attr_leaf_newentsize
Date: Tue, 27 May 2014 12:01:13 -0400 [thread overview]
Message-ID: <20140527160113.GG11265@laptop.bfoster> (raw)
In-Reply-To: <1400803432-20048-16-git-send-email-david@fromorbit.com>
On Fri, May 23, 2014 at 10:03:51AM +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> As it's only ever called from contexts where the xfs_da_args is
> present and contains all the information needed inside the args
> structure.
>
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> ---
Reviewed-by: Brian Foster <bfoster@redhat.com>
> fs/xfs/xfs_attr.c | 4 +---
> fs/xfs/xfs_attr_leaf.c | 47 +++++++++++++++++------------------------------
> fs/xfs/xfs_attr_leaf.h | 3 +--
> 3 files changed, 19 insertions(+), 35 deletions(-)
>
> diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c
> index ccfc2c9..3d8c03e 100644
> --- a/fs/xfs/xfs_attr.c
> +++ b/fs/xfs/xfs_attr.c
> @@ -174,9 +174,7 @@ xfs_attr_calc_size(
> * Determine space new attribute will use, and if it would be
> * "local" or "remote" (note: local != inline).
> */
> - size = xfs_attr_leaf_newentsize(args->namelen, args->valuelen,
> - args->geo->blksize, local);
> -
> + size = xfs_attr_leaf_newentsize(args, local);
> nblks = XFS_DAENTER_SPACE_RES(mp, XFS_ATTR_FORK);
> if (*local) {
> if (size > (args->geo->blksize / 2)) {
> diff --git a/fs/xfs/xfs_attr_leaf.c b/fs/xfs/xfs_attr_leaf.c
> index 88cd84a..7761103 100644
> --- a/fs/xfs/xfs_attr_leaf.c
> +++ b/fs/xfs/xfs_attr_leaf.c
> @@ -1076,8 +1076,7 @@ xfs_attr3_leaf_add(
> leaf = bp->b_addr;
> xfs_attr3_leaf_hdr_from_disk(&ichdr, leaf);
> ASSERT(args->index >= 0 && args->index <= ichdr.count);
> - entsize = xfs_attr_leaf_newentsize(args->namelen, args->valuelen,
> - args->geo->blksize, NULL);
> + entsize = xfs_attr_leaf_newentsize(args, NULL);
>
> /*
> * Search through freemap for first-fit on new name length.
> @@ -1179,14 +1178,11 @@ xfs_attr3_leaf_add_work(
> ASSERT(ichdr->freemap[mapindex].base < XFS_LBSIZE(mp));
> ASSERT((ichdr->freemap[mapindex].base & 0x3) == 0);
> ASSERT(ichdr->freemap[mapindex].size >=
> - xfs_attr_leaf_newentsize(args->namelen, args->valuelen,
> - args->geo->blksize, NULL));
> + xfs_attr_leaf_newentsize(args, NULL));
> ASSERT(ichdr->freemap[mapindex].size < XFS_LBSIZE(mp));
> ASSERT((ichdr->freemap[mapindex].size & 0x3) == 0);
>
> - ichdr->freemap[mapindex].size -=
> - xfs_attr_leaf_newentsize(args->namelen, args->valuelen,
> - args->geo->blksize, &tmp);
> + ichdr->freemap[mapindex].size -= xfs_attr_leaf_newentsize(args, &tmp);
>
> entry->nameidx = cpu_to_be16(ichdr->freemap[mapindex].base +
> ichdr->freemap[mapindex].size);
> @@ -1594,9 +1590,7 @@ xfs_attr3_leaf_figure_balance(
> max = ichdr1->count + ichdr2->count;
> half = (max + 1) * sizeof(*entry);
> half += ichdr1->usedbytes + ichdr2->usedbytes +
> - xfs_attr_leaf_newentsize(state->args->namelen,
> - state->args->valuelen,
> - state->blocksize, NULL);
> + xfs_attr_leaf_newentsize(state->args, NULL);
> half /= 2;
> lastdelta = state->blocksize;
> entry = xfs_attr3_leaf_entryp(leaf1);
> @@ -1608,10 +1602,7 @@ xfs_attr3_leaf_figure_balance(
> */
> if (count == blk1->index) {
> tmp = totallen + sizeof(*entry) +
> - xfs_attr_leaf_newentsize(
> - state->args->namelen,
> - state->args->valuelen,
> - state->blocksize, NULL);
> + xfs_attr_leaf_newentsize(state->args, NULL);
> if (XFS_ATTR_ABS(half - tmp) > lastdelta)
> break;
> lastdelta = XFS_ATTR_ABS(half - tmp);
> @@ -1647,10 +1638,7 @@ xfs_attr3_leaf_figure_balance(
> totallen -= count * sizeof(*entry);
> if (foundit) {
> totallen -= sizeof(*entry) +
> - xfs_attr_leaf_newentsize(
> - state->args->namelen,
> - state->args->valuelen,
> - state->blocksize, NULL);
> + xfs_attr_leaf_newentsize(state->args, NULL);
> }
>
> *countarg = count;
> @@ -2441,22 +2429,21 @@ xfs_attr_leaf_entsize(xfs_attr_leafblock_t *leaf, int index)
> * a "local" or a "remote" attribute.
> */
> int
> -xfs_attr_leaf_newentsize(int namelen, int valuelen, int blocksize, int *local)
> +xfs_attr_leaf_newentsize(
> + struct xfs_da_args *args,
> + int *local)
> {
> - int size;
> + int size;
>
> - size = xfs_attr_leaf_entsize_local(namelen, valuelen);
> - if (size < xfs_attr_leaf_entsize_local_max(blocksize)) {
> - if (local) {
> + size = xfs_attr_leaf_entsize_local(args->namelen, args->valuelen);
> + if (size < xfs_attr_leaf_entsize_local_max(args->geo->blksize)) {
> + if (local)
> *local = 1;
> - }
> - } else {
> - size = xfs_attr_leaf_entsize_remote(namelen);
> - if (local) {
> - *local = 0;
> - }
> + return size;
> }
> - return size;
> + if (local)
> + *local = 0;
> + return xfs_attr_leaf_entsize_remote(args->namelen);
> }
>
>
> diff --git a/fs/xfs/xfs_attr_leaf.h b/fs/xfs/xfs_attr_leaf.h
> index 3ec5ec0..e2929da 100644
> --- a/fs/xfs/xfs_attr_leaf.h
> +++ b/fs/xfs/xfs_attr_leaf.h
> @@ -96,8 +96,7 @@ int xfs_attr3_root_inactive(struct xfs_trans **trans, struct xfs_inode *dp);
> xfs_dahash_t xfs_attr_leaf_lasthash(struct xfs_buf *bp, int *count);
> int xfs_attr_leaf_order(struct xfs_buf *leaf1_bp,
> struct xfs_buf *leaf2_bp);
> -int xfs_attr_leaf_newentsize(int namelen, int valuelen, int blocksize,
> - int *local);
> +int xfs_attr_leaf_newentsize(struct xfs_da_args *args, int *local);
> int xfs_attr3_leaf_read(struct xfs_trans *tp, struct xfs_inode *dp,
> xfs_dablk_t bno, xfs_daddr_t mappedbno,
> struct xfs_buf **bpp);
> --
> 1.9.0
>
> _______________________________________________
> 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:[~2014-05-27 16:01 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-23 0:03 [PATCH 00/16 V2] xfs: introduce struct xfs_da_geometry Dave Chinner
2014-05-23 0:03 ` [PATCH 01/16] xfs: introduce directory geometry structure Dave Chinner
2014-05-23 19:04 ` Brian Foster
2014-05-26 4:28 ` Dave Chinner
2014-05-26 13:29 ` Brian Foster
2014-05-26 21:39 ` Dave Chinner
2014-05-23 0:03 ` [PATCH 02/16] xfs: move directory block translatiosn to xfs_da_btree.h Dave Chinner
2014-05-23 19:05 ` Brian Foster
2014-05-27 10:46 ` Christoph Hellwig
2014-05-27 23:06 ` Dave Chinner
2014-05-28 5:28 ` Christoph Hellwig
2014-05-28 5:39 ` Dave Chinner
2014-05-23 0:03 ` [PATCH 03/16] xfs: kill XFS_DIR2...FIRSTDB macros Dave Chinner
2014-05-23 19:05 ` Brian Foster
2014-05-27 10:47 ` Christoph Hellwig
2014-05-23 0:03 ` [PATCH 04/16] xfs: convert dir byte/off conversion to xfs_da_geometry Dave Chinner
2014-05-23 19:05 ` Brian Foster
2014-05-23 0:03 ` [PATCH 05/16] xfs: convert directory dablk " Dave Chinner
2014-05-23 19:06 ` Brian Foster
2014-05-26 4:48 ` Dave Chinner
2014-05-23 0:03 ` [PATCH 06/16] xfs: convert directory db " Dave Chinner
2014-05-23 19:07 ` Brian Foster
2014-05-23 0:03 ` [PATCH 07/16] xfs: convert directory segment limits " Dave Chinner
2014-05-23 20:43 ` Brian Foster
2014-05-23 0:03 ` [PATCH 08/16] xfs: convert m_dirblkfsbs " Dave Chinner
2014-05-23 20:43 ` Brian Foster
2014-05-23 0:03 ` [PATCH 09/16] xfs: convert m_dirblksize " Dave Chinner
2014-05-27 15:59 ` Brian Foster
2014-05-23 0:03 ` [PATCH 10/16] xfs: convert dir/attr btree threshold " Dave Chinner
2014-05-27 15:59 ` Brian Foster
2014-05-23 0:03 ` [PATCH 11/16] xfs: move node entry counts " Dave Chinner
2014-05-27 15:59 ` Brian Foster
2014-05-27 23:47 ` Dave Chinner
2014-05-23 0:03 ` [PATCH 12/16] xfs: reduce direct usage of mp->m_dir_geo Dave Chinner
2014-05-27 15:59 ` Brian Foster
2014-05-27 23:53 ` Dave Chinner
2014-05-23 0:03 ` [PATCH 13/16] xfs: remove mp->m_dir_geo from directory logging Dave Chinner
2014-05-27 16:00 ` Brian Foster
2014-05-23 0:03 ` [PATCH 14/16] xfs: use xfs_da_geometry for block size in attr code Dave Chinner
2014-05-27 16:01 ` Brian Foster
2014-05-23 0:03 ` [PATCH 15/16] xfs: pass xfs_da_args to xfs_attr_leaf_newentsize Dave Chinner
2014-05-27 16:01 ` Brian Foster [this message]
2014-05-23 0:03 ` [PATCH 16/16] xfs: repalce attr LBSIZE with xfs_da_geometry Dave Chinner
2014-05-27 16:01 ` Brian Foster
-- strict thread matches above, loose matches on Subject: below --
2014-05-28 6:04 [PATCH 00/16 V3] xfs: introduce struct xfs_da_geometry Dave Chinner
2014-05-28 6:04 ` [PATCH 15/16] xfs: pass xfs_da_args to xfs_attr_leaf_newentsize 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=20140527160113.GG11265@laptop.bfoster \
--to=bfoster@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox