From: Steven Whitehouse <swhiteho@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [GFS2 Patch] GFS2: simplify function gfs2_extent_length
Date: Fri, 11 May 2012 10:41:09 +0100 [thread overview]
Message-ID: <1336729269.2740.3.camel@menhir> (raw)
In-Reply-To: <c6cc5d10-dd73-41b2-8b19-274090fe58f5@zmail12.collab.prod.int.phx2.redhat.com>
Hi,
On Thu, 2012-05-10 at 08:31 -0400, Bob Peterson wrote:
> Hi,
>
> See description below. :)
>
> Regards,
>
> Bob Peterson
> Red Hat File Systems
>
> Signed-off-by: Bob Peterson <rpeterso@redhat.com>
> ---
> Author: Bob Peterson <rpeterso@redhat.com>
> Date: Wed May 9 14:27:00 2012 -0500
>
> GFS2: simplify function gfs2_extent_length
>
> This patch simplifies function gfs2_extent_length by passing a single
> parameter to the function rather than two.
>
Hmm. I'm not sure this really buys us anything. The function is inline
anyway and it means that it will then be tied to only using buffer heads
whereas before it could potentially have been used for any situation,
Steve.
> diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
> index 420bbeb..31c5e81 100644
> --- a/fs/gfs2/bmap.c
> +++ b/fs/gfs2/bmap.c
> @@ -345,8 +345,7 @@ static inline void release_metapath(struct metapath *mp)
>
> /**
> * gfs2_extent_length - Returns length of an extent of blocks
> - * @start: Start of the buffer
> - * @len: Length of the buffer in bytes
> + * @bh: The buffer header
> * @ptr: Current position in the buffer
> * @limit: Max extent length to return (0 = unlimited)
> * @eob: Set to 1 if we hit "end of block"
> @@ -358,9 +357,11 @@ static inline void release_metapath(struct metapath *mp)
> * Returns: The length of the extent (minimum of one block)
> */
>
> -static inline unsigned int gfs2_extent_length(void *start, unsigned int len, __be64 *ptr, unsigned limit, int *eob)
> +static inline unsigned int gfs2_extent_length(struct buffer_head *bh,
> + __be64 *ptr, unsigned limit,
> + int *eob)
> {
> - const __be64 *end = (start + len);
> + const __be64 *end = (const __be64 *)(bh->b_data + bh->b_size);
> const __be64 *first = ptr;
> u64 d = be64_to_cpu(*ptr);
>
> @@ -475,8 +476,7 @@ static int gfs2_bmap_alloc(struct inode *inode, const sector_t lblock,
> /* Bottom indirect block exists, find unalloced extent size */
> ptr = metapointer(end_of_metadata, mp);
> bh = mp->mp_bh[end_of_metadata];
> - dblks = gfs2_extent_length(bh->b_data, bh->b_size, ptr, maxlen,
> - &eob);
> + dblks = gfs2_extent_length(bh, ptr, maxlen, &eob);
> BUG_ON(dblks < 1);
> state = ALLOC_DATA;
> } else {
> @@ -650,7 +650,7 @@ int gfs2_block_map(struct inode *inode, sector_t lblock,
> goto do_alloc;
> map_bh(bh_map, inode->i_sb, be64_to_cpu(*ptr));
> bh = mp.mp_bh[ip->i_height - 1];
> - len = gfs2_extent_length(bh->b_data, bh->b_size, ptr, maxlen, &eob);
> + len = gfs2_extent_length(bh, ptr, maxlen, &eob);
> bh_map->b_size = (len << inode->i_blkbits);
> if (eob)
> set_buffer_boundary(bh_map);
>
prev parent reply other threads:[~2012-05-11 9:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <16ff6117-2840-4e01-86b8-b4e256e30fa0@zmail12.collab.prod.int.phx2.redhat.com>
2012-05-10 12:31 ` [Cluster-devel] [GFS2 Patch] GFS2: simplify function gfs2_extent_length Bob Peterson
2012-05-11 9:41 ` Steven Whitehouse [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=1336729269.2740.3.camel@menhir \
--to=swhiteho@redhat.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;
as well as URLs for NNTP newsgroup(s).