aboutsummaryrefslogtreecommitdiffstats
path: root/net/ceph
diff options
context:
space:
mode:
authorYan, Zheng <zyan@redhat.com>2014-11-13 01:40:37 -0500
committerIlya Dryomov <idryomov@redhat.com>2014-12-17 12:09:52 -0500
commit715e4cd405cfd67bd058e410b3e599bab2072645 (patch)
tree20b4b1bf1fe86e7719f82c4804228e887592d832 /net/ceph
parent864e9197f10c77053bbaf12932f5b200bb4ed3c5 (diff)
libceph: specify position of extent operation
allow specifying position of extent operation in multi-operations osd request. This is required for cephfs to convert inline data to normal data (compare xattr, then write object). Signed-off-by: Yan, Zheng <zyan@redhat.com> Reviewed-by: Ilya Dryomov <idryomov@redhat.com>
Diffstat (limited to 'net/ceph')
-rw-r--r--net/ceph/osd_client.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index af1b3ee195e9..53299c7b0ca4 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -753,7 +753,8 @@ static u64 osd_req_encode_op(struct ceph_osd_request *req,
753struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc, 753struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
754 struct ceph_file_layout *layout, 754 struct ceph_file_layout *layout,
755 struct ceph_vino vino, 755 struct ceph_vino vino,
756 u64 off, u64 *plen, int num_ops, 756 u64 off, u64 *plen,
757 unsigned int which, int num_ops,
757 int opcode, int flags, 758 int opcode, int flags,
758 struct ceph_snap_context *snapc, 759 struct ceph_snap_context *snapc,
759 u32 truncate_seq, 760 u32 truncate_seq,
@@ -785,7 +786,7 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
785 } 786 }
786 787
787 if (opcode == CEPH_OSD_OP_CREATE || opcode == CEPH_OSD_OP_DELETE) { 788 if (opcode == CEPH_OSD_OP_CREATE || opcode == CEPH_OSD_OP_DELETE) {
788 osd_req_op_init(req, 0, opcode); 789 osd_req_op_init(req, which, opcode);
789 } else { 790 } else {
790 u32 object_size = le32_to_cpu(layout->fl_object_size); 791 u32 object_size = le32_to_cpu(layout->fl_object_size);
791 u32 object_base = off - objoff; 792 u32 object_base = off - objoff;
@@ -798,17 +799,9 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
798 truncate_size = object_size; 799 truncate_size = object_size;
799 } 800 }
800 } 801 }
801 802 osd_req_op_extent_init(req, which, opcode, objoff, objlen,
802 osd_req_op_extent_init(req, 0, opcode, objoff, objlen,
803 truncate_size, truncate_seq); 803 truncate_size, truncate_seq);
804 } 804 }
805 /*
806 * A second op in the ops array means the caller wants to
807 * also issue a include a 'startsync' command so that the
808 * osd will flush data quickly.
809 */
810 if (num_ops > 1)
811 osd_req_op_init(req, 1, CEPH_OSD_OP_STARTSYNC);
812 805
813 req->r_base_oloc.pool = ceph_file_layout_pg_pool(*layout); 806 req->r_base_oloc.pool = ceph_file_layout_pg_pool(*layout);
814 807
@@ -2675,7 +2668,7 @@ int ceph_osdc_readpages(struct ceph_osd_client *osdc,
2675 2668
2676 dout("readpages on ino %llx.%llx on %llu~%llu\n", vino.ino, 2669 dout("readpages on ino %llx.%llx on %llu~%llu\n", vino.ino,
2677 vino.snap, off, *plen); 2670 vino.snap, off, *plen);
2678 req = ceph_osdc_new_request(osdc, layout, vino, off, plen, 1, 2671 req = ceph_osdc_new_request(osdc, layout, vino, off, plen, 0, 1,
2679 CEPH_OSD_OP_READ, CEPH_OSD_FLAG_READ, 2672 CEPH_OSD_OP_READ, CEPH_OSD_FLAG_READ,
2680 NULL, truncate_seq, truncate_size, 2673 NULL, truncate_seq, truncate_size,
2681 false); 2674 false);
@@ -2718,7 +2711,7 @@ int ceph_osdc_writepages(struct ceph_osd_client *osdc, struct ceph_vino vino,
2718 int page_align = off & ~PAGE_MASK; 2711 int page_align = off & ~PAGE_MASK;
2719 2712
2720 BUG_ON(vino.snap != CEPH_NOSNAP); /* snapshots aren't writeable */ 2713 BUG_ON(vino.snap != CEPH_NOSNAP); /* snapshots aren't writeable */
2721 req = ceph_osdc_new_request(osdc, layout, vino, off, &len, 1, 2714 req = ceph_osdc_new_request(osdc, layout, vino, off, &len, 0, 1,
2722 CEPH_OSD_OP_WRITE, 2715 CEPH_OSD_OP_WRITE,
2723 CEPH_OSD_FLAG_ONDISK | CEPH_OSD_FLAG_WRITE, 2716 CEPH_OSD_FLAG_ONDISK | CEPH_OSD_FLAG_WRITE,
2724 snapc, truncate_seq, truncate_size, 2717 snapc, truncate_seq, truncate_size,