[Ocfs2-commits] jlbec commits r1210 - trunk/src
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Thu Jun 24 19:22:46 CDT 2004
Author: jlbec
Date: 2004-06-24 18:22:45 -0500 (Thu, 24 Jun 2004)
New Revision: 1210
Modified:
trunk/src/alloc.c
trunk/src/alloc.h
trunk/src/dlm.c
trunk/src/file.c
trunk/src/heartbeat.c
trunk/src/journal.c
trunk/src/nm.c
trunk/src/ocfs.h
trunk/src/ocfs_journal.h
trunk/src/super.c
trunk/src/volcfg.c
Log:
o Clean a lot of stack by removing a lot of:
__u64 offset = blkno << osb->sb->s_blocksize_bits
temporaries.
o Fix an off-by-one in calc_symlink_credits.
Modified: trunk/src/alloc.c
===================================================================
--- trunk/src/alloc.c 2004-06-24 18:12:35 UTC (rev 1209)
+++ trunk/src/alloc.c 2004-06-24 23:22:45 UTC (rev 1210)
@@ -112,7 +112,7 @@
static __u32 ocfs_alloc_count_bits(ocfs2_dinode *alloc);
static void ocfs_clear_local_alloc(ocfs2_dinode *alloc);
static int ocfs_find_space_from_local(ocfs_super *osb, __u32 bitswanted,
- __u64 * bitoff, __u64 * bitcount,
+ u32 *bitoff, u32 *bitcount,
ocfs_journal_handle *handle);
static int ocfs_local_find_clear_bits(ocfs_super *osb,
ocfs2_dinode *alloc,
@@ -1634,7 +1634,6 @@
int status = -EFAIL;
int i;
__u32 victim;
- __u64 tmp_off;
u32 num_clusters = 0;
__u32 bitmap_offset = 0;
ocfs2_extent_rec *ext;
@@ -1687,34 +1686,33 @@
/* We're gonna read in our last used extent
* and put him at the top of the stack. We
- * also update our h_next_free_rec so that next
+ * also update our l_next_free_rec so that next
* time we read in the next to last one and so
* on until we've finished all of them
*/
- /* grow the stack, gotta save off a couple
- * things 1st. */
victim = cur_el->l_next_free_rec - 1;
- tmp_off = cur_el->l_recs[victim].e_blkno;
- tmp_off <<= osb->sb->s_blocksize_bits;
- cur_el->l_next_free_rec--;
- cur_eb = NULL;
- cur_el = NULL;
- tos++;
-
/* should already be null, but we can do this
* just in case. */
stack[tos] = kmalloc(osb->sb->s_blocksize,
GFP_KERNEL);
- status = ocfs_read_bh(osb, tmp_off, &tmp_bh,
- OCFS_BH_COND_CACHED, inode);
+ status = ocfs_read_bh(osb,
+ cur_el->l_recs[victim].e_blkno << osb->sb->s_blocksize_bits,
+ &tmp_bh,
+ OCFS_BH_COND_CACHED,
+ inode);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto bail;
}
+ cur_el->l_next_free_rec--;
+ cur_eb = NULL;
+ cur_el = NULL;
+ tos++;
+
memcpy(stack[tos], tmp_bh->b_data,
osb->sb->s_blocksize);
brelse(tmp_bh);
@@ -1816,7 +1814,7 @@
struct buffer_head *tmp_bh = NULL, *tmp_bh2 = NULL;
int tos = 0;
int i, victim;
- __u64 bytes, doff, orig_bytes, tmp_off;
+ __u64 bytes, doff, orig_bytes;
__u64 total_bytes; /* FIXME needs to be clusters!!! */
__u32 num_clusters, bitmap_offset;
int done = 0;
@@ -2270,7 +2268,6 @@
el->l_next_free_rec--;
victim = el->l_next_free_rec;
rec = &el->l_recs[victim];
- tmp_off = rec->e_blkno << osb->sb->s_blocksize_bits;
alloc_eb = NULL;
el = NULL;
@@ -2288,7 +2285,8 @@
LOG_ERROR_STR("uhoh, not brelsing a buffer " \
"on our stack!\n");
- status = ocfs_read_bh(osb, tmp_off,
+ status = ocfs_read_bh(osb,
+ rec->e_blkno << osb->sb->s_blocksize_bits,
&bh_stack[tos],
OCFS_BH_COND_CACHED,
inode);
@@ -2777,12 +2775,12 @@
struct inode *inode)
{
int status = 0, tempstat;
- __u32 i, j;
+ int i, j;
struct buffer_head *ext_bh = NULL;
ocfs2_extent_block *eb = NULL;
ocfs2_extent_list *el, *fel;
ocfs2_extent_block *tmp = NULL;
- __u64 childDiskOffset = 0;
+ u64 child_blkno = 0;
LOG_ENTRY ();
@@ -2790,19 +2788,21 @@
for (i = 0; i < fel->l_next_free_rec; i++) {
if ((__s64)((u64)(fel->l_recs[i].e_cpos + fel->l_recs[i].e_clusters) << osb->s_clustersize_bits) > Vbo) {
- childDiskOffset = fel->l_recs[i].e_blkno << osb->sb->s_blocksize_bits;
+ child_blkno = fel->l_recs[i].e_blkno;
break;
}
}
- if (childDiskOffset == 0) {
- LOG_ERROR_STATUS (status = -EINVAL);
+ if (i >= fel->l_next_free_rec) {
+ LOG_ERROR_STATUS(status = -EINVAL);
goto finally;
}
for (i = 0; i < fel->l_tree_depth; i++) {
- tempstat = ocfs_read_bh(osb, childDiskOffset, &ext_bh,
- OCFS_BH_COND_CACHED, inode);
+ tempstat = ocfs_read_bh(osb,
+ child_blkno << osb->sb->s_blocksize_bits,
+ &ext_bh, OCFS_BH_COND_CACHED,
+ inode);
if (tempstat < 0) {
LOG_ERROR_STATUS (status = tempstat);
goto finally;
@@ -2818,8 +2818,7 @@
for (j = 0; j < el->l_next_free_rec; j++) {
if ((__s64)((u64)(el->l_recs[j].e_cpos + el->l_recs[j].e_clusters) << osb->s_clustersize_bits) > Vbo)
{
- childDiskOffset =
- el->l_recs[j].e_blkno << osb->sb->s_blocksize_bits;
+ child_blkno = el->l_recs[j].e_blkno;
break;
}
}
@@ -2835,7 +2834,10 @@
*data_extent_bh = NULL;
}
- tempstat = ocfs_read_bh(osb, childDiskOffset, data_extent_bh, OCFS_BH_COND_CACHED, inode);
+ tempstat = ocfs_read_bh(osb,
+ child_blkno << osb->sb->s_blocksize_bits,
+ data_extent_bh, OCFS_BH_COND_CACHED,
+ inode);
if (tempstat < 0) {
LOG_ERROR_STATUS (status = tempstat);
goto finally;
@@ -2874,17 +2876,17 @@
* Pass in 'lock_bh' and bitmap_inode only if you've already taken the
* vol_alloc semaphore, and you've done the acquire_lock on the bitmap.
*/
-int ocfs_find_contiguous_space_from_bitmap(ocfs_super *osb,
+static int ocfs_find_contiguous_space_from_bitmap(ocfs_super *osb,
ocfs_journal_handle *handle,
__u64 file_size,
- __u64 *cluster_off,
- __u64 *cluster_count,
+ u32 *cluster_off,
+ u32 *cluster_count,
int sysfile,
struct buffer_head *lock_bh,
struct inode *bitmap_inode)
{
int status = 0, startbh, numblocks;
- __u32 bitoffset = 0, ClusterCount = 0;
+ u32 bitoffset = 0, ClusterCount = 0;
__u64 ByteCount = 0;
__u32 LargeAlloc = 0;
static __u32 LargeAllocOffset = 0;
@@ -2940,7 +2942,7 @@
bm_lock = (ocfs2_dinode *) bh->b_data;
- ClusterCount = (__u32) ((__u64) (file_size + (osb->s_clustersize-1)) >>
+ ClusterCount = (u32) ((u64) (file_size + (osb->s_clustersize-1)) >>
osb->s_clustersize_bits);
if (ClusterCount == 0) {
LOG_ERROR_STR ("DISK_FULL?: ClusterCount==0");
@@ -3649,7 +3651,8 @@
ocfs_journal_handle *handle)
{
int status = 0;
- __u64 alloc_bytes, cluster_off, cluster_count;
+ __u64 alloc_bytes;
+ u32 cluster_off, cluster_count;
ocfs2_dinode *alloc = NULL;
LOG_ENTRY();
@@ -3757,8 +3760,8 @@
/*
* ocfs_find_space_from_local
*/
-static int ocfs_find_space_from_local(ocfs_super *osb, __u32 bitswanted,
- __u64 * bitoff, __u64 * bitcount,
+static int ocfs_find_space_from_local(ocfs_super *osb, u32 bitswanted,
+ u32 *bitoff, u32 *bitcount,
ocfs_journal_handle *handle)
{
ocfs2_dinode *alloc;
@@ -3920,10 +3923,12 @@
* we'll try to use our local alloc instead.
*
*/
-int ocfs_find_space(ocfs_super * osb, __u64 file_size, __u64 * cluster_off, __u64 * cluster_count, int sysfile, ocfs_journal_handle *handle)
+int ocfs_find_space(ocfs_super *osb, __u64 file_size,
+ u32 *cluster_off, u32 *cluster_count, int sysfile,
+ ocfs_journal_handle *handle)
{
int status = 0;
- __u32 bitswanted;
+ u32 bitswanted;
int use_global = 1;
struct inode *local_alloc_inode = NULL;
@@ -3994,8 +3999,8 @@
if (status < 0)
LOG_ERROR_STATUS(status);
- LOG_TRACE_ARGS("Returning *cluster_off = %llu, *cluster_count"
- "= %llu\n", *cluster_off, *cluster_count);
+ LOG_TRACE_ARGS("Returning *cluster_off = %u, *cluster_count"
+ "= %u\n", *cluster_off, *cluster_count);
bail:
if (local_alloc_inode)
iput(local_alloc_inode);
Modified: trunk/src/alloc.h
===================================================================
--- trunk/src/alloc.h 2004-06-24 18:12:35 UTC (rev 1209)
+++ trunk/src/alloc.h 2004-06-24 23:22:45 UTC (rev 1210)
@@ -41,17 +41,9 @@
__u64 *DiskOffset, __u64 *file_off,
__u32 NodeNum, __u32 Type,
ocfs_journal_handle *handle);
-int ocfs_find_contiguous_space_from_bitmap(ocfs_super *osb,
- ocfs_journal_handle *handle,
- __u64 file_size,
- __u64 *cluster_off,
- __u64 *cluster_count,
- int sysfile,
- struct buffer_head *lock_bh,
- struct inode *bitmap_inode);
int ocfs_find_space(ocfs_super *osb, __u64 file_size,
- __u64 *cluster_off, __u64 *cluster_count,
- int sysfile, ocfs_journal_handle *handle);
+ u32 *cluster_off, u32 *cluster_count, int sysfile,
+ ocfs_journal_handle *handle);
int ocfs_free_extents_for_truncate(ocfs_super *osb,
ocfs2_dinode *fe,
ocfs_journal_handle *handle,
Modified: trunk/src/dlm.c
===================================================================
--- trunk/src/dlm.c 2004-06-24 18:12:35 UTC (rev 1209)
+++ trunk/src/dlm.c 2004-06-24 23:22:45 UTC (rev 1210)
@@ -98,13 +98,16 @@
/* inode is definitely non NULL */
-static int ocfs_disk_request_vote (ocfs_super * osb, __u64 lock_id, __u32 lock_type, __u32 flags, ocfs_node_map * vote_map, __u64 * lock_seq_num, __u32 time_to_wait, struct inode *inode, ocfs_node_map *open_map)
+static int ocfs_disk_request_vote(ocfs_super *osb, __u64 lock_id,
+ __u32 lock_type, __u32 flags,
+ ocfs_node_map *vote_map,
+ __u64 *lock_seq_num,
+ __u32 time_to_wait,
+ struct inode *inode,
+ ocfs_node_map *open_map)
{
int status = 0;
- __u64 offset = 0;
__u64 pub_off;
- __u32 size = 0;
- __u32 numnodes = 0;
__u32 i;
ocfs_publish *pubsect = NULL;
__u64 largestseqno = 0;
@@ -117,27 +120,27 @@
ocfs_node_map_clear_bit(vote_map, osb->node_num);
- offset = osb->publish_blkno << osb->sb->s_blocksize_bits;
- numnodes = osb->max_nodes;
- size = (numnodes << osb->sb->s_blocksize_bits);
-
- /* take lock to prevent overwrites by vote_reset and nm thread */
+ /* prevent overwrites by vote_reset and nm thread */
down_with_flag (&(osb->publish_lock), publish_flag);
/* Read the Publish Sector of all nodes */
- bhs = ocfs_malloc(numnodes * sizeof(struct buffer_head *));
+ bhs = ocfs_malloc(osb->max_nodes *
+ sizeof(struct buffer_head *));
if (bhs == NULL) {
LOG_ERROR_STATUS (status = -ENOMEM);
goto finally;
}
- memset(bhs, 0, numnodes * sizeof(struct buffer_head *));
- status = ocfs_read_bhs (osb, offset, size, bhs, 0, NULL);
+ memset(bhs, 0, osb->max_nodes * sizeof(struct buffer_head *));
+ status = ocfs_read_bhs(osb,
+ osb->publish_blkno << osb->sb->s_blocksize_bits,
+ osb->max_nodes << osb->sb->s_blocksize_bits,
+ bhs, 0, NULL);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finally;
}
- for (i = 0; i < numnodes; i++) {
+ for (i = 0; i < osb->max_nodes; i++) {
pubsect = (ocfs_publish *) bhs[i]->b_data;
if (pubsect->time == (__u64) 0 || pubsect->publ_seq_num <= largestseqno) {
continue;
@@ -197,7 +200,7 @@
up_with_flag (&(osb->publish_lock), publish_flag);
if (bhs != NULL) {
- for (i = 0; i < numnodes; i++)
+ for (i = 0; i < osb->max_nodes; i++)
brelse(bhs[i]);
kfree(bhs);
}
@@ -511,7 +514,6 @@
{
int status = 0;
ocfs_publish *pubsect = NULL;
- __u64 offset = 0;
struct buffer_head *bh = NULL;
ocfs_node_map vote_map;
@@ -521,9 +523,9 @@
down (&(osb->publish_lock));
/* Read node's publish sector */
- offset = (osb->publish_blkno + osb->node_num) << osb->sb->s_blocksize_bits;
-
- status = ocfs_read_bh (osb, offset, &bh, 0, NULL);
+ status = ocfs_read_bh(osb,
+ (osb->publish_blkno + osb->node_num) << osb->sb->s_blocksize_bits,
+ &bh, 0, NULL);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finally;
Modified: trunk/src/file.c
===================================================================
--- trunk/src/file.c 2004-06-24 18:12:35 UTC (rev 1209)
+++ trunk/src/file.c 2004-06-24 23:22:45 UTC (rev 1210)
@@ -1114,12 +1114,12 @@
__u64 tempOffset = 0;
__u64 current_alloc;
__u64 alloc_size;
- __u64 bitmapOffset = 0;
- __u64 numClustersAlloc = 0;
+ u32 bitmapOffset = 0;
+ u32 numClustersAlloc = 0;
__u32 lockFlags = 0;
__u32 locktype = OCFS_DLM_ENABLE_CACHE_LOCK;
int have_disk_lock = 0;
- __u64 actualDiskOffset = 0;
+ u64 block_off;
__u64 actualLength = 0;
struct buffer_head *bh = NULL;
ocfs_journal_handle *handle = NULL;
@@ -1237,7 +1237,7 @@
status = ocfs_find_space(osb, alloc_size, &bitmapOffset,
&numClustersAlloc, system_file, handle);
- LOG_TRACE_ARGS("find_space: alloc_size=%llu, returned off=%llu, num=%llu\n",
+ LOG_TRACE_ARGS("find_space: alloc_size=%llu, returned off=%u, num=%u\n",
alloc_size, bitmapOffset, numClustersAlloc);
if (status < 0) {
if (status != -ENOSPC && status != -EINTR)
@@ -1245,8 +1245,9 @@
goto leave;
}
- actualDiskOffset = bitmapOffset << osb->s_clustersize_bits;
- actualLength = numClustersAlloc << osb->s_clustersize_bits;
+ block_off = ocfs_clusters_to_blocks(osb->sb,
+ bitmapOffset);
+ actualLength = (u64)numClustersAlloc << osb->s_clustersize_bits;
fe = NULL;
@@ -1263,8 +1264,10 @@
}
memset(bhs, 0, numbhs * sizeof(struct buffer_head *));
- status = ocfs_read_bhs(osb, actualDiskOffset,
- actualLength, bhs, 0, NULL);
+ status = ocfs_read_bhs(osb,
+ block_off << osb->sb->s_blocksize_bits,
+ actualLength, bhs, 0,
+ NULL);
if (status < 0) {
kfree(bhs);
LOG_ERROR_STATUS(status);
@@ -1285,11 +1288,11 @@
}
} else {
struct buffer_head *alloc_bh;
- unsigned long block;
+ sector_t block;
struct super_block *sb = osb->sb;
- for (block = (unsigned long)(actualDiskOffset >> sb->s_blocksize_bits);
- block < (unsigned long)((actualDiskOffset+actualLength) >> sb->s_blocksize_bits);
+ for (block = block_off;
+ block < (block_off + (actualLength >> sb->s_blocksize_bits));
block++) {
alloc_bh = sb_getblk(sb, block);
if (!alloc_bh) {
@@ -1310,7 +1313,7 @@
ocfs_handle_add_inode(handle, ext_alloc_inode);
status = ocfs_allocate_extent(osb, bh, handle,
- actualDiskOffset >> osb->sb->s_blocksize_bits,
+ block_off,
actualLength >> osb->s_clustersize_bits,
inode);
if (status < 0) {
Modified: trunk/src/heartbeat.c
===================================================================
--- trunk/src/heartbeat.c 2004-06-24 18:12:35 UTC (rev 1209)
+++ trunk/src/heartbeat.c 2004-06-24 23:22:45 UTC (rev 1210)
@@ -66,7 +66,6 @@
ocfs_publish *publish = NULL;
int publish_idx = OCFS_VOLCFG_NEWCFG_SECTORS + osb->node_num;
struct buffer_head **pub_bh = &osb->autoconfig_bhs[publish_idx];
- __u64 node_publ_off = (osb->publish_blkno + osb->node_num) << osb->sb->s_blocksize_bits;
LOG_ENTRY_ARGS ("(0x%p, %u, %s)\n", osb, flag,
read_publish ? "true" : "false");
@@ -76,7 +75,9 @@
BUG();
if (read_publish) {
- status = ocfs_read_bh(osb, node_publ_off, pub_bh, 0, NULL);
+ status = ocfs_read_bh(osb,
+ (osb->publish_blkno + osb->node_num) << osb->sb->s_blocksize_bits,
+ pub_bh, 0, NULL);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finally;
Modified: trunk/src/journal.c
===================================================================
--- trunk/src/journal.c 2004-06-24 18:12:35 UTC (rev 1209)
+++ trunk/src/journal.c 2004-06-24 23:22:45 UTC (rev 1210)
@@ -1523,7 +1523,6 @@
int status = 0;
ocfs_publish *publish = NULL;
struct buffer_head *publish_bh = NULL;
- __u64 node_publ_off;
LOG_ENTRY_ARGS("(0x%p, %llu)\n", osb, node_num);
@@ -1531,8 +1530,9 @@
down (&(osb->publish_lock));
/* Read the publish sector */
- node_publ_off = (osb->publish_blkno + node_num) << osb->sb->s_blocksize_bits;
- status = ocfs_read_bh(osb, node_publ_off, &publish_bh,
+ status = ocfs_read_bh(osb,
+ (osb->publish_blkno + node_num) << osb->sb->s_blocksize_bits,
+ &publish_bh,
OCFS_BH_COND_CACHED, NULL);
if (status < 0) {
LOG_ERROR_STATUS (status);
Modified: trunk/src/nm.c
===================================================================
--- trunk/src/nm.c 2004-06-24 18:12:35 UTC (rev 1209)
+++ trunk/src/nm.c 2004-06-24 23:22:45 UTC (rev 1210)
@@ -262,7 +262,6 @@
__u32 i;
unsigned long j;
__u32 highest_vote_node;
- __u64 offset = 0, len = 0;
__u32 num_nodes = 0;
__u32 vote_node;
ocfs_node_config_hdr *node_cfg_hdr = NULL;
@@ -294,12 +293,11 @@
/* lock publish to prevent overwrites from vote_req and vote_reset */
down (&(osb->publish_lock));
- /* Get the Publish Sector start Offset */
- offset = osb->new_autoconfig_blkno << osb->sb->s_blocksize_bits;
- len = osb->total_autoconfig_blocks << osb->sb->s_blocksize_bits;
-
/* Read disk for 4 autoconfig blocks + all nodes publish blocks */
- status = ocfs_read_bhs(osb, offset, len, osb->autoconfig_bhs, 0, NULL);
+ status = ocfs_read_bhs(osb,
+ osb->new_autoconfig_blkno << osb->sb->s_blocksize_bits,
+ (u64)osb->total_autoconfig_blocks << osb->sb->s_blocksize_bits,
+ osb->autoconfig_bhs, 0, NULL);
if (status < 0) {
up (&(osb->publish_lock));
LOG_ERROR_STATUS (status);
@@ -697,7 +695,6 @@
int tmpstat = 0;
ocfs_lock_res *lockres = NULL;
__u32 flags, num_nodes;
- __u64 offset;
ocfs2_dinode *fe = NULL;
ocfs_vote *vote = NULL;
struct buffer_head *fe_bh = NULL, *vote_bh = NULL;
@@ -745,8 +742,9 @@
lock_id, seq_num);
if (disk_vote) {
- offset = (osb->vote_blkno + osb->node_num) << osb->sb->s_blocksize_bits;
- status = ocfs_read_bh(osb, offset, &vote_bh, 0, NULL);
+ status = ocfs_read_bh(osb,
+ (osb->vote_blkno + osb->node_num) << osb->sb->s_blocksize_bits,
+ &vote_bh, 0, NULL);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto leave;
Modified: trunk/src/ocfs.h
===================================================================
--- trunk/src/ocfs.h 2004-06-24 18:12:35 UTC (rev 1209)
+++ trunk/src/ocfs.h 2004-06-24 23:22:45 UTC (rev 1210)
@@ -559,20 +559,20 @@
struct inode *system_inodes[NUM_SYSTEM_INODES];
/* new */
- u64 num_clusters;
+ u32 num_clusters;
u64 root_blkno;
u64 system_dir_blkno;
u64 bitmap_blkno;
- u64 bitmap_blocks;
+ u32 bitmap_blocks;
u64 publish_blkno;
- u64 publish_blocks;
+ u32 publish_blocks;
u64 vote_blkno;
- u64 vote_blocks;
+ u32 vote_blocks;
u64 autoconfig_blkno;
- u64 autoconfig_blocks;
+ u32 autoconfig_blocks;
u64 new_autoconfig_blkno;
- u64 new_autoconfig_blocks;
- u64 total_autoconfig_blocks;
+ u32 new_autoconfig_blocks;
+ u32 total_autoconfig_blocks;
u8 *uuid;
u8 *vol_label;
@@ -1018,14 +1018,14 @@
return clusters;
}
-static inline __u64 ocfs_align_bytes_to_clusters(struct super_block *sb,
- __u64 bytes)
+static inline u64 ocfs_align_bytes_to_clusters(struct super_block *sb,
+ u64 bytes)
{
int cl_bits = OCFS_SB(sb)->s_clustersize_bits;
unsigned int clusters;
clusters = ocfs_clusters_for_bytes(sb, bytes);
- return (__u64)clusters << cl_bits;
+ return (u64)clusters << cl_bits;
}
static inline int ocfs_inc_icount(struct inode *inode)
Modified: trunk/src/ocfs_journal.h
===================================================================
--- trunk/src/ocfs_journal.h 2004-06-24 18:12:35 UTC (rev 1209)
+++ trunk/src/ocfs_journal.h 2004-06-24 23:22:45 UTC (rev 1210)
@@ -372,7 +372,7 @@
blocks += ocfs_calc_extend_credits(sb, size);
- blocks += size >> sb->s_blocksize_bits;
+ blocks += (size + sb->s_blocksize - 1) >> sb->s_blocksize_bits;
return(blocks);
}
Modified: trunk/src/super.c
===================================================================
--- trunk/src/super.c 2004-06-24 18:12:35 UTC (rev 1209)
+++ trunk/src/super.c 2004-06-24 23:22:45 UTC (rev 1210)
@@ -1190,19 +1190,19 @@
int status;
ocfs_publish *publish;
struct buffer_head *publish_bh = NULL;
- __u64 offset;
int retval = 0;
int flags = 0;
LOG_ENTRY();
/* read it in */
- offset = (osb->publish_blkno + node_num) << osb->sb->s_blocksize_bits;
/* we may be called during mount in which case our publish
* sector might be dirty. */
if (node_num == osb->node_num)
flags = OCFS_BH_CACHED;
- status = ocfs_read_bh(osb, offset, &publish_bh, flags, NULL);
+ status = ocfs_read_bh(osb,
+ (osb->publish_blkno + node_num) << osb->sb->s_blocksize_bits,
+ &publish_bh, flags, NULL);
if (status < 0) {
brelse(publish_bh);
LOG_ERROR_STR("Could not read publish sector, mounted value"
@@ -1225,13 +1225,13 @@
int status;
ocfs_publish *publish;
struct buffer_head * publish_bh = NULL;
- __u64 offset;
LOG_ENTRY_ARGS("(node_num=%d, value=%d)\n", node_num, value);
/* read it in */
- offset = (osb->publish_blkno + node_num) << osb->sb->s_blocksize_bits;
- status = ocfs_read_bh(osb, offset, &publish_bh, 0, NULL);
+ status = ocfs_read_bh(osb,
+ (osb->publish_blkno + node_num) << osb->sb->s_blocksize_bits,
+ &publish_bh, 0, NULL);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto done;
@@ -1306,8 +1306,7 @@
{
int status = 0;
ocfs_publish *publish = NULL;
- __u32 length;
- __u64 offset, ret;
+ __u64 ret;
struct buffer_head *publish_bh = NULL; /* our own publish sector */
struct buffer_head **publish_bhs = NULL; /* all the publish sectors */
int i;
@@ -1547,12 +1546,12 @@
osb->vote_blkno = osb->publish_blkno + osb->publish_blocks;
osb->vote_blocks = osb->max_nodes;
- printk("autoconfig: blkno=%llu, blocks=%llu newblkno=%llu newblocks=%llu\n",
+ printk("autoconfig: blkno=%llu, blocks=%u newblkno=%llu newblocks=%u\n",
osb->autoconfig_blkno, osb->autoconfig_blocks,
osb->new_autoconfig_blkno, osb->new_autoconfig_blocks);
- printk("publish: blkno=%llu, blocks=%llu\n", osb->publish_blkno,
+ printk("publish: blkno=%llu, blocks=%u\n", osb->publish_blkno,
osb->publish_blocks);
- printk("vote: blkno=%llu, blocks=%llu\n", osb->vote_blkno, osb->vote_blocks);
+ printk("vote: blkno=%llu, blocks=%u\n", osb->vote_blkno, osb->vote_blocks);
osb->autoconfig_bhs = ocfs_malloc (osb->total_autoconfig_blocks
* sizeof(struct buffer_head *));
@@ -1586,7 +1585,7 @@
osb->bitmap_blkno = ret >> osb->sb->s_blocksize_bits;
osb->bitmap_blocks = OCFS_I(inode)->ip_alloc_size >> osb->sb->s_blocksize_bits;
osb->num_clusters = OCFS_I(inode)->u.ip_bitinfo.total_bits;
- printk("bitmap_blkno=%llu, bitmap_blocks=%llu, num_clusters=%llu\n",
+ printk("bitmap_blkno=%llu, bitmap_blocks=%u, num_clusters=%u\n",
osb->bitmap_blkno, osb->bitmap_blocks, osb->num_clusters);
ocfs_initialize_bitmap(osb->sb, &osb->cluster_bitmap,
@@ -1594,7 +1593,9 @@
OCFS_I(inode)->ip_alloc_size << 3);
/* read the whole cluster bitmap off disk, even though we only
* need the beginning of it. */
- status = ocfs_read_bhs(osb, ret, OCFS_I(inode)->ip_alloc_size,
+ status = ocfs_read_bhs(osb,
+ osb->bitmap_blkno << osb->sb->s_blocksize_bits,
+ OCFS_I(inode)->ip_alloc_size,
osb->cluster_bitmap.chunk, 0, inode);
if (status < 0) {
LOG_ERROR_STATUS (status);
@@ -1613,8 +1614,9 @@
}
/* Read the Publish Sector of local Node */
- offset = (osb->publish_blkno + osb->node_num) << osb->sb->s_blocksize_bits;
- status = ocfs_read_bh(osb, offset, &publish_bh, 0, NULL);
+ status = ocfs_read_bh(osb,
+ (osb->publish_blkno + osb->node_num) << osb->sb->s_blocksize_bits,
+ &publish_bh, 0, NULL);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finally;
@@ -1640,9 +1642,10 @@
brelse(publish_bh);
/* Read disk for all Publish Sectors */
- length = osb->max_nodes << osb->sb->s_blocksize_bits;
- offset = osb->publish_blkno << osb->sb->s_blocksize_bits;
- status = ocfs_read_bhs(osb, offset, length, publish_bhs, 0, NULL);
+ status = ocfs_read_bhs(osb,
+ osb->publish_blkno << osb->sb->s_blocksize_bits,
+ osb->max_nodes << osb->sb->s_blocksize_bits,
+ publish_bhs, 0, NULL);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finally;
@@ -1785,7 +1788,6 @@
static int ocfs_check_volume (ocfs_super * osb)
{
int status = 0;
- __u64 offset = 0;
ocfs_publish *publish = NULL;
int node_num = osb->node_num;
struct buffer_head * publish_bh = NULL;
@@ -1797,8 +1799,9 @@
LOG_ENTRY ();
/* Read the node's publish sector */
- offset = (osb->publish_blkno + osb->node_num) << osb->sb->s_blocksize_bits;
- status = ocfs_read_bh(osb, offset, &publish_bh, 0, NULL);
+ status = ocfs_read_bh(osb,
+ (osb->publish_blkno + osb->node_num) << osb->sb->s_blocksize_bits,
+ &publish_bh, 0, NULL);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finally;
Modified: trunk/src/volcfg.c
===================================================================
--- trunk/src/volcfg.c 2004-06-24 18:12:35 UTC (rev 1209)
+++ trunk/src/volcfg.c 2004-06-24 23:22:45 UTC (rev 1210)
@@ -134,11 +134,9 @@
static int ocfs_add_to_disk_config (ocfs_super * osb, __u32 pref_node_num, ocfs_node_config_info * new_disk_node)
{
int status = 0;
- __u64 offset;
int i;
ocfs_node_config_info *disk_node = NULL;
__u32 node_num;
- __u32 size;
struct buffer_head **cfg_bhs = NULL;
LOG_ENTRY ();
@@ -151,10 +149,10 @@
memset(cfg_bhs, 0, osb->max_nodes * sizeof(struct buffer_head *));
/* Read the nodecfg info for all nodes from disk */
- offset = (osb->autoconfig_blkno + OCFS_VOLCFG_HDR_SECTORS) << osb->sb->s_blocksize_bits;
- size = (osb->autoconfig_blocks - OCFS_VOLCFG_HDR_SECTORS) << osb->sb->s_blocksize_bits;
-
- status = ocfs_read_bhs(osb, offset, size, cfg_bhs, 0, NULL);
+ status = ocfs_read_bhs(osb,
+ (osb->autoconfig_blkno + OCFS_VOLCFG_HDR_SECTORS) << osb->sb->s_blocksize_bits,
+ (u64)(osb->autoconfig_blocks - OCFS_VOLCFG_HDR_SECTORS) << osb->sb->s_blocksize_bits,
+ cfg_bhs, 0, NULL);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finally;
@@ -221,22 +219,23 @@
{
int status = 0;
ocfs_node_config_hdr *hdr, *hdr_copy;
- __u64 offset;
struct buffer_head *node_cfg_bhs[2];
LOG_ENTRY ();
node_cfg_bhs[0] = node_cfg_bhs[1] = NULL;
/* Read the nodecfg header */
- offset = osb->autoconfig_blkno << osb->sb->s_blocksize_bits;
- status = ocfs_read_bh(osb, offset, &node_cfg_bhs[0], 0, NULL);
+ status = ocfs_read_bh(osb,
+ osb->autoconfig_blkno << osb->sb->s_blocksize_bits,
+ &node_cfg_bhs[0], 0, NULL);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto bail;
}
- offset = (osb->new_autoconfig_blkno + 1) << osb->sb->s_blocksize_bits;
- status = ocfs_read_bh(osb, offset, &node_cfg_bhs[1], 0, NULL);
+ status = ocfs_read_bh(osb,
+ (osb->new_autoconfig_blkno + 1) << osb->sb->s_blocksize_bits,
+ &node_cfg_bhs[1], 0, NULL);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto bail;
@@ -694,27 +693,25 @@
int status = 0;
ocfs_node_config_hdr *hdr = NULL;
ocfs_node_config_info *disk = NULL;
- __u64 offset;
__s32 i;
- __u32 numblocks = 0;
struct super_block *sb = osb->sb;
struct buffer_head **cfg_bhs = NULL;
LOG_ENTRY ();
/* Read in the config on the disk */
- offset = osb->autoconfig_blkno << sb->s_blocksize_bits;
- numblocks = osb->autoconfig_blocks;
-
- cfg_bhs = ocfs_malloc(numblocks * sizeof(*cfg_bhs));
+ cfg_bhs = ocfs_malloc(osb->autoconfig_blocks *
+ sizeof(*cfg_bhs));
if (cfg_bhs == NULL) {
status = -ENOMEM;
LOG_ERROR_STATUS(status);
goto finally;
}
- memset(cfg_bhs, 0, numblocks * sizeof(*cfg_bhs));
+ memset(cfg_bhs, 0, osb->autoconfig_blocks * sizeof(*cfg_bhs));
- status = ocfs_read_bhs(osb, offset, numblocks << sb->s_blocksize_bits,
+ status = ocfs_read_bhs(osb,
+ osb->autoconfig_blkno << sb->s_blocksize_bits,
+ (u64)(osb->autoconfig_blocks) << sb->s_blocksize_bits,
cfg_bhs, 0, NULL);
if (status < 0) {
LOG_ERROR_STATUS (status);
@@ -815,7 +812,7 @@
finally:
if (cfg_bhs) {
- for (i = 0; i < numblocks; i++)
+ for (i = 0; i < osb->autoconfig_blocks; i++)
if (cfg_bhs[i])
brelse(cfg_bhs[i]);
kfree(cfg_bhs);
More information about the Ocfs2-commits
mailing list