[PATCH 1/3] rbd: skip the copyup when an entire object writing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It need to copyup the parent's content when layered writing,
but an entire object write would overwrite it, so skip it.

Signed-off-by: Guangliang Zhao <lucienchao@xxxxxxxxx>
---
 drivers/block/rbd.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index b365e0d..965b9b9 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -2629,12 +2629,14 @@ static int rbd_img_obj_request_submit(struct rbd_obj_request *obj_request)
 	struct rbd_img_request *img_request;
 	struct rbd_device *rbd_dev;
 	bool known;
+	u64 obj_size;
 
 	rbd_assert(obj_request_img_data_test(obj_request));
 
 	img_request = obj_request->img_request;
 	rbd_assert(img_request);
 	rbd_dev = img_request->rbd_dev;
+	obj_size = (u64) 1 << rbd_dev->header.obj_order;
 
 	/*
 	 * Only writes to layered images need special handling.
@@ -2644,11 +2646,15 @@ static int rbd_img_obj_request_submit(struct rbd_obj_request *obj_request)
 	 * simple object requests.  Finally, if the target object is
 	 * known to already exist, its parent data has already been
 	 * copied, so a write to the object can also be handled as a
-	 * simple object request.
+	 * simple object request. Another type: if the obj_request
+	 * aligns with the boundary and equals to the size of an object,
+	 * it doesn't need copyup, because the obj_request will overwrite
+	 * it finally.
 	 */
 	if (!img_request_write_test(img_request) ||
 		!img_request_layered_test(img_request) ||
 		rbd_dev->parent_overlap <= obj_request->img_offset ||
+		((!obj_request->offset) && (obj_request->length == obj_size)) ||
 		((known = obj_request_known_test(obj_request)) &&
 			obj_request_exists_test(obj_request))) {
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux