aboutsummaryrefslogtreecommitdiffstats
path: root/fs
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 /fs
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 'fs')
-rw-r--r--fs/ceph/addr.c9
-rw-r--r--fs/ceph/file.c8
2 files changed, 11 insertions, 6 deletions
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index 18c06bbaf136..f2c7aa878aa4 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -319,7 +319,7 @@ static int start_read(struct inode *inode, struct list_head *page_list, int max)
319 off, len); 319 off, len);
320 vino = ceph_vino(inode); 320 vino = ceph_vino(inode);
321 req = ceph_osdc_new_request(osdc, &ci->i_layout, vino, off, &len, 321 req = ceph_osdc_new_request(osdc, &ci->i_layout, vino, off, &len,
322 1, CEPH_OSD_OP_READ, 322 0, 1, CEPH_OSD_OP_READ,
323 CEPH_OSD_FLAG_READ, NULL, 323 CEPH_OSD_FLAG_READ, NULL,
324 ci->i_truncate_seq, ci->i_truncate_size, 324 ci->i_truncate_seq, ci->i_truncate_size,
325 false); 325 false);
@@ -750,7 +750,6 @@ retry:
750 last_snapc = snapc; 750 last_snapc = snapc;
751 751
752 while (!done && index <= end) { 752 while (!done && index <= end) {
753 int num_ops = do_sync ? 2 : 1;
754 unsigned i; 753 unsigned i;
755 int first; 754 int first;
756 pgoff_t next; 755 pgoff_t next;
@@ -850,7 +849,8 @@ get_more_pages:
850 len = wsize; 849 len = wsize;
851 req = ceph_osdc_new_request(&fsc->client->osdc, 850 req = ceph_osdc_new_request(&fsc->client->osdc,
852 &ci->i_layout, vino, 851 &ci->i_layout, vino,
853 offset, &len, num_ops, 852 offset, &len, 0,
853 do_sync ? 2 : 1,
854 CEPH_OSD_OP_WRITE, 854 CEPH_OSD_OP_WRITE,
855 CEPH_OSD_FLAG_WRITE | 855 CEPH_OSD_FLAG_WRITE |
856 CEPH_OSD_FLAG_ONDISK, 856 CEPH_OSD_FLAG_ONDISK,
@@ -862,6 +862,9 @@ get_more_pages:
862 break; 862 break;
863 } 863 }
864 864
865 if (do_sync)
866 osd_req_op_init(req, 1, CEPH_OSD_OP_STARTSYNC);
867
865 req->r_callback = writepages_finish; 868 req->r_callback = writepages_finish;
866 req->r_inode = inode; 869 req->r_inode = inode;
867 870
diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index d7e0da8366e6..c03ac4c4bcd1 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -598,7 +598,7 @@ ceph_sync_direct_write(struct kiocb *iocb, struct iov_iter *from, loff_t pos)
598 snapc = ci->i_snap_realm->cached_context; 598 snapc = ci->i_snap_realm->cached_context;
599 vino = ceph_vino(inode); 599 vino = ceph_vino(inode);
600 req = ceph_osdc_new_request(&fsc->client->osdc, &ci->i_layout, 600 req = ceph_osdc_new_request(&fsc->client->osdc, &ci->i_layout,
601 vino, pos, &len, 601 vino, pos, &len, 0,
602 2,/*include a 'startsync' command*/ 602 2,/*include a 'startsync' command*/
603 CEPH_OSD_OP_WRITE, flags, snapc, 603 CEPH_OSD_OP_WRITE, flags, snapc,
604 ci->i_truncate_seq, 604 ci->i_truncate_seq,
@@ -609,6 +609,8 @@ ceph_sync_direct_write(struct kiocb *iocb, struct iov_iter *from, loff_t pos)
609 break; 609 break;
610 } 610 }
611 611
612 osd_req_op_init(req, 1, CEPH_OSD_OP_STARTSYNC);
613
612 n = iov_iter_get_pages_alloc(from, &pages, len, &start); 614 n = iov_iter_get_pages_alloc(from, &pages, len, &start);
613 if (unlikely(n < 0)) { 615 if (unlikely(n < 0)) {
614 ret = n; 616 ret = n;
@@ -713,7 +715,7 @@ ceph_sync_write(struct kiocb *iocb, struct iov_iter *from, loff_t pos)
713 snapc = ci->i_snap_realm->cached_context; 715 snapc = ci->i_snap_realm->cached_context;
714 vino = ceph_vino(inode); 716 vino = ceph_vino(inode);
715 req = ceph_osdc_new_request(&fsc->client->osdc, &ci->i_layout, 717 req = ceph_osdc_new_request(&fsc->client->osdc, &ci->i_layout,
716 vino, pos, &len, 1, 718 vino, pos, &len, 0, 1,
717 CEPH_OSD_OP_WRITE, flags, snapc, 719 CEPH_OSD_OP_WRITE, flags, snapc,
718 ci->i_truncate_seq, 720 ci->i_truncate_seq,
719 ci->i_truncate_size, 721 ci->i_truncate_size,
@@ -1111,7 +1113,7 @@ static int ceph_zero_partial_object(struct inode *inode,
1111 req = ceph_osdc_new_request(&fsc->client->osdc, &ci->i_layout, 1113 req = ceph_osdc_new_request(&fsc->client->osdc, &ci->i_layout,
1112 ceph_vino(inode), 1114 ceph_vino(inode),
1113 offset, length, 1115 offset, length,
1114 1, op, 1116 0, 1, op,
1115 CEPH_OSD_FLAG_WRITE | 1117 CEPH_OSD_FLAG_WRITE |
1116 CEPH_OSD_FLAG_ONDISK, 1118 CEPH_OSD_FLAG_ONDISK,
1117 NULL, 0, 0, false); 1119 NULL, 0, 0, false);