aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-07-26 16:38:50 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-07-26 16:38:50 -0400
commitba5b56cb3e3d2cab73d4fee9a022bb69462a8cd9 (patch)
treeeda7ea059a41ae5d68e2ad5a36a87069187ef22a /drivers/block
parent243dd2809a5edd2e0e3e62781083aa44049af37d (diff)
parentd79698da32b317e96216236f265a9b72b78ae568 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client: (23 commits) ceph: document unlocked d_parent accesses ceph: explicitly reference rename old_dentry parent dir in request ceph: document locking for ceph_set_dentry_offset ceph: avoid d_parent in ceph_dentry_hash; fix ceph_encode_fh() hashing bug ceph: protect d_parent access in ceph_d_revalidate ceph: protect access to d_parent ceph: handle racing calls to ceph_init_dentry ceph: set dir complete frag after adding capability rbd: set blk_queue request sizes to object size ceph: set up readahead size when rsize is not passed rbd: cancel watch request when releasing the device ceph: ignore lease mask ceph: fix ceph_lookup_open intent usage ceph: only link open operations to directory unsafe list if O_CREAT|O_TRUNC ceph: fix bad parent_inode calc in ceph_lookup_open ceph: avoid carrying Fw cap during write into page cache libceph: don't time out osd requests that haven't been received ceph: report f_bfree based on kb_avail rather than diffing. ceph: only queue capsnap if caps are dirty ceph: fix snap writeback when racing with writes ...
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/rbd.c46
1 files changed, 45 insertions, 1 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 1278098624e6..15f65b5f3fc7 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -630,6 +630,14 @@ static int rbd_get_num_segments(struct rbd_image_header *header,
630} 630}
631 631
632/* 632/*
633 * returns the size of an object in the image
634 */
635static u64 rbd_obj_bytes(struct rbd_image_header *header)
636{
637 return 1 << header->obj_order;
638}
639
640/*
633 * bio helpers 641 * bio helpers
634 */ 642 */
635 643
@@ -1253,6 +1261,35 @@ fail:
1253 return ret; 1261 return ret;
1254} 1262}
1255 1263
1264/*
1265 * Request sync osd unwatch
1266 */
1267static int rbd_req_sync_unwatch(struct rbd_device *dev,
1268 const char *obj)
1269{
1270 struct ceph_osd_req_op *ops;
1271
1272 int ret = rbd_create_rw_ops(&ops, 1, CEPH_OSD_OP_WATCH, 0);
1273 if (ret < 0)
1274 return ret;
1275
1276 ops[0].watch.ver = 0;
1277 ops[0].watch.cookie = cpu_to_le64(dev->watch_event->cookie);
1278 ops[0].watch.flag = 0;
1279
1280 ret = rbd_req_sync_op(dev, NULL,
1281 CEPH_NOSNAP,
1282 0,
1283 CEPH_OSD_FLAG_WRITE | CEPH_OSD_FLAG_ONDISK,
1284 ops,
1285 1, obj, 0, 0, NULL, NULL, NULL);
1286
1287 rbd_destroy_ops(ops);
1288 ceph_osdc_cancel_event(dev->watch_event);
1289 dev->watch_event = NULL;
1290 return ret;
1291}
1292
1256struct rbd_notify_info { 1293struct rbd_notify_info {
1257 struct rbd_device *dev; 1294 struct rbd_device *dev;
1258}; 1295};
@@ -1736,6 +1773,13 @@ static int rbd_init_disk(struct rbd_device *rbd_dev)
1736 q = blk_init_queue(rbd_rq_fn, &rbd_dev->lock); 1773 q = blk_init_queue(rbd_rq_fn, &rbd_dev->lock);
1737 if (!q) 1774 if (!q)
1738 goto out_disk; 1775 goto out_disk;
1776
1777 /* set io sizes to object size */
1778 blk_queue_max_hw_sectors(q, rbd_obj_bytes(&rbd_dev->header) / 512ULL);
1779 blk_queue_max_segment_size(q, rbd_obj_bytes(&rbd_dev->header));
1780 blk_queue_io_min(q, rbd_obj_bytes(&rbd_dev->header));
1781 blk_queue_io_opt(q, rbd_obj_bytes(&rbd_dev->header));
1782
1739 blk_queue_merge_bvec(q, rbd_merge_bvec); 1783 blk_queue_merge_bvec(q, rbd_merge_bvec);
1740 disk->queue = q; 1784 disk->queue = q;
1741 1785
@@ -2290,7 +2334,7 @@ static void rbd_dev_release(struct device *dev)
2290 ceph_osdc_unregister_linger_request(&rbd_dev->client->osdc, 2334 ceph_osdc_unregister_linger_request(&rbd_dev->client->osdc,
2291 rbd_dev->watch_request); 2335 rbd_dev->watch_request);
2292 if (rbd_dev->watch_event) 2336 if (rbd_dev->watch_event)
2293 ceph_osdc_cancel_event(rbd_dev->watch_event); 2337 rbd_req_sync_unwatch(rbd_dev, rbd_dev->obj_md_name);
2294 2338
2295 rbd_put_client(rbd_dev); 2339 rbd_put_client(rbd_dev);
2296 2340