From: Sage Weil Date: Wed, 2 Apr 2008 18:31:16 +0000 (-0700) Subject: kclient: minor cleanup X-Git-Tag: v0.2~225 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=48bd6928a2721c6b964607d0d99fe3fe8da34719;p=ceph.git kclient: minor cleanup --- diff --git a/src/kernel/osd_client.c b/src/kernel/osd_client.c index 7b290f8aeec..604099bf427 100644 --- a/src/kernel/osd_client.c +++ b/src/kernel/osd_client.c @@ -353,6 +353,11 @@ int do_request(struct ceph_osd_client *osdc, struct ceph_osd_request *req) return bytes; } +/* + * calculate the mapping of an extent onto an object, and fill out the + * request accordingly. shorten extent as necessary if it hits an + * object boundary. + */ __u64 calc_layout(struct ceph_osd_client *osdc, ceph_ino_t ino, struct ceph_file_layout *layout, __u64 off, __u64 len, @@ -382,7 +387,9 @@ __u64 calc_layout(struct ceph_osd_client *osdc, return len; } - +/* + * synchronous read direct to user buffer + */ int ceph_osdc_sync_read(struct ceph_osd_client *osdc, ceph_ino_t ino, struct ceph_file_layout *layout, __u64 off, __u64 len, @@ -446,7 +453,6 @@ int ceph_osdc_sync_read(struct ceph_osd_client *osdc, ceph_ino_t ino, return rc; } - /* * read a single page. */ @@ -611,10 +617,10 @@ int ceph_osdc_sync_write(struct ceph_osd_client *osdc, ceph_ino_t ino, rc = do_request(osdc, req); put_request(req); + if (rc == 0) + rc = len; dout(10, "sync_write result %d\n", rc); - if (rc < 0) - return rc; - return len; + return rc; } /* @@ -656,11 +662,10 @@ int ceph_osdc_writepages(struct ceph_osd_client *osdc, ceph_ino_t ino, rc = do_request(osdc, req); put_request(req); + if (rc == 0) + rc = len; dout(10, "writepages result %d\n", rc); - if (rc < 0) - return rc; - return len; - + return rc; }