static int slp_io_rw_lock(const struct lu_env *env, const struct cl_io_slice *ios) { struct ccc_io *cio = ccc_env_io(env); struct cl_io *io = ios->cis_io; loff_t start; loff_t end; if (cl_io_is_append(io)) { start = 0; end = OBD_OBJECT_EOF; } else { start = io->u.ci_wr.wr.crw_pos; end = start + io->u.ci_wr.wr.crw_count - 1; } ccc_io_update_iov(env, cio, io); /* * This acquires real DLM lock only in O_APPEND case, because of * the io->ci_lockreq setting in llu_io_init(). */ LASSERT(ergo(cl_io_is_append(io), io->ci_lockreq == CILR_MANDATORY)); LASSERT(ergo(!cl_io_is_append(io), io->ci_lockreq == CILR_NEVER)); return ccc_io_one_lock(env, io, 0, io->ci_type == CIT_READ ? CLM_READ : CLM_WRITE, start, end); }
static int vvp_io_rw_lock(const struct lu_env *env, struct cl_io *io, enum cl_lock_mode mode, loff_t start, loff_t end) { struct ccc_io *cio = ccc_env_io(env); int result; int ast_flags = 0; LASSERT(io->ci_type == CIT_READ || io->ci_type == CIT_WRITE); ENTRY; ccc_io_update_iov(env, cio, io); if (io->u.ci_rw.crw_nonblock) ast_flags |= CEF_NONBLOCK; result = vvp_mmap_locks(env, cio, io); if (result == 0) result = ccc_io_one_lock(env, io, ast_flags, mode, start, end); RETURN(result); }