lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250313233341.1675324-16-dhowells@redhat.com>
Date: Thu, 13 Mar 2025 23:33:07 +0000
From: David Howells <dhowells@...hat.com>
To: Viacheslav Dubeyko <slava@...eyko.com>,
	Alex Markuze <amarkuze@...hat.com>
Cc: David Howells <dhowells@...hat.com>,
	Ilya Dryomov <idryomov@...il.com>,
	Jeff Layton <jlayton@...nel.org>,
	Dongsheng Yang <dongsheng.yang@...ystack.cn>,
	ceph-devel@...r.kernel.org,
	linux-fsdevel@...r.kernel.org,
	linux-block@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [RFC PATCH 15/35] libceph: Make osd_req_op_cls_init() use a ceph_databuf and map it

Make osd_req_op_cls_init() use a ceph_databuf to hold the request_info data
and then map it and write directly into it rather than using the databuf
encode functions.

Signed-off-by: David Howells <dhowells@...hat.com>
cc: Viacheslav Dubeyko <slava@...eyko.com>
cc: Alex Markuze <amarkuze@...hat.com>
cc: Ilya Dryomov <idryomov@...il.com>
cc: ceph-devel@...r.kernel.org
cc: linux-fsdevel@...r.kernel.org
---
 net/ceph/osd_client.c | 55 +++++++++++++++++--------------------------
 1 file changed, 22 insertions(+), 33 deletions(-)

diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 10f65e9b1906..405ccf7e7a91 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -245,14 +245,14 @@ void osd_req_op_extent_osd_iter(struct ceph_osd_request *osd_req,
 }
 EXPORT_SYMBOL(osd_req_op_extent_osd_iter);
 
-static void osd_req_op_cls_request_info_pagelist(
-			struct ceph_osd_request *osd_req,
-			unsigned int which, struct ceph_pagelist *pagelist)
+static void osd_req_op_cls_request_info_databuf(struct ceph_osd_request *osd_req,
+						unsigned int which,
+						struct ceph_databuf *dbuf)
 {
 	struct ceph_osd_data *osd_data;
 
 	osd_data = osd_req_op_data(osd_req, which, cls, request_info);
-	ceph_osd_data_pagelist_init(osd_data, pagelist);
+	ceph_osd_databuf_init(osd_data, dbuf);
 }
 
 void osd_req_op_cls_request_databuf(struct ceph_osd_request *osd_req,
@@ -778,42 +778,31 @@ int osd_req_op_cls_init(struct ceph_osd_request *osd_req, unsigned int which,
 			const char *class, const char *method)
 {
 	struct ceph_osd_req_op *op;
-	struct ceph_pagelist *pagelist;
-	size_t payload_len = 0;
-	size_t size;
-	int ret;
+	struct ceph_databuf *dbuf;
+	size_t csize = strlen(class), msize = strlen(method);
+	void *p;
+
+	BUG_ON(csize > (size_t) U8_MAX);
+	BUG_ON(msize > (size_t) U8_MAX);
 
 	op = osd_req_op_init(osd_req, which, CEPH_OSD_OP_CALL, 0);
+	op->cls.class_name = class;
+	op->cls.class_len  = csize;
+	op->cls.method_name = method;
+	op->cls.method_len  = msize;
 
-	pagelist = ceph_pagelist_alloc(GFP_NOFS);
-	if (!pagelist)
+	dbuf = ceph_databuf_req_alloc(1, PAGE_SIZE, GFP_NOFS);
+	if (!dbuf)
 		return -ENOMEM;
 
-	op->cls.class_name = class;
-	size = strlen(class);
-	BUG_ON(size > (size_t) U8_MAX);
-	op->cls.class_len = size;
-	ret = ceph_pagelist_append(pagelist, class, size);
-	if (ret)
-		goto err_pagelist_free;
-	payload_len += size;
-
-	op->cls.method_name = method;
-	size = strlen(method);
-	BUG_ON(size > (size_t) U8_MAX);
-	op->cls.method_len = size;
-	ret = ceph_pagelist_append(pagelist, method, size);
-	if (ret)
-		goto err_pagelist_free;
-	payload_len += size;
+	p = ceph_databuf_enc_start(dbuf);
+	ceph_encode_copy(&p, class, csize);
+	ceph_encode_copy(&p, method, msize);
+	ceph_databuf_enc_stop(dbuf, p);
 
-	osd_req_op_cls_request_info_pagelist(osd_req, which, pagelist);
-	op->indata_len = payload_len;
+	osd_req_op_cls_request_info_databuf(osd_req, which, dbuf);
+	op->indata_len = ceph_databuf_len(dbuf);
 	return 0;
-
-err_pagelist_free:
-	ceph_pagelist_release(pagelist);
-	return ret;
 }
 EXPORT_SYMBOL(osd_req_op_cls_init);
 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ