rbd: skip the copyup when an entire object writing
authorGuangliang Zhao <lucienchao@gmail.com>
Tue, 1 Apr 2014 14:22:15 +0000 (22:22 +0800)
committerIlya Dryomov <idryomov@redhat.com>
Tue, 14 Oct 2014 17:03:29 +0000 (21:03 +0400)
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@gmail.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Reviewed-by: Alex Elder <elder@linaro.org>
drivers/block/rbd.c

index 6dae658..16eb247 100644 (file)
@@ -2770,6 +2770,14 @@ static bool img_obj_request_simple(struct rbd_obj_request *obj_request)
                return true;
 
        /*
+        * Entire-object layered writes - we will overwrite whatever
+        * parent data there is anyway.
+        */
+       if (!obj_request->offset &&
+           obj_request->length == rbd_obj_bytes(&rbd_dev->header))
+               return true;
+
+       /*
         * If the object is known to already exist, its parent data has
         * already been copied.
         */