]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Merge remote-tracking branch 'ceph/master'
authorStephen Rothwell <sfr@canb.auug.org.au>
Fri, 27 Sep 2013 01:14:36 +0000 (11:14 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 27 Sep 2013 01:28:56 +0000 (11:28 +1000)
1  2 
fs/ceph/file.c

diff --cc fs/ceph/file.c
index 3de89829e2a162ab6bce2a58296b25aef9235c43,5cf034e915bb1ba5053b8d49786a2956148d3b72..12163727ca9d6e21ffad9d64c4c11efa2bbcd8c5
@@@ -538,34 -538,30 +538,30 @@@ ceph_sync_direct_write(struct kiocb *io
        flags = CEPH_OSD_FLAG_ORDERSNAP |
                CEPH_OSD_FLAG_ONDISK |
                CEPH_OSD_FLAG_WRITE;
-       if ((file->f_flags & (O_SYNC|O_DIRECT)) == 0)
-               flags |= CEPH_OSD_FLAG_ACK;
-       else
-               num_ops++;      /* Also include a 'startsync' command. */
  
-       /*
-        * we may need to do multiple writes here if we span an object
-        * boundary.  this isn't atomic, unfortunately.  :(
-        */
- more:
-       io_align = pos & ~PAGE_MASK;
-       buf_align = (unsigned long)data & ~PAGE_MASK;
-       len = left;
-       snapc = ci->i_snap_realm->cached_context;
-       vino = ceph_vino(inode);
-       req = ceph_osdc_new_request(&fsc->client->osdc, &ci->i_layout,
-                                   vino, pos, &len, num_ops,
-                                   CEPH_OSD_OP_WRITE, flags, snapc,
-                                   ci->i_truncate_seq, ci->i_truncate_size,
-                                   false);
-       if (IS_ERR(req))
-               return PTR_ERR(req);
+       iov_iter_init(&i, iov, nr_segs, count, 0);
+       while (iov_iter_count(&i) > 0) {
 -              void __user *data = i.iov->iov_base + i.iov_offset;
 -              u64 len = i.iov->iov_len - i.iov_offset;
++              void __user *data = iov_iter_iovec(&i)->iov_base + i.iov_offset;
++              u64 len = iov_iter_iovec(&i)->iov_len - i.iov_offset;
+               page_align = (unsigned long)data & ~PAGE_MASK;
+               snapc = ci->i_snap_realm->cached_context;
+               vino = ceph_vino(inode);
+               req = ceph_osdc_new_request(&fsc->client->osdc, &ci->i_layout,
+                                           vino, pos, &len,
+                                           2,/*include a 'startsync' command*/
+                                           CEPH_OSD_OP_WRITE, flags, snapc,
+                                           ci->i_truncate_seq,
+                                           ci->i_truncate_size,
+                                           false);
+               if (IS_ERR(req)) {
+                       ret = PTR_ERR(req);
+                       goto out;
+               }
  
-       /* write from beginning of first page, regardless of io alignment */
-       page_align = file->f_flags & O_DIRECT ? buf_align : io_align;
-       num_pages = calc_pages_for(page_align, len);
-       if (file->f_flags & O_DIRECT) {
+               num_pages = calc_pages_for(page_align, len);
                pages = ceph_get_direct_page_vector(data, num_pages, false);
                if (IS_ERR(pages)) {
                        ret = PTR_ERR(pages);