From 48bd6928a2721c6b964607d0d99fe3fe8da34719 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 2 Apr 2008 11:31:16 -0700 Subject: [PATCH] kclient: minor cleanup --- src/kernel/osd_client.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/kernel/osd_client.c b/src/kernel/osd_client.c index 7b290f8aeecb9..604099bf427c7 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; } -- 2.39.5