Whamcloud - gitweb
LU-10698 obdclass: allow specifying complex jobids
[fs/lustre-release.git] / lustre / llite / vvp_io.c
index c9c19b5..793ec00 100644 (file)
@@ -23,7 +23,7 @@
  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2016, Intel Corporation.
+ * Copyright (c) 2011, 2017, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -363,32 +363,21 @@ static void vvp_io_fini(const struct lu_env *env, const struct cl_io_slice *ios)
         * RPC.
         */
        if (io->ci_need_write_intent) {
-               loff_t start = 0;
-               loff_t end = OBD_OBJECT_EOF;
+               enum layout_intent_opc opc = LAYOUT_INTENT_WRITE;
 
                io->ci_need_write_intent = 0;
 
                LASSERT(io->ci_type == CIT_WRITE ||
                        cl_io_is_trunc(io) || cl_io_is_mkwrite(io));
 
-               if (io->ci_type == CIT_WRITE) {
-                       if (!cl_io_is_append(io)) {
-                               start = io->u.ci_rw.rw_range.cir_pos;
-                               end = start + io->u.ci_rw.rw_range.cir_count;
-                       }
-               } else if (cl_io_is_trunc(io)) {
-                       end = io->u.ci_setattr.sa_attr.lvb_size;
-               } else { /* mkwrite */
-                       pgoff_t index = io->u.ci_fault.ft_index;
+               CDEBUG(D_VFSTRACE, DFID" write layout, type %u "DEXT"\n",
+                      PFID(lu_object_fid(&obj->co_lu)), io->ci_type,
+                      PEXT(&io->ci_write_intent));
 
-                       start = cl_offset(io->ci_obj, index);
-                       end = cl_offset(io->ci_obj, index + 1);
-               }
+               if (cl_io_is_trunc(io))
+                       opc = LAYOUT_INTENT_TRUNC;
 
-               CDEBUG(D_VFSTRACE, DFID" write layout, type %u [%llu, %llu)\n",
-                      PFID(lu_object_fid(&obj->co_lu)), io->ci_type,
-                      start, end);
-               rc = ll_layout_write_intent(inode, start, end);
+               rc = ll_layout_write_intent(inode, opc, &io->ci_write_intent);
                io->ci_result = rc;
                if (!rc)
                        io->ci_need_restart = 1;
@@ -1483,7 +1472,7 @@ int vvp_io_init(const struct lu_env *env, struct cl_object *obj,
                 * it's not accurate if the file is shared by different
                 * jobs.
                 */
-               lustre_get_jobid(lli->lli_jobid);
+               lustre_get_jobid(lli->lli_jobid, sizeof(lli->lli_jobid));
        } else if (io->ci_type == CIT_SETATTR) {
                if (!cl_io_is_trunc(io))
                        io->ci_lockreq = CILR_MANDATORY;