summaryrefslogtreecommitdiffstats
path: root/fs/ceph/file.c
diff options
context:
space:
mode:
authorIlya Dryomov <idryomov@gmail.com>2017-02-13 08:44:19 -0500
committerIlya Dryomov <idryomov@gmail.com>2017-02-24 13:04:57 -0500
commit55f2a04588c5881d90e22631b17a84cd25d17cc4 (patch)
tree6dc9b01395ba83ff443d3eb5d4cb3cde39534003 /fs/ceph/file.c
parentf107548039807eb890e65ce5cd29d6ac52562f09 (diff)
ceph: remove special ack vs commit behavior
- ask for a commit reply instead of an ack reply in __ceph_pool_perm_get() - don't ask for both ack and commit replies in ceph_sync_write() - since just only one reply is requested now, i_unsafe_writes list will always be empty -- kill ceph_sync_write_wait() and go back to a standard ->evict_inode() Signed-off-by: Ilya Dryomov <idryomov@gmail.com> Reviewed-by: Jeff Layton <jlayton@redhat.com> Reviewed-by: Sage Weil <sage@redhat.com>
Diffstat (limited to 'fs/ceph/file.c')
-rw-r--r--fs/ceph/file.c88
1 files changed, 1 insertions, 87 deletions
diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index baad3b688ada..023cb7fd9b5f 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -795,89 +795,6 @@ out:
795 kfree(aio_work); 795 kfree(aio_work);
796} 796}
797 797
798/*
799 * Write commit request unsafe callback, called to tell us when a
800 * request is unsafe (that is, in flight--has been handed to the
801 * messenger to send to its target osd). It is called again when
802 * we've received a response message indicating the request is
803 * "safe" (its CEPH_OSD_FLAG_ONDISK flag is set), or when a request
804 * is completed early (and unsuccessfully) due to a timeout or
805 * interrupt.
806 *
807 * This is used if we requested both an ACK and ONDISK commit reply
808 * from the OSD.
809 */
810static void ceph_sync_write_unsafe(struct ceph_osd_request *req, bool unsafe)
811{
812 struct ceph_inode_info *ci = ceph_inode(req->r_inode);
813
814 dout("%s %p tid %llu %ssafe\n", __func__, req, req->r_tid,
815 unsafe ? "un" : "");
816 if (unsafe) {
817 ceph_get_cap_refs(ci, CEPH_CAP_FILE_WR);
818 spin_lock(&ci->i_unsafe_lock);
819 list_add_tail(&req->r_unsafe_item,
820 &ci->i_unsafe_writes);
821 spin_unlock(&ci->i_unsafe_lock);
822
823 complete_all(&req->r_completion);
824 } else {
825 spin_lock(&ci->i_unsafe_lock);
826 list_del_init(&req->r_unsafe_item);
827 spin_unlock(&ci->i_unsafe_lock);
828 ceph_put_cap_refs(ci, CEPH_CAP_FILE_WR);
829 }
830}
831
832/*
833 * Wait on any unsafe replies for the given inode. First wait on the
834 * newest request, and make that the upper bound. Then, if there are
835 * more requests, keep waiting on the oldest as long as it is still older
836 * than the original request.
837 */
838void ceph_sync_write_wait(struct inode *inode)
839{
840 struct ceph_inode_info *ci = ceph_inode(inode);
841 struct list_head *head = &ci->i_unsafe_writes;
842 struct ceph_osd_request *req;
843 u64 last_tid;
844
845 if (!S_ISREG(inode->i_mode))
846 return;
847
848 spin_lock(&ci->i_unsafe_lock);
849 if (list_empty(head))
850 goto out;
851
852 /* set upper bound as _last_ entry in chain */
853
854 req = list_last_entry(head, struct ceph_osd_request,
855 r_unsafe_item);
856 last_tid = req->r_tid;
857
858 do {
859 ceph_osdc_get_request(req);
860 spin_unlock(&ci->i_unsafe_lock);
861
862 dout("sync_write_wait on tid %llu (until %llu)\n",
863 req->r_tid, last_tid);
864 wait_for_completion(&req->r_done_completion);
865 ceph_osdc_put_request(req);
866
867 spin_lock(&ci->i_unsafe_lock);
868 /*
869 * from here on look at first entry in chain, since we
870 * only want to wait for anything older than last_tid
871 */
872 if (list_empty(head))
873 break;
874 req = list_first_entry(head, struct ceph_osd_request,
875 r_unsafe_item);
876 } while (req->r_tid < last_tid);
877out:
878 spin_unlock(&ci->i_unsafe_lock);
879}
880
881static ssize_t 798static ssize_t
882ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter, 799ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter,
883 struct ceph_snap_context *snapc, 800 struct ceph_snap_context *snapc,
@@ -1119,8 +1036,7 @@ ceph_sync_write(struct kiocb *iocb, struct iov_iter *from, loff_t pos,
1119 1036
1120 flags = CEPH_OSD_FLAG_ORDERSNAP | 1037 flags = CEPH_OSD_FLAG_ORDERSNAP |
1121 CEPH_OSD_FLAG_ONDISK | 1038 CEPH_OSD_FLAG_ONDISK |
1122 CEPH_OSD_FLAG_WRITE | 1039 CEPH_OSD_FLAG_WRITE;
1123 CEPH_OSD_FLAG_ACK;
1124 1040
1125 while ((len = iov_iter_count(from)) > 0) { 1041 while ((len = iov_iter_count(from)) > 0) {
1126 size_t left; 1042 size_t left;
@@ -1166,8 +1082,6 @@ ceph_sync_write(struct kiocb *iocb, struct iov_iter *from, loff_t pos,
1166 goto out; 1082 goto out;
1167 } 1083 }
1168 1084
1169 /* get a second commit callback */
1170 req->r_unsafe_callback = ceph_sync_write_unsafe;
1171 req->r_inode = inode; 1085 req->r_inode = inode;
1172 1086
1173 osd_req_op_extent_osd_data_pages(req, 0, pages, len, 0, 1087 osd_req_op_extent_osd_data_pages(req, 0, pages, len, 0,