Whamcloud - gitweb
LU-12355 llite: Lustre specific iov_for_each broken (removed)
[fs/lustre-release.git] / lustre / llite / vvp_io.c
index 22bf50e..294cfeb 100644 (file)
@@ -41,6 +41,7 @@
 #include <obd.h>
 #include "llite_internal.h"
 #include "vvp_internal.h"
+#include <libcfs/linux/linux-misc.h>
 
 static struct vvp_io *cl2vvp_io(const struct lu_env *env,
                                const struct cl_io_slice *slice)
@@ -439,6 +440,8 @@ static int vvp_mmap_locks(const struct lu_env *env,
        union ldlm_policy_data policy;
        struct iovec iov;
        struct iov_iter i;
+       unsigned long addr;
+       ssize_t count;
        int result = 0;
        ENTRY;
 
@@ -455,9 +458,15 @@ static int vvp_mmap_locks(const struct lu_env *env,
        if (mm == NULL)
                RETURN(0);
 
-       iov_for_each(iov, i, *(vio->vui_iter)) {
-               unsigned long addr = (unsigned long)iov.iov_base;
-               size_t count = iov.iov_len;
+       if (!iter_is_iovec(vio->vui_iter) && !iov_iter_is_kvec(vio->vui_iter))
+               RETURN(0);
+
+       for (i = *vio->vui_iter;
+            iov_iter_count(&i);
+            iov_iter_advance(&i, iov.iov_len)) {
+               iov = iov_iter_iovec(&i);
+               addr = (unsigned long)iov.iov_base;
+               count = iov.iov_len;
 
                 if (count == 0)
                         continue;
@@ -780,6 +789,11 @@ static int vvp_io_read_start(const struct lu_env *env,
        if (vio->vui_io_subtype == IO_NORMAL)
                down_read(&lli->lli_trunc_sem);
 
+       if (io->ci_async_readahead) {
+               file_accessed(file);
+               RETURN(0);
+       }
+
        if (!can_populate_pages(env, io, inode))
                RETURN(0);
 
@@ -803,7 +817,6 @@ static int vvp_io_read_start(const struct lu_env *env,
                vio->vui_ra_valid = true;
                vio->vui_ra_start = cl_index(obj, pos);
                vio->vui_ra_count = cl_index(obj, tot + PAGE_SIZE - 1);
-               ll_ras_enter(file);
        }
 
        /* BUG: 5972 */
@@ -1066,7 +1079,7 @@ static int vvp_io_write_start(const struct lu_env *env,
        if (pos + cnt > ll_file_maxbytes(inode)) {
                CDEBUG(D_INODE,
                       "%s: file %s ("DFID") offset %llu > maxbytes %llu\n",
-                      ll_get_fsname(inode->i_sb, NULL, 0),
+                      ll_i2sbi(inode)->ll_fsname,
                       file_dentry(file)->d_name.name,
                       PFID(ll_inode2fid(inode)), pos + cnt,
                       ll_file_maxbytes(inode));
@@ -1092,13 +1105,13 @@ static int vvp_io_write_start(const struct lu_env *env,
                 * consistency, proper locking to protect against writes,
                 * trucates, etc. is handled in the higher layers of lustre.
                 */
-               bool lock_node = !IS_NOSEC(inode);
+               lock_inode = !IS_NOSEC(inode);
 
-               if (lock_node)
+               if (unlikely(lock_inode))
                        inode_lock(inode);
                result = __generic_file_write_iter(vio->vui_iocb,
                                                   vio->vui_iter);
-               if (lock_node)
+               if (unlikely(lock_inode))
                        inode_unlock(inode);
 
                if (result > 0 || result == -EIOCBQUEUED)
@@ -1235,7 +1248,7 @@ static int vvp_io_fault_start(const struct lu_env *env,
        LASSERT(PageLocked(vmpage));
 
        if (OBD_FAIL_CHECK(OBD_FAIL_LLITE_FAULT_TRUNC_RACE))
-               ll_invalidate_page(vmpage);
+               generic_error_remove_page(vmpage->mapping, vmpage);
 
        size = i_size_read(inode);
         /* Though we have already held a cl_lock upon this page, but
@@ -1500,8 +1513,8 @@ int vvp_io_init(const struct lu_env *env, struct cl_object *obj,
                        result = 0;
                if (result < 0)
                        CERROR("%s: refresh file layout " DFID " error %d.\n",
-                               ll_get_fsname(inode->i_sb, NULL, 0),
-                               PFID(lu_object_fid(&obj->co_lu)), result);
+                              ll_i2sbi(inode)->ll_fsname,
+                              PFID(lu_object_fid(&obj->co_lu)), result);
        }
 
        io->ci_result = result < 0 ? result : 0;