Skip to content

Commit 95288a9

Browse files
committed
Merge tag 'ceph-for-5.8-rc1' of git://github.com/ceph/ceph-client
Pull ceph updates from Ilya Dryomov: "The highlights are: - OSD/MDS latency and caps cache metrics infrastructure for the filesytem (Xiubo Li). Currently available through debugfs and will be periodically sent to the MDS in the future. - support for replica reads (balanced and localized reads) for rbd and the filesystem (myself). The default remains to always read from primary, users can opt-in with the new crush_location and read_from_replica options. Note that reading from replica is safe for general use only since Octopus. - support for RADOS allocation hint flags (myself). Currently used by rbd to propagate the compressible/incompressible hint given with the new compression_hint map option and ready for passing on more advanced hints, e.g. based on fadvise() from the filesystem. - support for efficient cross-quota-realm renames (Luis Henriques) - assorted cap handling improvements and cleanups, particularly untangling some of the locking (Jeff Layton)" * tag 'ceph-for-5.8-rc1' of git://github.com/ceph/ceph-client: (29 commits) rbd: compression_hint option libceph: support for alloc hint flags libceph: read_from_replica option libceph: support for balanced and localized reads libceph: crush_location infrastructure libceph: decode CRUSH device/bucket types and names libceph: add non-asserting rbtree insertion helper ceph: skip checking caps when session reconnecting and releasing reqs ceph: make sure mdsc->mutex is nested in s->s_mutex to fix dead lock ceph: don't return -ESTALE if there's still an open file libceph, rbd: replace zero-length array with flexible-array ceph: allow rename operation under different quota realms ceph: normalize 'delta' parameter usage in check_quota_exceeded ceph: ceph_kick_flushing_caps needs the s_mutex ceph: request expedited service on session's last cap flush ceph: convert mdsc->cap_dirty to a per-session list ceph: reset i_requested_max_size if file write is not wanted ceph: throw a warning if we destroy session with mutex still locked ceph: fix potential race in ceph_check_caps ceph: document what protects i_dirty_item and i_flushing_item ...
2 parents ca68787 + dc1dad8 commit 95288a9

29 files changed

Lines changed: 1405 additions & 252 deletions

‎drivers/block/rbd.c‎

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -836,6 +836,7 @@ enum {
836836
Opt_lock_timeout,
837837
/* int args above */
838838
Opt_pool_ns,
839+
Opt_compression_hint,
839840
/* string args above */
840841
Opt_read_only,
841842
Opt_read_write,
@@ -844,8 +845,23 @@ enum {
844845
Opt_notrim,
845846
};
846847

848+
enum {
849+
Opt_compression_hint_none,
850+
Opt_compression_hint_compressible,
851+
Opt_compression_hint_incompressible,
852+
};
853+
854+
static const struct constant_table rbd_param_compression_hint[] = {
855+
{"none", Opt_compression_hint_none},
856+
{"compressible", Opt_compression_hint_compressible},
857+
{"incompressible", Opt_compression_hint_incompressible},
858+
{}
859+
};
860+
847861
static const struct fs_parameter_spec rbd_parameters[] = {
848862
fsparam_u32 ("alloc_size", Opt_alloc_size),
863+
fsparam_enum ("compression_hint", Opt_compression_hint,
864+
rbd_param_compression_hint),
849865
fsparam_flag ("exclusive", Opt_exclusive),
850866
fsparam_flag ("lock_on_read", Opt_lock_on_read),
851867
fsparam_u32 ("lock_timeout", Opt_lock_timeout),
@@ -867,6 +883,8 @@ struct rbd_options {
867883
bool lock_on_read;
868884
bool exclusive;
869885
bool trim;
886+
887+
u32 alloc_hint_flags; /* CEPH_OSD_OP_ALLOC_HINT_FLAG_* */
870888
};
871889

872890
#define RBD_QUEUE_DEPTH_DEFAULT BLKDEV_MAX_RQ
@@ -2253,7 +2271,8 @@ static void __rbd_osd_setup_write_ops(struct ceph_osd_request *osd_req,
22532271
!(obj_req->flags & RBD_OBJ_FLAG_MAY_EXIST)) {
22542272
osd_req_op_alloc_hint_init(osd_req, which++,
22552273
rbd_dev->layout.object_size,
2256-
rbd_dev->layout.object_size);
2274+
rbd_dev->layout.object_size,
2275+
rbd_dev->opts->alloc_hint_flags);
22572276
}
22582277

22592278
if (rbd_obj_is_entire(obj_req))
@@ -6331,6 +6350,29 @@ static int rbd_parse_param(struct fs_parameter *param,
63316350
pctx->spec->pool_ns = param->string;
63326351
param->string = NULL;
63336352
break;
6353+
case Opt_compression_hint:
6354+
switch (result.uint_32) {
6355+
case Opt_compression_hint_none:
6356+
opt->alloc_hint_flags &=
6357+
~(CEPH_OSD_ALLOC_HINT_FLAG_COMPRESSIBLE |
6358+
CEPH_OSD_ALLOC_HINT_FLAG_INCOMPRESSIBLE);
6359+
break;
6360+
case Opt_compression_hint_compressible:
6361+
opt->alloc_hint_flags |=
6362+
CEPH_OSD_ALLOC_HINT_FLAG_COMPRESSIBLE;
6363+
opt->alloc_hint_flags &=
6364+
~CEPH_OSD_ALLOC_HINT_FLAG_INCOMPRESSIBLE;
6365+
break;
6366+
case Opt_compression_hint_incompressible:
6367+
opt->alloc_hint_flags |=
6368+
CEPH_OSD_ALLOC_HINT_FLAG_INCOMPRESSIBLE;
6369+
opt->alloc_hint_flags &=
6370+
~CEPH_OSD_ALLOC_HINT_FLAG_COMPRESSIBLE;
6371+
break;
6372+
default:
6373+
BUG();
6374+
}
6375+
break;
63346376
case Opt_read_only:
63356377
opt->read_only = true;
63366378
break;

‎drivers/block/rbd_types.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ struct rbd_image_header_ondisk {
9393
__le32 snap_count;
9494
__le32 reserved;
9595
__le64 snap_names_len;
96-
struct rbd_image_snap_ondisk snaps[0];
96+
struct rbd_image_snap_ondisk snaps[];
9797
} __attribute__((packed));
9898

9999

‎fs/ceph/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ obj-$(CONFIG_CEPH_FS) += ceph.o
88
ceph-y := super.o inode.o dir.o file.o locks.o addr.o ioctl.o \
99
export.o caps.o snap.o xattr.o quota.o io.o \
1010
mds_client.o mdsmap.o strings.o ceph_frag.o \
11-
debugfs.o util.o
11+
debugfs.o util.o metric.o
1212

1313
ceph-$(CONFIG_CEPH_FSCACHE) += cache.o
1414
ceph-$(CONFIG_CEPH_FS_POSIX_ACL) += acl.o

‎fs/ceph/acl.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ static inline void ceph_set_cached_acl(struct inode *inode,
2222
struct ceph_inode_info *ci = ceph_inode(inode);
2323

2424
spin_lock(&ci->i_ceph_lock);
25-
if (__ceph_caps_issued_mask(ci, CEPH_CAP_XATTR_SHARED, 0))
25+
if (__ceph_caps_issued_mask_metric(ci, CEPH_CAP_XATTR_SHARED, 0))
2626
set_cached_acl(inode, type, acl);
2727
else
2828
forget_cached_acl(inode, type);

‎fs/ceph/addr.c‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@
1111
#include <linux/task_io_accounting_ops.h>
1212
#include <linux/signal.h>
1313
#include <linux/iversion.h>
14+
#include <linux/ktime.h>
1415

1516
#include "super.h"
1617
#include "mds_client.h"
1718
#include "cache.h"
19+
#include "metric.h"
1820
#include <linux/ceph/osd_client.h>
1921
#include <linux/ceph/striper.h>
2022

@@ -216,6 +218,9 @@ static int ceph_sync_readpages(struct ceph_fs_client *fsc,
216218
if (!rc)
217219
rc = ceph_osdc_wait_request(osdc, req);
218220

221+
ceph_update_read_latency(&fsc->mdsc->metric, req->r_start_latency,
222+
req->r_end_latency, rc);
223+
219224
ceph_osdc_put_request(req);
220225
dout("readpages result %d\n", rc);
221226
return rc;
@@ -299,6 +304,7 @@ static int ceph_readpage(struct file *filp, struct page *page)
299304
static void finish_read(struct ceph_osd_request *req)
300305
{
301306
struct inode *inode = req->r_inode;
307+
struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
302308
struct ceph_osd_data *osd_data;
303309
int rc = req->r_result <= 0 ? req->r_result : 0;
304310
int bytes = req->r_result >= 0 ? req->r_result : 0;
@@ -336,6 +342,10 @@ static void finish_read(struct ceph_osd_request *req)
336342
put_page(page);
337343
bytes -= PAGE_SIZE;
338344
}
345+
346+
ceph_update_read_latency(&fsc->mdsc->metric, req->r_start_latency,
347+
req->r_end_latency, rc);
348+
339349
kfree(osd_data->pages);
340350
}
341351

@@ -643,6 +653,9 @@ static int ceph_sync_writepages(struct ceph_fs_client *fsc,
643653
if (!rc)
644654
rc = ceph_osdc_wait_request(osdc, req);
645655

656+
ceph_update_write_latency(&fsc->mdsc->metric, req->r_start_latency,
657+
req->r_end_latency, rc);
658+
646659
ceph_osdc_put_request(req);
647660
if (rc == 0)
648661
rc = len;
@@ -794,6 +807,9 @@ static void writepages_finish(struct ceph_osd_request *req)
794807
ceph_clear_error_write(ci);
795808
}
796809

810+
ceph_update_write_latency(&fsc->mdsc->metric, req->r_start_latency,
811+
req->r_end_latency, rc);
812+
797813
/*
798814
* We lost the cache cap, need to truncate the page before
799815
* it is unlocked, otherwise we'd truncate it later in the
@@ -1852,6 +1868,10 @@ int ceph_uninline_data(struct file *filp, struct page *locked_page)
18521868
err = ceph_osdc_start_request(&fsc->client->osdc, req, false);
18531869
if (!err)
18541870
err = ceph_osdc_wait_request(&fsc->client->osdc, req);
1871+
1872+
ceph_update_write_latency(&fsc->mdsc->metric, req->r_start_latency,
1873+
req->r_end_latency, err);
1874+
18551875
out_put:
18561876
ceph_osdc_put_request(req);
18571877
if (err == -ECANCELED)

0 commit comments

Comments
 (0)