FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Cluster Development

 
 
LinkBack Thread Tools
 
Old 05-10-2012, 12:31 PM
Bob Peterson
 
Default GFS2: simplify function gfs2_extent_length

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.

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);
 

Thread Tools




All times are GMT. The time now is 11:07 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org