* 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/
* RPC.
*/
if (io->ci_need_write_intent) {
+ enum layout_intent_opc opc = LAYOUT_INTENT_WRITE;
+
io->ci_need_write_intent = 0;
LASSERT(io->ci_type == CIT_WRITE ||
PFID(lu_object_fid(&obj->co_lu)), io->ci_type,
PEXT(&io->ci_write_intent));
- rc = ll_layout_write_intent(inode, io->ci_write_intent.e_start,
- io->ci_write_intent.e_end);
+ if (cl_io_is_trunc(io))
+ opc = LAYOUT_INTENT_TRUNC;
+
+ rc = ll_layout_write_intent(inode, opc, &io->ci_write_intent);
io->ci_result = rc;
if (!rc)
io->ci_need_restart = 1;
* 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;