Because call bio_alloc, the bi_rw is zero by default,but in
bio_add_page used the bi_rw. So evalue bi_rw.

Signed-off-by: Jianpeng Ma <[email protected]>
---
 fs/ocfs2/cluster/heartbeat.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
index a4e855e..50079d3 100644
--- a/fs/ocfs2/cluster/heartbeat.c
+++ b/fs/ocfs2/cluster/heartbeat.c
@@ -399,7 +399,8 @@ static void o2hb_bio_end_io(struct bio *bio,
 static struct bio *o2hb_setup_one_bio(struct o2hb_region *reg,
                                      struct o2hb_bio_wait_ctxt *wc,
                                      unsigned int *current_slot,
-                                     unsigned int max_slots)
+                                     unsigned int max_slots,
+                                     int rw)
 {
        int len, current_page;
        unsigned int vec_len, vec_start;
@@ -425,6 +426,7 @@ static struct bio *o2hb_setup_one_bio(struct o2hb_region 
*reg,
        bio->bi_bdev = reg->hr_bdev;
        bio->bi_private = wc;
        bio->bi_end_io = o2hb_bio_end_io;
+       bio->bi_rw = rw;
 
        vec_start = (cs << bits) % PAGE_CACHE_SIZE;
        while(cs < max_slots) {
@@ -460,7 +462,7 @@ static int o2hb_read_slots(struct o2hb_region *reg,
        o2hb_bio_wait_init(&wc);
 
        while(current_slot < max_slots) {
-               bio = o2hb_setup_one_bio(reg, &wc, &current_slot, max_slots);
+               bio = o2hb_setup_one_bio(reg, &wc, &current_slot, max_slots, 
READ);
                if (IS_ERR(bio)) {
                        status = PTR_ERR(bio);
                        mlog_errno(status);
@@ -492,7 +494,7 @@ static int o2hb_issue_node_write(struct o2hb_region *reg,
 
        slot = o2nm_this_node();
 
-       bio = o2hb_setup_one_bio(reg, write_wc, &slot, slot+1);
+       bio = o2hb_setup_one_bio(reg, write_wc, &slot, slot+1, WRITE);
        if (IS_ERR(bio)) {
                status = PTR_ERR(bio);
                mlog_errno(status);
-- 
1.7.9.5
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Jfs-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jfs-discussion

Reply via email to