X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fllite%2Fglimpse.c;h=2a677a4e6264b07389cd6fb77ef7fe501b083ce6;hb=HEAD;hp=d0bb414818b7a6b2dfc54164cadef5022486a94b;hpb=6d47f2b35118a75f65a5557a27eaade99d135f1b;p=fs%2Flustre-release.git diff --git a/lustre/llite/glimpse.c b/lustre/llite/glimpse.c index d0bb414..5bed886 100644 --- a/lustre/llite/glimpse.c +++ b/lustre/llite/glimpse.c @@ -1,38 +1,19 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.gnu.org/licenses/gpl-2.0.html - * - * GPL HEADER END - */ +// SPDX-License-Identifier: GPL-2.0 + /* * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * * Copyright (c) 2011, 2017, Intel Corporation. */ + /* * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. * * glimpse code used by vvp (and other Lustre clients in the future). * - * Author: Nikita Danilov - * Author: Oleg Drokin + * Author: Nikita Danilov + * Author: Oleg Drokin */ #include @@ -55,11 +36,13 @@ static const struct cl_lock_descr whole_file = { .cld_mode = CLM_READ }; -/* - * Check whether file has possible unwritten pages. +/** + * dirty_cnt() - Check whether file has possible unwritten pages. + * @inode: inode being checked for dirtyness * - * \retval 1 file is mmap-ed or has dirty pages - * 0 otherwise + * Return: + * * %1 file is mmap-ed or has dirty pages + * * %0 otherwise */ blkcnt_t dirty_cnt(struct inode *inode) { @@ -81,7 +64,7 @@ int cl_glimpse_lock(const struct lu_env *env, struct cl_io *io, struct inode *inode, struct cl_object *clob, int agl) { const struct lu_fid *fid = lu_object_fid(&clob->co_lu); - struct cl_lock *lock = vvp_env_lock(env); + struct cl_lock *lock = vvp_env_new_lock(env); struct cl_lock_descr *descr = &lock->cll_descr; int result; @@ -102,7 +85,8 @@ int cl_glimpse_lock(const struct lu_env *env, struct cl_io *io, * if there were no conflicting locks. If there * were conflicting locks, enqueuing or waiting * fails with -ENAVAIL, but valid inode - * attributes are returned anyway. */ + * attributes are returned anyway. + */ *descr = whole_file; descr->cld_obj = clob; descr->cld_mode = CLM_READ; @@ -136,17 +120,17 @@ int cl_glimpse_lock(const struct lu_env *env, struct cl_io *io, } /** - * Get an IO environment for special operations such as glimpse locks and - * manually requested locks (ladvise lockahead) - * - * \param[in] inode inode the operation is being performed on - * \param[out] envout thread specific execution environment - * \param[out] ioout client io description - * \param[out] refcheck reference check + * cl_io_get() - Get an IO environment for special operations such as glimpse + * locks and manually requested locks (ladvise lockahead) + * @inode: inode the operation is being performed on + * @envout: thread specific execution environment + * @ioout: client io description + * @refcheck: reference check * - * \retval 1 on success - * \retval 0 not a regular file, cannot get environment - * \retval negative negative errno on error + * Return: + * * %1 on success + * * %0 not a regular file, cannot get environment + * * %negative negative errno on error */ int cl_io_get(struct inode *inode, struct lu_env **envout, struct cl_io **ioout, u16 *refcheck) @@ -160,7 +144,7 @@ int cl_io_get(struct inode *inode, struct lu_env **envout, if (S_ISREG(inode->i_mode)) { env = cl_env_get(refcheck); if (!IS_ERR(env)) { - io = vvp_env_thread_io(env); + io = vvp_env_new_io(env); io->ci_obj = clob; *envout = env; *ioout = io; @@ -211,11 +195,16 @@ int cl_glimpse_size0(struct inode *inode, int agl) } else if (result == 0) { result = cl_glimpse_lock(env, io, inode, io->ci_obj, agl); - if (!agl && result == -EWOULDBLOCK) + /** + * need to limit retries for FLR mirrors if fast read + * is short because of concurrent truncate. + */ + if (!agl && result == -EAGAIN && + !io->ci_tried_all_mirrors) io->ci_need_restart = 1; } - OBD_FAIL_TIMEOUT(OBD_FAIL_GLIMPSE_DELAY, 2); + CFS_FAIL_TIMEOUT(OBD_FAIL_GLIMPSE_DELAY, cfs_fail_val ?: 4); cl_io_fini(env, io); } while (unlikely(io->ci_need_restart));