From: Dave Chinner <david@fromorbit.com>
To: xfs@oss.sgi.com
Subject: [PATCH 15/18] xfs: use xfs_da_geometry for block size in attr code
Date: Thu, 8 May 2014 18:19:45 +1000 [thread overview]
Message-ID: <1399537188-26509-16-git-send-email-david@fromorbit.com> (raw)
In-Reply-To: <1399537188-26509-1-git-send-email-david@fromorbit.com>
From: Dave Chinner <dchinner@redhat.com>
Rather than using the superblock value obtained through the
xfs_mount.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
fs/xfs/xfs_attr.c | 24 +++++++++++-------------
fs/xfs/xfs_attr_leaf.c | 6 +++---
fs/xfs/xfs_log_rlimit.c | 2 +-
3 files changed, 15 insertions(+), 17 deletions(-)
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c
index 28b6bb3..ab2679a 100644
--- a/fs/xfs/xfs_attr.c
+++ b/fs/xfs/xfs_attr.c
@@ -187,12 +187,10 @@ xfs_attr_get(
*/
STATIC int
xfs_attr_calc_size(
- struct xfs_inode *ip,
- int namelen,
- int valuelen,
+ struct xfs_da_args *args,
int *local)
{
- struct xfs_mount *mp = ip->i_mount;
+ struct xfs_mount *mp = args->dp->i_mount;
int size;
int nblks;
@@ -200,12 +198,12 @@ 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(namelen, valuelen,
- mp->m_sb.sb_blocksize, local);
+ size = xfs_attr_leaf_newentsize(args->namelen, args->valuelen,
+ args->geo->blksize, local);
nblks = XFS_DAENTER_SPACE_RES(mp, XFS_ATTR_FORK);
if (*local) {
- if (size > (mp->m_sb.sb_blocksize >> 1)) {
+ if (size > (args->geo->blksize / 2)) {
/* Double split possible */
nblks *= 2;
}
@@ -214,7 +212,7 @@ xfs_attr_calc_size(
* Out of line attribute, cannot double split, but
* make room for the attribute value itself.
*/
- uint dblocks = xfs_attr3_rmt_blocks(mp, valuelen);
+ uint dblocks = xfs_attr3_rmt_blocks(mp, args->valuelen);
nblks += dblocks;
nblks += XFS_NEXTENTADD_SPACE_RES(mp, dblocks, XFS_ATTR_FORK);
}
@@ -276,7 +274,7 @@ xfs_attr_set_int(
args.op_flags = XFS_DA_OP_ADDNAME | XFS_DA_OP_OKNOENT;
/* Size is now blocks for attribute data */
- args.total = xfs_attr_calc_size(dp, name->len, valuelen, &local);
+ args.total = xfs_attr_calc_size(&args, &local);
/*
* Start our first transaction of the day.
@@ -994,7 +992,7 @@ restart:
state = xfs_da_state_alloc();
state->args = args;
state->mp = mp;
- state->blocksize = state->mp->m_sb.sb_blocksize;
+ state->blocksize = args->geo->blksize;
state->node_ents = args->geo->node_ents;
/*
@@ -1173,7 +1171,7 @@ restart:
state = xfs_da_state_alloc();
state->args = args;
state->mp = mp;
- state->blocksize = state->mp->m_sb.sb_blocksize;
+ state->blocksize = args->geo->blksize;
state->node_ents = args->geo->node_ents;
state->inleaf = 0;
error = xfs_da3_node_lookup_int(state, &retval);
@@ -1265,7 +1263,7 @@ xfs_attr_node_removename(xfs_da_args_t *args)
state = xfs_da_state_alloc();
state->args = args;
state->mp = dp->i_mount;
- state->blocksize = state->mp->m_sb.sb_blocksize;
+ state->blocksize = args->geo->blksize;
state->node_ents = args->geo->node_ents;
/*
@@ -1528,7 +1526,7 @@ xfs_attr_node_get(xfs_da_args_t *args)
state = xfs_da_state_alloc();
state->args = args;
state->mp = args->dp->i_mount;
- state->blocksize = state->mp->m_sb.sb_blocksize;
+ state->blocksize = args->geo->blksize;
state->node_ents = args->geo->node_ents;
/*
diff --git a/fs/xfs/xfs_attr_leaf.c b/fs/xfs/xfs_attr_leaf.c
index d1e800d..ab652e9 100644
--- a/fs/xfs/xfs_attr_leaf.c
+++ b/fs/xfs/xfs_attr_leaf.c
@@ -1076,7 +1076,7 @@ xfs_attr3_leaf_add(
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->trans->t_mountp->m_sb.sb_blocksize, NULL);
+ args->geo->blksize, NULL);
/*
* Search through freemap for first-fit on new name length.
@@ -1179,13 +1179,13 @@ xfs_attr3_leaf_add_work(
ASSERT((ichdr->freemap[mapindex].base & 0x3) == 0);
ASSERT(ichdr->freemap[mapindex].size >=
xfs_attr_leaf_newentsize(args->namelen, args->valuelen,
- mp->m_sb.sb_blocksize, NULL));
+ args->geo->blksize, 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,
- mp->m_sb.sb_blocksize, &tmp);
+ args->geo->blksize, &tmp);
entry->nameidx = cpu_to_be16(ichdr->freemap[mapindex].base +
ichdr->freemap[mapindex].size);
diff --git a/fs/xfs/xfs_log_rlimit.c b/fs/xfs/xfs_log_rlimit.c
index 2af1a0a..ee7e0e8 100644
--- a/fs/xfs/xfs_log_rlimit.c
+++ b/fs/xfs/xfs_log_rlimit.c
@@ -42,7 +42,7 @@ xfs_log_calc_max_attrsetm_res(
int size;
int nblks;
- size = xfs_attr_leaf_entsize_local_max(mp->m_sb.sb_blocksize) -
+ size = xfs_attr_leaf_entsize_local_max(mp->m_attr_geo->blksize) -
MAXNAMELEN - 1;
nblks = XFS_DAENTER_SPACE_RES(mp, XFS_ATTR_FORK);
nblks += XFS_B_TO_FSB(mp, size);
--
1.9.0
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2014-05-08 8:20 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-08 8:19 [RFC PATCH 00/18] xfs: directory/attribute geometry abstraction Dave Chinner
2014-05-08 8:19 ` [PATCH 01/18] xfs: remove redundant checks from xfs_da_read_buf Dave Chinner
2014-05-08 8:19 ` [PATCH 02/18] xfs: introduce directory geometry structure Dave Chinner
2014-05-08 8:19 ` [PATCH 03/18] xfs: move directory block translatiosn to xfs_da_btree.h Dave Chinner
2014-05-08 8:19 ` [PATCH 04/18] xfs: kill XFS_DIR2...FIRSTDB macros Dave Chinner
2014-05-08 8:19 ` [PATCH 05/18] xfs: convert dir byte/off conversion to xfs_da_geometry Dave Chinner
2014-05-08 8:19 ` [PATCH 06/18] xfs: convert directory dablk " Dave Chinner
2014-05-08 8:19 ` [PATCH 07/18] xfs: convert directory db " Dave Chinner
2014-05-08 8:19 ` [PATCH 08/18] xfs: convert directory segment limits " Dave Chinner
2014-05-08 8:19 ` [PATCH 09/18] xfs: convert m_dirblkfsbs " Dave Chinner
2014-05-08 8:19 ` [PATCH 10/18] xfs: convert m_dirblksize " Dave Chinner
2014-05-08 8:19 ` [PATCH 11/18] xfs: convert dir/attr btree threshold " Dave Chinner
2014-05-08 8:19 ` [PATCH 12/18] xfs: reduce direct usage of mp->m_dir_geo Dave Chinner
2014-05-08 8:19 ` [PATCH 13/18] xfs: remove mp->m_dir_geo from directory logging Dave Chinner
2014-05-08 8:19 ` [PATCH 14/18] xfs: move node entry counts to xfs_da_geometry Dave Chinner
2014-05-08 8:19 ` Dave Chinner [this message]
2014-05-08 8:19 ` [PATCH 16/18] xfs: pass xfs_da_args to xfs_attr_leaf_newentsize Dave Chinner
2014-05-08 8:19 ` [PATCH 17/18] xfs: repalce attr LBSIZE with xfs_da_geometry Dave Chinner
2014-05-08 8:19 ` [PATCH 18/18] xfs: add xfs_da_geometry to inode forks Dave Chinner
2014-05-09 7:31 ` Christoph Hellwig
2014-05-20 22:33 ` 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=1399537188-26509-16-git-send-email-david@fromorbit.com \
--to=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