Convert linger->notify_id_pages to a ceph_databuf Signed-off-by: David Howells <dhowells@xxxxxxxxxx> cc: Viacheslav Dubeyko <slava@xxxxxxxxxxx> cc: Alex Markuze <amarkuze@xxxxxxxxxx> cc: Ilya Dryomov <idryomov@xxxxxxxxx> cc: ceph-devel@xxxxxxxxxxxxxxx cc: linux-fsdevel@xxxxxxxxxxxxxxx --- include/linux/ceph/osd_client.h | 2 +- net/ceph/osd_client.c | 24 +++++++++++++----------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h index fe51c6ed23af..5ac4c0b4dfcd 100644 --- a/include/linux/ceph/osd_client.h +++ b/include/linux/ceph/osd_client.h @@ -349,7 +349,7 @@ struct ceph_osd_linger_request { void *data; struct ceph_pagelist *request_pl; - struct page **notify_id_pages; + struct ceph_databuf *notify_id_buf; struct page ***preply_pages; size_t *preply_len; diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index e1dbde4bf2b9..fc5c136e793d 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c @@ -2841,9 +2841,7 @@ static void linger_release(struct kref *kref) if (lreq->request_pl) ceph_pagelist_release(lreq->request_pl); - if (lreq->notify_id_pages) - ceph_release_page_vector(lreq->notify_id_pages, 1); - + ceph_databuf_release(lreq->notify_id_buf); ceph_osdc_put_request(lreq->reg_req); ceph_osdc_put_request(lreq->ping_req); target_destroy(&lreq->t); @@ -3128,10 +3126,13 @@ static void linger_commit_cb(struct ceph_osd_request *req) if (!lreq->is_watch) { struct ceph_osd_data *osd_data = osd_req_op_data(req, 0, notify, response_data); - void *p = page_address(osd_data->pages[0]); + struct ceph_databuf *notify_id_buf = lreq->notify_id_buf; + void *p; WARN_ON(req->r_ops[0].op != CEPH_OSD_OP_NOTIFY || - osd_data->type != CEPH_OSD_DATA_TYPE_PAGES); + osd_data->type != CEPH_OSD_DATA_TYPE_DATABUF); + + p = kmap_ceph_databuf_page(notify_id_buf, 0); /* make note of the notify_id */ if (req->r_ops[0].outdata_len >= sizeof(u64)) { @@ -3141,6 +3142,8 @@ static void linger_commit_cb(struct ceph_osd_request *req) } else { dout("lreq %p no notify_id\n", lreq); } + + kunmap_local(p); } out: @@ -3224,9 +3227,9 @@ static void send_linger(struct ceph_osd_linger_request *lreq) refcount_inc(&lreq->request_pl->refcnt); osd_req_op_notify_init(req, 0, lreq->linger_id, lreq->request_pl); - ceph_osd_data_pages_init( + ceph_osd_databuf_init( osd_req_op_data(req, 0, notify, response_data), - lreq->notify_id_pages, PAGE_SIZE, 0, false, false); + ceph_databuf_get(lreq->notify_id_buf)); } dout("lreq %p register\n", lreq); req->r_callback = linger_commit_cb; @@ -5016,10 +5019,9 @@ int ceph_osdc_notify(struct ceph_osd_client *osdc, } /* for notify_id */ - lreq->notify_id_pages = ceph_alloc_page_vector(1, GFP_NOIO); - if (IS_ERR(lreq->notify_id_pages)) { - ret = PTR_ERR(lreq->notify_id_pages); - lreq->notify_id_pages = NULL; + lreq->notify_id_buf = ceph_databuf_reply_alloc(1, PAGE_SIZE, GFP_NOIO); + if (!lreq->notify_id_buf) { + ret = -ENOMEM; goto out_put_lreq; }