Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 347568
b: refs/heads/master
c: ff2e4bb
h: refs/heads/master
v: v3
  • Loading branch information
Alex Elder committed Oct 26, 2012
1 parent 5e23228 commit 5910e49
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 13f4042c05b6a1a638ccab3f0cabdb84993803a2
refs/heads/master: ff2e4bb5b32f89c455979a4222a9b78007cde254
18 changes: 11 additions & 7 deletions trunk/drivers/block/rbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,6 @@ static int rbd_do_op(struct request *rq,
struct rbd_device *rbd_dev,
struct ceph_snap_context *snapc,
u64 snapid,
int opcode, int flags,
u64 ofs, u64 len,
struct bio *bio,
struct rbd_req_coll *coll,
Expand All @@ -1176,14 +1175,24 @@ static int rbd_do_op(struct request *rq,
int ret;
struct ceph_osd_req_op *ops;
u32 payload_len;
int opcode;
int flags;

seg_name = rbd_segment_name(rbd_dev, ofs);
if (!seg_name)
return -ENOMEM;
seg_len = rbd_segment_length(rbd_dev, ofs, len);
seg_ofs = rbd_segment_offset(rbd_dev, ofs);

payload_len = (flags & CEPH_OSD_FLAG_WRITE ? seg_len : 0);
if (rq_data_dir(rq) == WRITE) {
opcode = CEPH_OSD_OP_WRITE;
flags = CEPH_OSD_FLAG_WRITE|CEPH_OSD_FLAG_ONDISK;
payload_len = seg_len;
} else {
opcode = CEPH_OSD_OP_READ;
flags = CEPH_OSD_FLAG_READ;
payload_len = 0;
}

ret = -ENOMEM;
ops = rbd_create_rw_ops(1, opcode, payload_len);
Expand Down Expand Up @@ -1519,16 +1528,11 @@ static void rbd_rq_fn(struct request_queue *q)
if (do_write)
(void) rbd_do_op(rq, rbd_dev,
snapc, CEPH_NOSNAP,
CEPH_OSD_OP_WRITE,
CEPH_OSD_FLAG_WRITE |
CEPH_OSD_FLAG_ONDISK,
ofs, op_size, bio,
coll, cur_seg);
else
(void) rbd_do_op(rq, rbd_dev,
NULL, rbd_dev->mapping.snap_id,
CEPH_OSD_OP_READ,
CEPH_OSD_FLAG_READ,
ofs, op_size, bio,
coll, cur_seg);
next_seg:
Expand Down

0 comments on commit 5910e49

Please sign in to comment.