mirror of
https://github.com/torvalds/linux.git
synced 2026-06-03 20:14:06 +02:00
libceph: pass reply buffer length through ceph_osdc_call()
To spare checking for "this reply fits into a page, but does it fit into my buffer?" in some callers, osd_req_op_cls_response_data_pages() needs to know how big it is. Signed-off-by: Ilya Dryomov <idryomov@gmail.com> Reviewed-by: Jason Dillaman <dillaman@redhat.com>
This commit is contained in:
parent
fe5478e0f6
commit
2544a02090
|
|
@ -278,7 +278,7 @@ int ceph_cls_lock_info(struct ceph_osd_client *osdc,
|
||||||
int get_info_op_buf_size;
|
int get_info_op_buf_size;
|
||||||
int name_len = strlen(lock_name);
|
int name_len = strlen(lock_name);
|
||||||
struct page *get_info_op_page, *reply_page;
|
struct page *get_info_op_page, *reply_page;
|
||||||
size_t reply_len;
|
size_t reply_len = PAGE_SIZE;
|
||||||
void *p, *end;
|
void *p, *end;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4023,7 +4023,7 @@ EXPORT_SYMBOL(ceph_osdc_maybe_request_map);
|
||||||
* Execute an OSD class method on an object.
|
* Execute an OSD class method on an object.
|
||||||
*
|
*
|
||||||
* @flags: CEPH_OSD_FLAG_*
|
* @flags: CEPH_OSD_FLAG_*
|
||||||
* @resp_len: out param for reply length
|
* @resp_len: in/out param for reply length
|
||||||
*/
|
*/
|
||||||
int ceph_osdc_call(struct ceph_osd_client *osdc,
|
int ceph_osdc_call(struct ceph_osd_client *osdc,
|
||||||
struct ceph_object_id *oid,
|
struct ceph_object_id *oid,
|
||||||
|
|
@ -4036,6 +4036,9 @@ int ceph_osdc_call(struct ceph_osd_client *osdc,
|
||||||
struct ceph_osd_request *req;
|
struct ceph_osd_request *req;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
if (req_len > PAGE_SIZE || (resp_page && *resp_len > PAGE_SIZE))
|
||||||
|
return -E2BIG;
|
||||||
|
|
||||||
req = ceph_osdc_alloc_request(osdc, NULL, 1, false, GFP_NOIO);
|
req = ceph_osdc_alloc_request(osdc, NULL, 1, false, GFP_NOIO);
|
||||||
if (!req)
|
if (!req)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
@ -4054,7 +4057,7 @@ int ceph_osdc_call(struct ceph_osd_client *osdc,
|
||||||
0, false, false);
|
0, false, false);
|
||||||
if (resp_page)
|
if (resp_page)
|
||||||
osd_req_op_cls_response_data_pages(req, 0, &resp_page,
|
osd_req_op_cls_response_data_pages(req, 0, &resp_page,
|
||||||
PAGE_SIZE, 0, false, false);
|
*resp_len, 0, false, false);
|
||||||
|
|
||||||
ceph_osdc_start_request(osdc, req, false);
|
ceph_osdc_start_request(osdc, req, false);
|
||||||
ret = ceph_osdc_wait_request(osdc, req);
|
ret = ceph_osdc_wait_request(osdc, req);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user