[Ocfs2-commits] mfasheh commits r1544 - trunk/src
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Mon Oct 4 16:17:00 CDT 2004
Author: mfasheh
Date: 2004-10-04 16:16:59 -0500 (Mon, 04 Oct 2004)
New Revision: 1544
Modified:
trunk/src/alloc.c
trunk/src/aops.c
trunk/src/buffer_head_io.c
trunk/src/buffer_head_io.h
trunk/src/dlm.c
trunk/src/file.c
trunk/src/heartbeat.c
trunk/src/inode.c
trunk/src/journal.c
trunk/src/localalloc.c
trunk/src/lockres.c
trunk/src/namei.c
trunk/src/nm.c
trunk/src/suballoc.c
trunk/src/super.c
trunk/src/volcfg.c
Log:
* replace read/write bh[s] functions with ocfs_read_block(s) and
ocfs_write_block(s). Advantages:
- they take block arguments instead of bytes
- the len argument went from u64 to 'int'.
- the code no longer has all those left shifts (UGLY!)
Modified: trunk/src/alloc.c
===================================================================
--- trunk/src/alloc.c 2004-10-02 01:08:08 UTC (rev 1543)
+++ trunk/src/alloc.c 2004-10-04 21:16:59 UTC (rev 1544)
@@ -427,9 +427,8 @@
bitmapblocks = ocfs_blocks_for_bits(osb->sb, bitmap->validbits);
- status = ocfs_read_bhs(osb, osb->bitmap_blkno << osb->sb->s_blocksize_bits,
- bitmapblocks << osb->sb->s_blocksize_bits,
- bitmap->chunk, OCFS_BH_CACHED, bitmap_inode);
+ status = ocfs_read_blocks(osb, osb->bitmap_blkno, bitmapblocks,
+ bitmap->chunk, OCFS_BH_CACHED, bitmap_inode);
if (status < 0) {
LOG_ERROR_STATUS(status);
goto bail;
@@ -479,7 +478,8 @@
OCFS_ASSERT(IS_VALID_FILE_ENTRY(fe));
if (fe->i_last_eb_blk) {
- retval = ocfs_read_bh(osb, fe->i_last_eb_blk << osb->sb->s_blocksize_bits, &eb_bh, OCFS_BH_CACHED, inode);
+ retval = ocfs_read_block(osb, fe->i_last_eb_blk, &eb_bh,
+ OCFS_BH_CACHED, inode);
if (retval < 0) {
LOG_ERROR_STATUS(retval);
goto bail;
@@ -633,10 +633,10 @@
* longer needed for their original purpose. */
for (i = tree_depth + 1; i < el1->l_tree_depth; i++) {
bh = NULL;
- status = ocfs_read_bh(osb,
- tmp_blk << osb->sb->s_blocksize_bits,
- &bh, OCFS_BH_CACHED,
- inode);
+ status = ocfs_read_block(osb,
+ tmp_blk,
+ &bh, OCFS_BH_CACHED,
+ inode);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finally;
@@ -924,9 +924,8 @@
if (fe->i_last_eb_blk != 0) {
struct buffer_head *bh = NULL;
- status = ocfs_read_bh(osb,
- fe->i_last_eb_blk << osb->sb->s_blocksize_bits,
- &bh, OCFS_BH_CACHED, inode);
+ status = ocfs_read_block(osb, fe->i_last_eb_blk,
+ &bh, OCFS_BH_CACHED, inode);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finally;
@@ -964,10 +963,10 @@
status = 0;
for (i = 0; i < fel->l_count; ++i) {
- status = ocfs_read_bh(osb,
- fel->l_recs[i].e_blkno << osb->sb->s_blocksize_bits,
- &bh, OCFS_BH_CACHED,
- inode);
+ status = ocfs_read_block(osb,
+ fel->l_recs[i].e_blkno,
+ &bh, OCFS_BH_CACHED,
+ inode);
if (status < 0) {
LOG_ERROR_STATUS(status);
brelse(bh);
@@ -1093,9 +1092,8 @@
/* This File is no longer using Local Extents */
IncreaseTreeDepth = 0;
- status = ocfs_read_bh(osb,
- fe->i_last_eb_blk << osb->sb->s_blocksize_bits,
- &eb1_bh, OCFS_BH_CACHED, inode);
+ status = ocfs_read_block(osb, fe->i_last_eb_blk,
+ &eb1_bh, OCFS_BH_CACHED, inode);
if (status < 0) {
LOG_ERROR_STATUS (status = -EINVAL);
goto finally;
@@ -1163,11 +1161,11 @@
parent_blk = 0;
for (i = 1; i < fel->l_tree_depth; i++) {
- status = ocfs_read_bh(osb,
- parent_blk << osb->sb->s_blocksize_bits,
- &eb2_bh,
- OCFS_BH_CACHED,
- inode);
+ status = ocfs_read_block(osb,
+ parent_blk,
+ &eb2_bh,
+ OCFS_BH_CACHED,
+ inode);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finally;
@@ -1262,11 +1260,11 @@
eb2_bh = NULL;
}
/* TODO: Can we do a cached read here? */
- status = ocfs_read_bh(osb,
- parent_blk << osb->sb->s_blocksize_bits,
- &eb2_bh,
- OCFS_BH_CACHED,
- inode);
+ status = ocfs_read_block(osb,
+ parent_blk,
+ &eb2_bh,
+ OCFS_BH_CACHED,
+ inode);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finally;
@@ -1547,11 +1545,11 @@
stack[tos] = kmalloc(osb->sb->s_blocksize,
GFP_KERNEL);
- status = ocfs_read_bh(osb,
- cur_el->l_recs[victim].e_blkno << osb->sb->s_blocksize_bits,
- &tmp_bh,
- OCFS_BH_CACHED,
- inode);
+ status = ocfs_read_block(osb,
+ cur_el->l_recs[victim].e_blkno,
+ &tmp_bh,
+ OCFS_BH_CACHED,
+ inode);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto bail;
@@ -1692,10 +1690,10 @@
if (tmp_bh2)
brelse(tmp_bh2);
tmp_bh2 = NULL;
- status = ocfs_read_bh(osb,
- rec->e_blkno << osb->sb->s_blocksize_bits,
- &tmp_bh2,
- OCFS_BH_CACHED, inode);
+ status = ocfs_read_block(osb,
+ rec->e_blkno,
+ &tmp_bh2,
+ OCFS_BH_CACHED, inode);
if (status < 0) {
eb = NULL;
brelse(tmp_bh2);
@@ -1771,11 +1769,11 @@
brelse(tmp_bh);
tmp_bh = NULL;
- status = ocfs_read_bh(osb,
- rec->e_blkno << osb->sb->s_blocksize_bits,
- &tmp_bh,
- OCFS_BH_CACHED,
- inode);
+ status = ocfs_read_block(osb,
+ rec->e_blkno,
+ &tmp_bh,
+ OCFS_BH_CACHED,
+ inode);
if (status < 0) {
eb = NULL;
el = NULL;
@@ -2134,11 +2132,11 @@
LOG_ERROR_STR("uhoh, not brelsing a buffer " \
"on our stack!\n");
- status = ocfs_read_bh(osb,
- rec->e_blkno << osb->sb->s_blocksize_bits,
- &bh_stack[tos],
- OCFS_BH_CACHED,
- inode);
+ status = ocfs_read_block(osb,
+ rec->e_blkno,
+ &bh_stack[tos],
+ OCFS_BH_CACHED,
+ inode);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto bail;
@@ -2210,10 +2208,10 @@
/* Ugly magic -1 */
victim = fel->l_next_free_rec - 1;
- status = ocfs_read_bh(osb,
- fel->l_recs[victim].e_blkno << osb->sb->s_blocksize_bits,
- &eb_bh,
- OCFS_BH_CACHED, inode);
+ status = ocfs_read_block(osb,
+ fel->l_recs[victim].e_blkno,
+ &eb_bh,
+ OCFS_BH_CACHED, inode);
if (status < 0) {
LOG_ERROR_STATUS(status);
goto bail;
@@ -2242,10 +2240,10 @@
eb = NULL;
eb_bh = NULL;
- status = ocfs_read_bh(osb,
- next_blk << osb->sb->s_blocksize_bits,
- &eb_bh,
- OCFS_BH_CACHED, inode);
+ status = ocfs_read_block(osb,
+ next_blk,
+ &eb_bh,
+ OCFS_BH_CACHED, inode);
if (status < 0) {
LOG_ERROR_STATUS(status);
goto bail;
@@ -2308,10 +2306,10 @@
for (i = (fel->l_next_free_rec - 1); i >= 0; i--) {
LOG_TRACE_ARGS("at top of loop, i = %d\n", i);
/* Go ahead and read that bit of the tree - we'll need it. */
- status = ocfs_read_bh(osb,
- fel->l_recs[i].e_blkno << osb->sb->s_blocksize_bits,
- &extent_bh, OCFS_BH_CACHED,
- inode);
+ status = ocfs_read_block(osb,
+ fel->l_recs[i].e_blkno,
+ &extent_bh, OCFS_BH_CACHED,
+ inode);
if (status < 0) {
LOG_ERROR_STATUS(status);
goto finally;
@@ -2483,9 +2481,9 @@
*/
/* Read the file Entry corresponding to this */
- status = ocfs_read_bh(osb,
- OCFS_I(inode)->ip_blkno << inode->i_sb->s_blocksize_bits,
- &fe_bh, OCFS_BH_CACHED, inode);
+ status = ocfs_read_block(osb,
+ OCFS_I(inode)->ip_blkno,
+ &fe_bh, OCFS_BH_CACHED, inode);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finally;
@@ -2563,11 +2561,11 @@
eb_bh = NULL;
eb = NULL;
- status = ocfs_read_bh(osb,
- next_leaf << osb->sb->s_blocksize_bits,
- &eb_bh,
- OCFS_BH_CACHED,
- inode);
+ status = ocfs_read_block(osb,
+ next_leaf,
+ &eb_bh,
+ OCFS_BH_CACHED,
+ inode);
if (status < 0) {
LOG_ERROR_STATUS(status);
goto finally;
@@ -2656,8 +2654,8 @@
}
for (i = 1; i < fel->l_tree_depth; i++) {
- tempstat = ocfs_read_bh(osb,
- child_blkno << osb->sb->s_blocksize_bits,
+ tempstat = ocfs_read_block(osb,
+ child_blkno,
&ext_bh, OCFS_BH_CACHED,
inode);
if (tempstat < 0) {
@@ -2691,8 +2689,8 @@
*data_extent_bh = NULL;
}
- tempstat = ocfs_read_bh(osb,
- child_blkno << osb->sb->s_blocksize_bits,
+ tempstat = ocfs_read_block(osb,
+ child_blkno,
data_extent_bh, OCFS_BH_CACHED,
inode);
if (tempstat < 0) {
@@ -2806,7 +2804,9 @@
num_blocks = ocfs_blocks_for_bits(osb->sb,
osb->cluster_bitmap.validbits);
/* Ok, somewhat lame, but we submit the whole bitmap for reading here*/
- status = ocfs_read_bhs(osb, osb->bitmap_blkno << osb->sb->s_blocksize_bits, num_blocks << osb->sb->s_blocksize_bits, osb->cluster_bitmap.chunk, OCFS_BH_CACHED, bitmap_inode);
+ status = ocfs_read_blocks(osb, osb->bitmap_blkno, num_blocks,
+ osb->cluster_bitmap.chunk, OCFS_BH_CACHED,
+ bitmap_inode);
if (status < 0) {
LOG_ERROR_STATUS(status);
goto bail;
@@ -3032,11 +3032,11 @@
}
} else {
for (i = 0; i < fel->l_next_free_rec; i++) {
- status = ocfs_read_bh(osb,
- fel->l_recs[i].e_blkno << osb->sb->s_blocksize_bits,
- &extent_bh,
- OCFS_BH_CACHED,
- inode);
+ status = ocfs_read_block(osb,
+ fel->l_recs[i].e_blkno,
+ &extent_bh,
+ OCFS_BH_CACHED,
+ inode);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto leave;
Modified: trunk/src/aops.c
===================================================================
--- trunk/src/aops.c 2004-10-02 01:08:08 UTC (rev 1543)
+++ trunk/src/aops.c 2004-10-04 21:16:59 UTC (rev 1544)
@@ -61,11 +61,8 @@
goto bail;
}
- status = ocfs_read_bh(OCFS_SB(inode->i_sb),
- OCFS_I(inode)->ip_blkno <<
- inode->i_sb->s_blocksize_bits,
- &bh,
- OCFS_BH_CACHED, inode);
+ status = ocfs_read_block(OCFS_SB(inode->i_sb), OCFS_I(inode)->ip_blkno,
+ &bh, OCFS_BH_CACHED, inode);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto bail;
Modified: trunk/src/buffer_head_io.c
===================================================================
--- trunk/src/buffer_head_io.c 2004-10-02 01:08:08 UTC (rev 1543)
+++ trunk/src/buffer_head_io.c 2004-10-04 21:16:59 UTC (rev 1544)
@@ -63,8 +63,8 @@
return;
}
-int ocfs_write_bhs (ocfs_super *osb, struct buffer_head *bhs[],
- int nr, struct inode *inode)
+int ocfs_write_blocks (ocfs_super *osb, struct buffer_head *bhs[],
+ int nr, struct inode *inode)
{
int status = 0;
int i;
@@ -75,7 +75,7 @@
my_timing_t begin, end;
#endif
- LOG_ENTRY_ARGS("(bh[0]->b_blocknr = %llu, nr=%d, inode=%p)\n",
+ LOG_ENTRY_ARGS("(bh[0]->b_blocknr = %llu, nr=%u, inode=%p)\n",
(unsigned long long)bhs[0]->b_blocknr, nr, inode);
#ifdef OCFS_DBG_TIMING
rdtsc (begin.lohi[0], begin.lohi[1]);
@@ -90,7 +90,7 @@
}
if (nr > 256)
- LOG_TRACE_ARGS ("Getting write for %d blocks\n", nr);
+ LOG_TRACE_ARGS ("Getting write for %u blocks\n", nr);
sb = osb->sb;
@@ -113,7 +113,7 @@
if (buffer_jbd(bh)) {
#ifdef VERBOSE_BH_JBD_TRACE
LOG_TRACE_ARGS("trying to write a jbd managed bh "
- "(blocknr = %llu), nr=%d\n",
+ "(blocknr = %llu), nr=%u\n",
(unsigned long long)bh->b_blocknr, nr);
#endif
continue;
@@ -164,7 +164,7 @@
bail:
#ifdef OCFS_DBG_TIMING
- IO_FUNC_TIMING_PRINT("ocfs_write_bhs", status);
+ IO_FUNC_TIMING_PRINT("ocfs_write_block", status);
#endif
LOG_EXIT_STATUS(status);
@@ -172,59 +172,53 @@
}
/*
- * ocfs_read_bhs()
+ * ocfs_read_blocks()
*
*/
-int ocfs_read_bhs(ocfs_super *osb, __u64 off, __u64 len,
- struct buffer_head *bhs[], int flags,
- struct inode *inode)
+int ocfs_read_blocks(ocfs_super *osb, u64 block, int nr,
+ struct buffer_head *bhs[], int flags,
+ struct inode *inode)
{
int status = 0;
struct super_block *sb;
- int nr, i, ignore_cache = 0;
- __u64 blocknum;
+ int i, ignore_cache = 0;
struct buffer_head *bh;
#ifdef OCFS_DBG_TIMING
my_timing_t begin, end;
#endif
- LOG_ENTRY_ARGS("(off=(%llu), len=(%llu), flags=%d, inode=%p)\n", off,
- len, flags, inode);
+ LOG_ENTRY_ARGS("(block=(%llu), nr=(%u), flags=%d, inode=%p)\n",
+ block, nr, flags, inode);
#ifdef OCFS_DBG_TIMING
rdtsc (begin.lohi[0], begin.lohi[1]);
#endif
- if (len & (u64)(osb->sb->s_blocksize - 1)) {
- LOG_TRACE_ARGS("len %% blocksize (len=%llu)\n", len);
+ if (osb == NULL || osb->sb == NULL || bhs == NULL) {
+ LOG_TRACE_STR("osb == NULL || osb->sb == NULL || bhs == NULL "
+ "|| num == NULL");
status = -EINVAL;
LOG_ERROR_STATUS(status);
goto bail;
}
- if (osb == NULL || osb->sb == NULL || bhs == NULL) {
- LOG_TRACE_STR("osb == NULL || osb->sb == NULL || bhs == NULL "
- "|| num == NULL");
+ if (nr < 0) {
+ printk("ocfs2: asked to read %d blocks!\n", nr);
status = -EINVAL;
LOG_ERROR_STATUS(status);
goto bail;
}
- sb = osb->sb;
- blocknum = off >> sb->s_blocksize_bits;
-
- nr = (len + sb->s_blocksize - 1) >> sb->s_blocksize_bits;
if (nr == 0) {
LOG_TRACE_STR("No buffers will be read!!!");
- LOG_TRACE_ARGS("Len=%llu Off=%llu numbuffers=%u "
- "blocknum=%llu\n", len, off,
- nr, blocknum);
status = 0;
goto bail;
}
+ sb = osb->sb;
+
for (i = 0 ; i < nr ; i++) {
if (bhs[i] == NULL) {
- bhs[i] = sb_getblk(sb, blocknum++);
+ bhs[i] = sb_getblk(sb, block++);
if (bhs[i] == NULL) {
LOG_TRACE_STR("bh == NULL");
status = -EIO;
@@ -238,8 +232,8 @@
if (flags & OCFS_BH_CACHED && inode &&
!TEST_BH_SEQNUM(inode, bh)) {
#ifdef VERBOSE_BH_SEQNUM_TRACE
- LOG_TRACE_ARGS("(read) bh (%llu) seqnum (%lu) does not "
- "match inode (%u)\n",
+ LOG_TRACE_ARGS("(read) bh (%llu) seqnum (%lu) does "
+ "not match inode (%u)\n",
(unsigned long long)bh->b_blocknr,
(bh->b_state & STATE_BIT_MASK) >> 19,
atomic_read(GET_INODE_CLEAN_SEQ(inode)));
@@ -304,18 +298,15 @@
else
CLEAR_BH_SEQNUM(bh);
}
- LOG_TRACE_ARGS("off=(%llu), len=(%llu), cached=%s\n", off, len,
+ LOG_TRACE_ARGS("block=(%llu), nr=(%u), cached=%s\n", block, nr,
(!(flags & OCFS_BH_CACHED) || ignore_cache) ? "no" : "yes");
bail:
#ifdef OCFS_DBG_TIMING
- IO_FUNC_TIMING_PRINT("ocfs_read_bhs", status);
+ IO_FUNC_TIMING_PRINT("ocfs_read_blocks", status);
#endif
LOG_EXIT_STATUS(status);
return status;
}
-
-
-
Modified: trunk/src/buffer_head_io.h
===================================================================
--- trunk/src/buffer_head_io.h 2004-10-02 01:08:08 UTC (rev 1543)
+++ trunk/src/buffer_head_io.h 2004-10-04 21:16:59 UTC (rev 1544)
@@ -42,25 +42,25 @@
int uptodate);
/* Yosh made me do it. */
-static inline int ocfs_write_bh (ocfs_super *osb,
- struct buffer_head *bh,
- struct inode *inode);
-static inline int ocfs_read_bh (ocfs_super *osb,
- __u64 off,
- struct buffer_head **bh,
- int flags,
- struct inode *inode);
+static inline int ocfs_write_block (ocfs_super *osb,
+ struct buffer_head *bh,
+ struct inode *inode);
+static inline int ocfs_read_block (ocfs_super *osb,
+ u64 off,
+ struct buffer_head **bh,
+ int flags,
+ struct inode *inode);
-int ocfs_write_bhs (ocfs_super *osb,
- struct buffer_head *bh[],
- int nr,
- struct inode *inode);
-int ocfs_read_bhs (ocfs_super *osb,
- __u64 off,
- __u64 len,
- struct buffer_head *bhs[],
- int flags,
- struct inode *inode);
+int ocfs_write_blocks (ocfs_super *osb,
+ struct buffer_head *bh[],
+ int nr,
+ struct inode *inode);
+int ocfs_read_blocks (ocfs_super *osb,
+ u64 block,
+ int nr,
+ struct buffer_head *bhs[],
+ int flags,
+ struct inode *inode);
#define OCFS_BH_CACHED 1
@@ -161,23 +161,23 @@
printk("\n"); \
} while (0)
-static inline int ocfs_write_bh (ocfs_super * osb, struct buffer_head *bh,
- struct inode *inode)
+static inline int ocfs_write_block (ocfs_super * osb, struct buffer_head *bh,
+ struct inode *inode)
{
int status;
IO_FUNC_TIMING_DECL
- status = ocfs_write_bhs (osb, &bh, 1, inode);
+ status = ocfs_write_blocks (osb, &bh, 1, inode);
- IO_FUNC_TIMING_PRINT("ocfs_write_bh", status);
+ IO_FUNC_TIMING_PRINT("ocfs_write_block", status);
return status;
}
-static inline int ocfs_read_bh (ocfs_super * osb, __u64 off,
- struct buffer_head **bh, int flags,
- struct inode *inode)
+static inline int ocfs_read_block (ocfs_super * osb, u64 off,
+ struct buffer_head **bh, int flags,
+ struct inode *inode)
{
int status = 0;
@@ -188,12 +188,12 @@
status = -EINVAL;
goto bail;
}
-
- status = ocfs_read_bhs(osb, off, osb->sb->s_blocksize, bh,
- flags, inode);
+ status = ocfs_read_blocks(osb, off, 1, bh,
+ flags, inode);
+
bail:
- IO_FUNC_TIMING_PRINT("ocfs_read_bh", status);
+ IO_FUNC_TIMING_PRINT("ocfs_read_block", status);
return status;
}
Modified: trunk/src/dlm.c
===================================================================
--- trunk/src/dlm.c 2004-10-02 01:08:08 UTC (rev 1543)
+++ trunk/src/dlm.c 2004-10-04 21:16:59 UTC (rev 1544)
@@ -685,8 +685,7 @@
/* want to refresh the lock from the latest on disk
* state before writing it back out. */
- status = ocfs_read_bh(osb, lock_id << inode->i_sb->s_blocksize_bits,
- &bh, 0, inode);
+ status = ocfs_read_block(osb, lock_id, &bh, 0, inode);
if (!status)
ocfs_update_disk_lock(osb, bh, inode);
Modified: trunk/src/file.c
===================================================================
--- trunk/src/file.c 2004-10-02 01:08:08 UTC (rev 1543)
+++ trunk/src/file.c 2004-10-04 21:16:59 UTC (rev 1544)
@@ -343,10 +343,10 @@
eb = NULL;
eb_bh = NULL;
- ret = ocfs_read_bh(osb,
- next_leaf << osb->sb->s_blocksize_bits,
- &eb_bh,
- OCFS_BH_CACHED, inode);
+ ret = ocfs_read_block(osb,
+ next_leaf,
+ &eb_bh,
+ OCFS_BH_CACHED, inode);
if (ret < 0) {
LOG_ERROR_STATUS(ret);
goto leave;
Modified: trunk/src/heartbeat.c
===================================================================
--- trunk/src/heartbeat.c 2004-10-02 01:08:08 UTC (rev 1543)
+++ trunk/src/heartbeat.c 2004-10-04 21:16:59 UTC (rev 1544)
@@ -75,9 +75,9 @@
BUG();
if (read_publish) {
- status = ocfs_read_bh(osb,
- (osb->publish_blkno + osb->node_num) << osb->sb->s_blocksize_bits,
- pub_bh, 0, NULL);
+ status = ocfs_read_block(osb,
+ (osb->publish_blkno + osb->node_num),
+ pub_bh, 0, NULL);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finally;
@@ -98,7 +98,7 @@
publish->comm_seq_num = OcfsGlobalCtxt.comm_seq_num;
spin_unlock (&OcfsGlobalCtxt.comm_seq_lock);
- status = ocfs_write_bh(osb, *pub_bh, NULL);
+ status = ocfs_write_block(osb, *pub_bh, NULL);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finally;
@@ -274,10 +274,10 @@
down (&(osb->publish_lock));
/* Read disk for 4 autoconfig blocks + all nodes publish blocks */
- 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);
+ status = ocfs_read_blocks(osb,
+ osb->new_autoconfig_blkno,
+ osb->total_autoconfig_blocks,
+ osb->autoconfig_bhs, 0, NULL);
if (status < 0) {
up (&(osb->publish_lock));
LOG_ERROR_STATUS (status);
Modified: trunk/src/inode.c
===================================================================
--- trunk/src/inode.c 2004-10-02 01:08:08 UTC (rev 1543)
+++ trunk/src/inode.c 2004-10-04 21:16:59 UTC (rev 1544)
@@ -473,9 +473,7 @@
/* Read the FE off disk. This is safe because the kernel only
* does one read_inode2 for a new inode, and if it doesn't
* exist yet then nobody can be working on it! */
- status = ocfs_read_bh(osb,
- args->blkno << sb->s_blocksize_bits,
- &bh, 0, NULL);
+ status = ocfs_read_block(osb, args->blkno, &bh, 0, NULL);
if (status < 0) {
LOG_ERROR_STATUS(status);
make_bad_inode (inode);
@@ -804,7 +802,7 @@
osb = OCFS_SB(inode->i_sb);
vbo = (__s64) block << inode->i_sb->s_blocksize_bits;
-#warning only turn this on if we know we can deal with read_bh returning nothing
+#warning only turn this on if we know we can deal with read_block returning nothing
#if 0
if (reada)
readflags |= OCFS_BH_READAHEAD;
@@ -826,7 +824,8 @@
if (tmperr < 0)
goto fail;
- tmperr = ocfs_read_bh(osb, lbo, &bh, readflags, inode);
+ tmperr = ocfs_read_block(osb, lbo >> osb->sb->s_blocksize_bits,
+ &bh, readflags, inode);
if (tmperr < 0)
goto fail;
@@ -1127,9 +1126,8 @@
}
up(&OCFS_I(inode)->ip_sem);
- status = ocfs_read_bh(osb,
- OCFS_I(inode)->ip_blkno << inode->i_sb->s_blocksize_bits,
- &fe_bh, OCFS_BH_CACHED, inode);
+ status = ocfs_read_block(osb, OCFS_I(inode)->ip_blkno, &fe_bh,
+ OCFS_BH_CACHED, inode);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto leave;
Modified: trunk/src/journal.c
===================================================================
--- trunk/src/journal.c 2004-10-02 01:08:08 UTC (rev 1543)
+++ trunk/src/journal.c 2004-10-04 21:16:59 UTC (rev 1544)
@@ -1467,7 +1467,9 @@
/* there are actually returned in bytes. need blocks. */
numblks = numbytes >> osb->sb->s_blocksize_bits;
- status = ocfs_read_bhs(osb, lbo, numbytes, bhs, 0, inode);
+ status = ocfs_read_blocks(osb,
+ lbo >> osb->sb->s_blocksize_bits,
+ numblks, bhs, 0, inode);
if (status < 0) {
LOG_ERROR_STATUS(status);
goto bail;
@@ -1912,10 +1914,8 @@
down (&(osb->publish_lock));
/* Read the publish sector */
- status = ocfs_read_bh(osb,
- (osb->publish_blkno + node_num) << osb->sb->s_blocksize_bits,
- &publish_bh,
- 0, NULL);
+ status = ocfs_read_block(osb, (osb->publish_blkno + node_num),
+ &publish_bh, 0, NULL);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finally;
@@ -1927,7 +1927,7 @@
publish->mounted = 0;
/* Write the publish sector */
- status = ocfs_write_bh(osb, publish_bh, NULL);
+ status = ocfs_write_block(osb, publish_bh, NULL);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finally;
Modified: trunk/src/localalloc.c
===================================================================
--- trunk/src/localalloc.c 2004-10-02 01:08:08 UTC (rev 1543)
+++ trunk/src/localalloc.c 2004-10-04 21:16:59 UTC (rev 1544)
@@ -164,9 +164,8 @@
LOG_ERROR_STATUS(status=-EINVAL);
goto bail;
}
- status = ocfs_read_bh(osb,
- OCFS_I(inode)->ip_blkno << inode->i_sb->s_blocksize_bits,
- &alloc_bh, 0, inode);
+ status = ocfs_read_block(osb, OCFS_I(inode)->ip_blkno, &alloc_bh, 0,
+ inode);
if (status < 0) {
LOG_ERROR_STATUS(status);
goto bail;
@@ -336,10 +335,8 @@
goto bail;
}
- status = ocfs_read_bh(osb,
- OCFS_I(inode)->ip_blkno << inode->i_sb->s_blocksize_bits,
- &alloc_bh,
- 0, inode);
+ status = ocfs_read_block(osb, OCFS_I(inode)->ip_blkno, &alloc_bh, 0,
+ inode);
if (status < 0) {
LOG_ERROR_STATUS(status);
goto bail;
@@ -357,7 +354,7 @@
alloc = (ocfs2_dinode *) alloc_bh->b_data;
ocfs_clear_local_alloc(alloc);
- status = ocfs_write_bh(osb, alloc_bh, inode);
+ status = ocfs_write_block(osb, alloc_bh, inode);
if (status < 0)
LOG_ERROR_STATUS(status);
@@ -748,11 +745,9 @@
LOG_TRACE_ARGS("start=%u, alloc->la_bm_off = %u, numblocks=%u\n", start,
LOCAL_ALLOC(alloc)->la_bm_off, numblocks);
- status = ocfs_read_bhs(osb,
- (osb->bitmap_blkno + start) << osb->sb->s_blocksize_bits,
- numblocks << osb->sb->s_blocksize_bits,
- &osb->cluster_bitmap.chunk[start], OCFS_BH_CACHED,
- main_bm_inode);
+ status = ocfs_read_blocks(osb, (osb->bitmap_blkno + start), numblocks,
+ &osb->cluster_bitmap.chunk[start],
+ OCFS_BH_CACHED, main_bm_inode);
if (status < 0) {
LOG_ERROR_STATUS(status);
goto bail;
Modified: trunk/src/lockres.c
===================================================================
--- trunk/src/lockres.c 2004-10-02 01:08:08 UTC (rev 1543)
+++ trunk/src/lockres.c 2004-10-04 21:16:59 UTC (rev 1544)
@@ -84,9 +84,8 @@
if (reread) {
flags = lockres->master_node_num == osb->node_num ?
OCFS_BH_CACHED : 0;
- status = ocfs_read_bh(osb,
- OCFS_I(inode)->ip_blkno << inode->i_sb->s_blocksize_bits,
- &bh, flags, inode);
+ status = ocfs_read_block(osb, OCFS_I(inode)->ip_blkno, &bh,
+ flags, inode);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto out;
Modified: trunk/src/namei.c
===================================================================
--- trunk/src/namei.c 2004-10-02 01:08:08 UTC (rev 1543)
+++ trunk/src/namei.c 2004-10-04 21:16:59 UTC (rev 1544)
@@ -2140,7 +2140,9 @@
goto leave;
}
- status = ocfs_read_bh(osb, OCFS_I(orphan_dir_inode)->ip_blkno << osb->sb->s_blocksize_bits, &orphan_dir_bh, OCFS_BH_CACHED, orphan_dir_inode);
+ status = ocfs_read_block(osb, OCFS_I(orphan_dir_inode)->ip_blkno,
+ &orphan_dir_bh, OCFS_BH_CACHED,
+ orphan_dir_inode);
if (status < 0) {
LOG_ERROR_STATUS(status);
goto leave;
Modified: trunk/src/nm.c
===================================================================
--- trunk/src/nm.c 2004-10-02 01:08:08 UTC (rev 1543)
+++ trunk/src/nm.c 2004-10-04 21:16:59 UTC (rev 1544)
@@ -792,8 +792,7 @@
BUG();
}
- *status = ocfs_read_bh(osb, (lock_id << osb->sb->s_blocksize_bits),
- &fe_bh, OCFS_BH_CACHED, inode);
+ *status = ocfs_read_block(osb, lock_id, &fe_bh, OCFS_BH_CACHED, inode);
if (*status < 0) {
LOG_ERROR_STATUS ((*status));
return *status;
Modified: trunk/src/suballoc.c
===================================================================
--- trunk/src/suballoc.c 2004-10-02 01:08:08 UTC (rev 1543)
+++ trunk/src/suballoc.c 2004-10-04 21:16:59 UTC (rev 1544)
@@ -749,11 +749,8 @@
LOG_TRACE_ARGS("trying to alloc %u bits from chain %u, inode %llu\n",
bits_wanted, chain, OCFS_I(alloc_inode)->ip_blkno);
- status = ocfs_read_bh(osb,
- cl->cl_recs[chain].c_blkno << osb->sb->s_blocksize_bits,
- &group_bh,
- OCFS_BH_CACHED,
- alloc_inode);
+ status = ocfs_read_block(osb, cl->cl_recs[chain].c_blkno,
+ &group_bh, OCFS_BH_CACHED, alloc_inode);
if (status < 0) {
LOG_ERROR_STATUS(status);
goto bail;
@@ -781,11 +778,8 @@
next_group = bg->bg_next_group;
prev_group_bh = group_bh;
group_bh = NULL;
- status = ocfs_read_bh(osb,
- next_group << osb->sb->s_blocksize_bits,
- &group_bh,
- OCFS_BH_CACHED,
- alloc_inode);
+ status = ocfs_read_block(osb, next_group, &group_bh,
+ OCFS_BH_CACHED, alloc_inode);
if (status < 0) {
LOG_ERROR_STATUS(status);
goto bail;
@@ -993,11 +987,8 @@
count, bg_blkno, start_bit, start_block,
OCFS_I(alloc_inode)->ip_blkno);
- status = ocfs_read_bh(osb,
- bg_blkno << osb->sb->s_blocksize_bits,
- &group_bh,
- OCFS_BH_CACHED,
- alloc_inode);
+ status = ocfs_read_block(osb, bg_blkno, &group_bh, OCFS_BH_CACHED,
+ alloc_inode);
if (status < 0) {
LOG_ERROR_STATUS(status);
goto bail;
Modified: trunk/src/super.c
===================================================================
--- trunk/src/super.c 2004-10-02 01:08:08 UTC (rev 1543)
+++ trunk/src/super.c 2004-10-04 21:16:59 UTC (rev 1544)
@@ -753,9 +753,8 @@
}
down_read(&OCFS_I(inode)->ip_io_sem);
- status = ocfs_read_bh(osb,
- OCFS_I(inode)->ip_blkno << inode->i_sb->s_blocksize_bits,
- &bh, OCFS_BH_CACHED, inode);
+ status = ocfs_read_block(osb, OCFS_I(inode)->ip_blkno, &bh,
+ OCFS_BH_CACHED, inode);
up_read(&OCFS_I(inode)->ip_io_sem);
if (status < 0) {
LOG_ERROR_STR("failed to read bitmap data");
@@ -1230,9 +1229,8 @@
* sector might be dirty. */
if (node_num == osb->node_num)
flags = OCFS_BH_CACHED;
- status = ocfs_read_bh(osb,
- (osb->publish_blkno + node_num) << osb->sb->s_blocksize_bits,
- &publish_bh, flags, NULL);
+ status = ocfs_read_block(osb, (osb->publish_blkno + node_num),
+ &publish_bh, flags, NULL);
if (status < 0) {
brelse(publish_bh);
LOG_ERROR_STR("Could not read publish sector, mounted value"
@@ -1259,9 +1257,8 @@
LOG_ENTRY_ARGS("(node_num=%d, value=%d)\n", node_num, value);
/* read it in */
- status = ocfs_read_bh(osb,
- (osb->publish_blkno + node_num) << osb->sb->s_blocksize_bits,
- &publish_bh, 0, NULL);
+ status = ocfs_read_block(osb, (osb->publish_blkno + node_num),
+ &publish_bh, 0, NULL);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto done;
@@ -1272,7 +1269,7 @@
publish->mounted = value;
/* write it back out */
- status = ocfs_write_bh(osb, publish_bh, NULL);
+ status = ocfs_write_block(osb, publish_bh, NULL);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto done;
@@ -1636,10 +1633,10 @@
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,
- osb->bitmap_blkno << osb->sb->s_blocksize_bits,
- OCFS_I(inode)->ip_alloc_size,
- osb->cluster_bitmap.chunk, 0, inode);
+ status = ocfs_read_blocks(osb,
+ osb->bitmap_blkno,
+ OCFS_I(inode)->ip_alloc_size >> osb->sb->s_blocksize_bits,
+ osb->cluster_bitmap.chunk, 0, inode);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto bail;
@@ -1657,9 +1654,8 @@
}
/* Read the Publish Sector of local Node */
- status = ocfs_read_bh(osb,
- (osb->publish_blkno + osb->node_num) << osb->sb->s_blocksize_bits,
- &publish_bh, 0, NULL);
+ status = ocfs_read_block(osb, (osb->publish_blkno + osb->node_num),
+ &publish_bh, 0, NULL);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finally;
@@ -1677,7 +1673,7 @@
publish = NULL;
- status = ocfs_write_bh (osb, publish_bh, NULL);
+ status = ocfs_write_block(osb, publish_bh, NULL);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finally;
@@ -1685,10 +1681,8 @@
brelse(publish_bh);
/* Read disk for all Publish Sectors */
- 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);
+ status = ocfs_read_blocks(osb, osb->publish_blkno, osb->max_nodes,
+ publish_bhs, 0, NULL);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finally;
@@ -1842,9 +1836,8 @@
LOG_ENTRY ();
/* Read the node's publish sector */
- status = ocfs_read_bh(osb,
- (osb->publish_blkno + osb->node_num) << osb->sb->s_blocksize_bits,
- &publish_bh, 0, NULL);
+ status = ocfs_read_block(osb, (osb->publish_blkno + osb->node_num),
+ &publish_bh, 0, NULL);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finally;
Modified: trunk/src/volcfg.c
===================================================================
--- trunk/src/volcfg.c 2004-10-02 01:08:08 UTC (rev 1543)
+++ trunk/src/volcfg.c 2004-10-04 21:16:59 UTC (rev 1544)
@@ -84,7 +84,7 @@
offset = cfg_task->lock_off;
/* Write the sector back */
- status = ocfs_write_bh(osb, bh, NULL);
+ status = ocfs_write_block(osb, bh, NULL);
if (status < 0) {
LOG_ERROR_STATUS (status);
/* deliberate no exit jump here */
@@ -147,10 +147,10 @@
memset(cfg_bhs, 0, osb->max_nodes * sizeof(struct buffer_head *));
/* Read the nodecfg info for all nodes from disk */
- 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);
+ status = ocfs_read_blocks(osb,
+ (osb->autoconfig_blkno + OCFS_VOLCFG_HDR_SECTORS),
+ (osb->autoconfig_blocks - OCFS_VOLCFG_HDR_SECTORS),
+ cfg_bhs, 0, NULL);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finally;
@@ -185,7 +185,7 @@
memcpy (cfg_bhs[node_num]->b_data, new_disk_node, osb->sb->s_blocksize);
/* Write the new node details on disk */
- status = ocfs_write_bh(osb, cfg_bhs[node_num], NULL);
+ status = ocfs_write_block(osb, cfg_bhs[node_num], NULL);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finally;
@@ -223,17 +223,15 @@
node_cfg_bhs[0] = node_cfg_bhs[1] = NULL;
/* Read the nodecfg header */
- status = ocfs_read_bh(osb,
- osb->autoconfig_blkno << osb->sb->s_blocksize_bits,
- &node_cfg_bhs[0], 0, NULL);
+ status = ocfs_read_block(osb, osb->autoconfig_blkno, &node_cfg_bhs[0],
+ 0, NULL);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto bail;
}
- status = ocfs_read_bh(osb,
- (osb->new_autoconfig_blkno + 1) << osb->sb->s_blocksize_bits,
- &node_cfg_bhs[1], 0, NULL);
+ status = ocfs_read_block(osb, (osb->new_autoconfig_blkno + 1),
+ &node_cfg_bhs[1], 0, NULL);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto bail;
@@ -253,7 +251,7 @@
/* Write the nodecfg hdr into the second sector of newcfg also. */
/* We do so so that we can read the nodecfg hdr easily when we */
/* read the publish sector, for e.g. in ocfs_nm_thread() */
- status = ocfs_write_bhs(osb, node_cfg_bhs, 2, NULL);
+ status = ocfs_write_blocks(osb, node_cfg_bhs, 2, NULL);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto bail;
@@ -327,7 +325,8 @@
atomic_set (&osb->lock_event_woken, 0);
atomic_set (&osb->lock_stop, 0);
- status = ocfs_read_bh(osb, lock_off, &bh, 0, NULL);
+ status = ocfs_read_block(osb, lock_off >> osb->sb->s_blocksize_bits,
+ &bh, 0, NULL);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finito;
@@ -336,7 +335,9 @@
for (i = 0; i < 50; i++) {
/* Read the volcfg lock sector */
- status = ocfs_read_bh(osb, lock_off, &bh, 0, NULL);
+ status = ocfs_read_block(osb,
+ lock_off >> osb->sb->s_blocksize_bits,
+ &bh, 0, NULL);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finito;
@@ -359,7 +360,7 @@
memcpy(cfg_buf, disk_lock, osb->sb->s_blocksize);
/* Write into volcfg lock sector... */
- status = ocfs_write_bh(osb, bh, NULL);
+ status = ocfs_write_block(osb, bh, NULL);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finito;
@@ -370,7 +371,9 @@
ocfs_sleep (OCFS_VOLCFG_LOCK_TIME);
/* Read the volcfg lock sector again... */
- status = ocfs_read_bh(osb, lock_off, &bh, 0, NULL);
+ status = ocfs_read_block(osb,
+ lock_off >> osb->sb->s_blocksize_bits,
+ &bh, 0, NULL);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finito;
@@ -466,7 +469,7 @@
memset (bh->b_data, 0, osb->sb->s_blocksize);
/* Release the lock */
- status = ocfs_write_bh(osb, bh, NULL);
+ status = ocfs_write_block(osb, bh, NULL);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finally;
@@ -483,7 +486,7 @@
memset (bh->b_data, 0, osb->sb->s_blocksize);
/* Release the lock */
- status = ocfs_write_bh(osb, bh, NULL);
+ status = ocfs_write_block(osb, bh, NULL);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finally;
@@ -604,7 +607,7 @@
memcpy(bh->b_data, disk, osb->sb->s_blocksize);
- status = ocfs_write_bh(osb, bh, NULL);
+ status = ocfs_write_block(osb, bh, NULL);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finally;
@@ -692,7 +695,6 @@
ocfs_node_config_hdr *hdr = NULL;
ocfs_node_config_info *disk = NULL;
__s32 i;
- struct super_block *sb = osb->sb;
struct buffer_head **cfg_bhs = NULL;
LOG_ENTRY ();
@@ -707,10 +709,9 @@
}
memset(cfg_bhs, 0, osb->autoconfig_blocks * sizeof(*cfg_bhs));
- status = ocfs_read_bhs(osb,
- osb->autoconfig_blkno << sb->s_blocksize_bits,
- (u64)(osb->autoconfig_blocks) << sb->s_blocksize_bits,
- cfg_bhs, 0, NULL);
+ status = ocfs_read_blocks(osb, osb->autoconfig_blkno,
+ (osb->autoconfig_blocks), cfg_bhs, 0,
+ NULL);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finally;
More information about the Ocfs2-commits
mailing list