diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-26 16:38:50 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-26 16:38:50 -0400 |
| commit | ba5b56cb3e3d2cab73d4fee9a022bb69462a8cd9 (patch) | |
| tree | eda7ea059a41ae5d68e2ad5a36a87069187ef22a | |
| parent | 243dd2809a5edd2e0e3e62781083aa44049af37d (diff) | |
| parent | d79698da32b317e96216236f265a9b72b78ae568 (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
...
| -rw-r--r-- | drivers/block/rbd.c | 46 | ||||
| -rw-r--r-- | fs/ceph/debugfs.c | 2 | ||||
| -rw-r--r-- | fs/ceph/dir.c | 116 | ||||
| -rw-r--r-- | fs/ceph/export.c | 24 | ||||
| -rw-r--r-- | fs/ceph/file.c | 61 | ||||
| -rw-r--r-- | fs/ceph/inode.c | 48 | ||||
| -rw-r--r-- | fs/ceph/ioctl.c | 15 | ||||
| -rw-r--r-- | fs/ceph/ioctl.h | 1 | ||||
| -rw-r--r-- | fs/ceph/mds_client.c | 56 | ||||
| -rw-r--r-- | fs/ceph/mds_client.h | 3 | ||||
| -rw-r--r-- | fs/ceph/snap.c | 25 | ||||
| -rw-r--r-- | fs/ceph/super.c | 7 | ||||
| -rw-r--r-- | fs/ceph/super.h | 20 | ||||
| -rw-r--r-- | fs/ceph/xattr.c | 8 | ||||
| -rw-r--r-- | include/linux/ceph/messenger.h | 1 | ||||
| -rw-r--r-- | net/ceph/messenger.c | 12 | ||||
| -rw-r--r-- | net/ceph/osd_client.c | 6 |
17 files changed, 306 insertions, 145 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 | */ | ||
| 635 | static 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 | */ | ||
| 1267 | static 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 | |||
| 1256 | struct rbd_notify_info { | 1293 | struct 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 | ||
diff --git a/fs/ceph/debugfs.c b/fs/ceph/debugfs.c index 0dba6915712b..fb962efdacee 100644 --- a/fs/ceph/debugfs.c +++ b/fs/ceph/debugfs.c | |||
| @@ -102,7 +102,7 @@ static int mdsc_show(struct seq_file *s, void *p) | |||
| 102 | path = NULL; | 102 | path = NULL; |
| 103 | spin_lock(&req->r_old_dentry->d_lock); | 103 | spin_lock(&req->r_old_dentry->d_lock); |
| 104 | seq_printf(s, " #%llx/%.*s (%s)", | 104 | seq_printf(s, " #%llx/%.*s (%s)", |
| 105 | ceph_ino(req->r_old_dentry->d_parent->d_inode), | 105 | ceph_ino(req->r_old_dentry_dir), |
| 106 | req->r_old_dentry->d_name.len, | 106 | req->r_old_dentry->d_name.len, |
| 107 | req->r_old_dentry->d_name.name, | 107 | req->r_old_dentry->d_name.name, |
| 108 | path ? path : ""); | 108 | path ? path : ""); |
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index 1065ac779840..382abc9a6a54 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c | |||
| @@ -40,14 +40,6 @@ int ceph_init_dentry(struct dentry *dentry) | |||
| 40 | if (dentry->d_fsdata) | 40 | if (dentry->d_fsdata) |
| 41 | return 0; | 41 | return 0; |
| 42 | 42 | ||
| 43 | if (dentry->d_parent == NULL || /* nfs fh_to_dentry */ | ||
| 44 | ceph_snap(dentry->d_parent->d_inode) == CEPH_NOSNAP) | ||
| 45 | d_set_d_op(dentry, &ceph_dentry_ops); | ||
| 46 | else if (ceph_snap(dentry->d_parent->d_inode) == CEPH_SNAPDIR) | ||
| 47 | d_set_d_op(dentry, &ceph_snapdir_dentry_ops); | ||
| 48 | else | ||
| 49 | d_set_d_op(dentry, &ceph_snap_dentry_ops); | ||
| 50 | |||
| 51 | di = kmem_cache_alloc(ceph_dentry_cachep, GFP_NOFS | __GFP_ZERO); | 43 | di = kmem_cache_alloc(ceph_dentry_cachep, GFP_NOFS | __GFP_ZERO); |
| 52 | if (!di) | 44 | if (!di) |
| 53 | return -ENOMEM; /* oh well */ | 45 | return -ENOMEM; /* oh well */ |
| @@ -58,16 +50,42 @@ int ceph_init_dentry(struct dentry *dentry) | |||
| 58 | kmem_cache_free(ceph_dentry_cachep, di); | 50 | kmem_cache_free(ceph_dentry_cachep, di); |
| 59 | goto out_unlock; | 51 | goto out_unlock; |
| 60 | } | 52 | } |
| 53 | |||
| 54 | if (dentry->d_parent == NULL || /* nfs fh_to_dentry */ | ||
| 55 | ceph_snap(dentry->d_parent->d_inode) == CEPH_NOSNAP) | ||
| 56 | d_set_d_op(dentry, &ceph_dentry_ops); | ||
| 57 | else if (ceph_snap(dentry->d_parent->d_inode) == CEPH_SNAPDIR) | ||
| 58 | d_set_d_op(dentry, &ceph_snapdir_dentry_ops); | ||
| 59 | else | ||
| 60 | d_set_d_op(dentry, &ceph_snap_dentry_ops); | ||
| 61 | |||
| 61 | di->dentry = dentry; | 62 | di->dentry = dentry; |
| 62 | di->lease_session = NULL; | 63 | di->lease_session = NULL; |
| 63 | dentry->d_fsdata = di; | ||
| 64 | dentry->d_time = jiffies; | 64 | dentry->d_time = jiffies; |
| 65 | /* avoid reordering d_fsdata setup so that the check above is safe */ | ||
| 66 | smp_mb(); | ||
| 67 | dentry->d_fsdata = di; | ||
| 65 | ceph_dentry_lru_add(dentry); | 68 | ceph_dentry_lru_add(dentry); |
| 66 | out_unlock: | 69 | out_unlock: |
| 67 | spin_unlock(&dentry->d_lock); | 70 | spin_unlock(&dentry->d_lock); |
| 68 | return 0; | 71 | return 0; |
| 69 | } | 72 | } |
| 70 | 73 | ||
| 74 | struct inode *ceph_get_dentry_parent_inode(struct dentry *dentry) | ||
| 75 | { | ||
| 76 | struct inode *inode = NULL; | ||
| 77 | |||
| 78 | if (!dentry) | ||
| 79 | return NULL; | ||
| 80 | |||
| 81 | spin_lock(&dentry->d_lock); | ||
| 82 | if (dentry->d_parent) { | ||
| 83 | inode = dentry->d_parent->d_inode; | ||
| 84 | ihold(inode); | ||
| 85 | } | ||
| 86 | spin_unlock(&dentry->d_lock); | ||
| 87 | return inode; | ||
| 88 | } | ||
| 71 | 89 | ||
| 72 | 90 | ||
| 73 | /* | 91 | /* |
| @@ -133,7 +151,7 @@ more: | |||
| 133 | d_unhashed(d | ||
