aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2012-10-10 21:59:29 -0400
committerAlex Elder <elder@inktank.com>2012-10-26 18:18:08 -0400
commitff2e4bb5b32f89c455979a4222a9b78007cde254 (patch)
treeb50576687902d04a47ab1a9347f054a55b05ebce /drivers/block
parent13f4042c05b6a1a638ccab3f0cabdb84993803a2 (diff)
rbd: drop rbd_do_op() opcode and flags
The only callers of rbd_do_op() are in rbd_rq_fn(), where call one is used for writes and the other used for reads. The request passed to rbd_do_op() already encodes the I/O direction, and that information can be used inside the function to set the opcode and flags value (rather than passing them in as arguments). So get rid of the opcode and flags arguments to rbd_do_op(). Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/rbd.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 8f2c39ad3bb0..a29c6d2a49ad 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -1164,7 +1164,6 @@ static int rbd_do_op(struct request *rq,
1164 struct rbd_device *rbd_dev, 1164 struct rbd_device *rbd_dev,
1165 struct ceph_snap_context *snapc, 1165 struct ceph_snap_context *snapc,
1166 u64 snapid, 1166 u64 snapid,
1167 int opcode, int flags,
1168 u64 ofs, u64 len, 1167 u64 ofs, u64 len,
1169 struct bio *bio, 1168 struct bio *bio,
1170 struct rbd_req_coll *coll, 1169 struct rbd_req_coll *coll,
@@ -1176,6 +1175,8 @@ static int rbd_do_op(struct request *rq,
1176 int ret; 1175 int ret;
1177 struct ceph_osd_req_op *ops; 1176 struct ceph_osd_req_op *ops;
1178 u32 payload_len; 1177 u32 payload_len;
1178 int opcode;
1179 int flags;
1179 1180
1180 seg_name = rbd_segment_name(rbd_dev, ofs); 1181 seg_name = rbd_segment_name(rbd_dev, ofs);
1181 if (!seg_name) 1182 if (!seg_name)
@@ -1183,7 +1184,15 @@ static int rbd_do_op(struct request *rq,
1183 seg_len = rbd_segment_length(rbd_dev, ofs, len); 1184 seg_len = rbd_segment_length(rbd_dev, ofs, len);
1184 seg_ofs = rbd_segment_offset(rbd_dev, ofs); 1185 seg_ofs = rbd_segment_offset(rbd_dev, ofs);
1185 1186
1186 payload_len = (flags & CEPH_OSD_FLAG_WRITE ? seg_len : 0); 1187 if (rq_data_dir(rq) == WRITE) {
1188 opcode = CEPH_OSD_OP_WRITE;
1189 flags = CEPH_OSD_FLAG_WRITE|CEPH_OSD_FLAG_ONDISK;
1190 payload_len = seg_len;
1191 } else {
1192 opcode = CEPH_OSD_OP_READ;
1193 flags = CEPH_OSD_FLAG_READ;
1194 payload_len = 0;
1195 }
1187 1196
1188 ret = -ENOMEM; 1197 ret = -ENOMEM;
1189 ops = rbd_create_rw_ops(1, opcode, payload_len); 1198 ops = rbd_create_rw_ops(1, opcode, payload_len);
@@ -1519,16 +1528,11 @@ static void rbd_rq_fn(struct request_queue *q)
1519 if (do_write) 1528 if (do_write)
1520 (void) rbd_do_op(rq, rbd_dev, 1529 (void) rbd_do_op(rq, rbd_dev,
1521 snapc, CEPH_NOSNAP, 1530 snapc, CEPH_NOSNAP,
1522 CEPH_OSD_OP_WRITE,
1523 CEPH_OSD_FLAG_WRITE |
1524 CEPH_OSD_FLAG_ONDISK,
1525 ofs, op_size, bio, 1531 ofs, op_size, bio,
1526 coll, cur_seg); 1532 coll, cur_seg);
1527 else 1533 else
1528 (void) rbd_do_op(rq, rbd_dev, 1534 (void) rbd_do_op(rq, rbd_dev,
1529 NULL, rbd_dev->mapping.snap_id, 1535 NULL, rbd_dev->mapping.snap_id,
1530 CEPH_OSD_OP_READ,
1531 CEPH_OSD_FLAG_READ,
1532 ofs, op_size, bio, 1536 ofs, op_size, bio,
1533 coll, cur_seg); 1537 coll, cur_seg);
1534next_seg: 1538next_seg: