diff options
| author | Yan, Zheng <zyan@redhat.com> | 2015-04-12 23:25:07 -0400 |
|---|---|---|
| committer | Ilya Dryomov <idryomov@gmail.com> | 2015-04-22 11:33:41 -0400 |
| commit | ec137c10e720e5cf085504332ee1bf380241ed69 (patch) | |
| tree | 06f4058a2b06b763467c945b0b4b36c4c9f56369 /fs | |
| parent | 0ea611a3bc5fb8f6a0bb1a76fe2dbf8ebe4bdf77 (diff) | |
ceph: fix uninline data function
For CEPH_OSD_CMPXATTR_MODE_U64, OSD expects the u64 to be encoded
as string in object's xattr.
Signed-off-by: Yan, Zheng <zyan@redhat.com>
Diffstat (limited to 'fs')
| -rw-r--r-- | fs/ceph/addr.c | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index e723482c5f37..cab1cf5a330b 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c | |||
| @@ -1539,19 +1539,27 @@ int ceph_uninline_data(struct file *filp, struct page *locked_page) | |||
| 1539 | 1539 | ||
| 1540 | osd_req_op_extent_osd_data_pages(req, 1, &page, len, 0, false, false); | 1540 | osd_req_op_extent_osd_data_pages(req, 1, &page, len, 0, false, false); |
| 1541 | 1541 | ||
| 1542 | err = osd_req_op_xattr_init(req, 0, CEPH_OSD_OP_CMPXATTR, | 1542 | { |
| 1543 | "inline_version", &inline_version, | 1543 | __le64 xattr_buf = cpu_to_le64(inline_version); |
| 1544 | sizeof(inline_version), | 1544 | err = osd_req_op_xattr_init(req, 0, CEPH_OSD_OP_CMPXATTR, |
| 1545 | CEPH_OSD_CMPXATTR_OP_GT, | 1545 | "inline_version", &xattr_buf, |
| 1546 | CEPH_OSD_CMPXATTR_MODE_U64); | 1546 | sizeof(xattr_buf), |
| 1547 | if (err) | 1547 | CEPH_OSD_CMPXATTR_OP_GT, |
| 1548 | goto out_put; | 1548 | CEPH_OSD_CMPXATTR_MODE_U64); |
| 1549 | 1549 | if (err) | |
| 1550 | err = osd_req_op_xattr_init(req, 2, CEPH_OSD_OP_SETXATTR, | 1550 | goto out_put; |
| 1551 | "inline_version", &inline_version, | 1551 | } |
| 1552 | sizeof(inline_version), 0, 0); | 1552 | |
| 1553 | if (err) | 1553 | { |
| 1554 | goto out_put; | 1554 | char xattr_buf[32]; |
| 1555 | int xattr_len = snprintf(xattr_buf, sizeof(xattr_buf), | ||
| 1556 | "%llu", inline_version); | ||
| 1557 | err = osd_req_op_xattr_init(req, 2, CEPH_OSD_OP_SETXATTR, | ||
| 1558 | "inline_version", | ||
| 1559 | xattr_buf, xattr_len, 0, 0); | ||
| 1560 | if (err) | ||
| 1561 | goto out_put; | ||
| 1562 | } | ||
| 1555 | 1563 | ||
| 1556 | ceph_osdc_build_request(req, 0, NULL, CEPH_NOSNAP, &inode->i_mtime); | 1564 | ceph_osdc_build_request(req, 0, NULL, CEPH_NOSNAP, &inode->i_mtime); |
| 1557 | err = ceph_osdc_start_request(&fsc->client->osdc, req, false); | 1565 | err = ceph_osdc_start_request(&fsc->client->osdc, req, false); |
