Whamcloud - gitweb
LU-630 lnet: only router checks peer health
[fs/lustre-release.git] / lustre / llite / vvp_io.c
index c7e6313..1647399 100644 (file)
@@ -29,8 +29,7 @@
  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011 Whamcloud, Inc.
- *
+ * Copyright (c) 2011, 2012, Whamcloud, Inc.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -147,6 +146,9 @@ static int vvp_mmap_locks(const struct lu_env *env,
         if (!cl_is_normalio(env, io))
                 RETURN(0);
 
+        if (vio->cui_iov == NULL) /* nfs or loop back device write */
+                RETURN(0);
+
         for (seg = 0; seg < vio->cui_nrsegs; seg++) {
                 const struct iovec *iv = &vio->cui_iov[seg];
 
@@ -326,13 +328,11 @@ static int vvp_do_vmtruncate(struct inode *inode, size_t size)
         int     result;
         /*
          * Only ll_inode_size_lock is taken at this level. lov_stripe_lock()
-         * is grabbed by ll_truncate() only over call to obd_adjust_kms().  If
-         * vmtruncate returns 0, then ll_truncate dropped ll_inode_size_lock()
+         * is grabbed by ll_truncate() only over call to obd_adjust_kms().
          */
         ll_inode_size_lock(inode, 0);
         result = vmtruncate(inode, size);
-        if (result != 0)
-                ll_inode_size_unlock(inode, 0);
+        ll_inode_size_unlock(inode, 0);
 
         return result;
 }
@@ -512,7 +512,7 @@ static int vvp_io_read_start(const struct lu_env *env,
 
         CDEBUG(D_VFSTRACE, "read: -> [%lli, %lli)\n", pos, pos + cnt);
 
-        result = ccc_prep_size(env, obj, io, pos, tot, 1, &exceed);
+        result = ccc_prep_size(env, obj, io, pos, tot, &exceed);
         if (result != 0)
                 return result;
         else if (exceed != 0)
@@ -554,6 +554,10 @@ static int vvp_io_read_start(const struct lu_env *env,
                 result = generic_file_splice_read(file, &pos,
                                 vio->u.splice.cui_pipe, cnt,
                                 vio->u.splice.cui_flags);
+                /* LU-1109: do splice read stripe by stripe otherwise if it
+                 * may make nfsd stuck if this read occupied all internal pipe
+                 * buffers. */
+                io->ci_continue = 0;
                 break;
 #endif
         default:
@@ -705,7 +709,7 @@ static int vvp_io_fault_start(const struct lu_env *env,
         /* offset of the last byte on the page */
         offset = cl_offset(obj, fio->ft_index + 1) - 1;
         LASSERT(cl_index(obj, offset) == fio->ft_index);
-        result = ccc_prep_size(env, obj, io, 0, offset + 1, 0, NULL);
+        result = ccc_prep_size(env, obj, io, 0, offset + 1, NULL);
         if (result != 0)
                 return result;
 
@@ -1104,8 +1108,6 @@ int vvp_io_init(const struct lu_env *env, struct cl_object *obj,
 {
         struct vvp_io      *vio   = vvp_env_io(env);
         struct ccc_io      *cio   = ccc_env_io(env);
-        struct inode       *inode = ccc_object_inode(obj);
-        struct ll_sb_info  *sbi   = ll_i2sbi(inode);
         int                 result;
 
         CLOBINVRNT(env, obj, ccc_object_invariant(obj));
@@ -1128,10 +1130,7 @@ int vvp_io_init(const struct lu_env *env, struct cl_object *obj,
                         cio->cui_tot_nrsegs = 0;
                 }
         } else if (io->ci_type == CIT_SETATTR) {
-                if (cl_io_is_trunc(io))
-                        /* lockless truncate? */
-                        ll_stats_ops_tally(sbi, LPROC_LL_TRUNC, 1);
-                else
+                if (!cl_io_is_trunc(io))
                         io->ci_lockreq = CILR_MANDATORY;
         }
         RETURN(result);