From bc5eeb07726d9ad5fccc382bc9b89795e6c7c8e8 Mon Sep 17 00:00:00 2001 From: Mikhail Pershin Date: Sun, 20 Jul 2014 10:53:39 +0400 Subject: [PATCH] LU-4975 ofd: documenting ofd_dlm.c Fix up GPL header block to reference proper GPLv2 license URL. Remove mention of contacting Sun, since they don't exist anymore. Add introductory comment block for the ofd_dlm.c file and add function comment blocks to all functions in it. Signed-off-by: Mikhail Pershin Change-Id: Ic5f7869da1b9b8e458820c92691c62f93fc4a1e7 Reviewed-on: http://review.whamcloud.com/11151 Reviewed-by: Ned Bass Reviewed-by: Andreas Dilger Tested-by: Jenkins Tested-by: Maloo --- lustre/ofd/ofd_dlm.c | 55 ++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 47 insertions(+), 8 deletions(-) diff --git a/lustre/ofd/ofd_dlm.c b/lustre/ofd/ofd_dlm.c index 02bb9a6..f148804 100644 --- a/lustre/ofd/ofd_dlm.c +++ b/lustre/ofd/ofd_dlm.c @@ -15,11 +15,7 @@ * * You should have received a copy of the GNU General Public License * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * http://www.gnu.org/licenses/gpl-2.0.html * * GPL HEADER END */ @@ -27,7 +23,7 @@ * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2014 Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ @@ -35,8 +31,13 @@ * * lustre/ofd/ofd_dlm.c * - * Author: Mike Pershin - * Author: Alex Zhuravlev + * This file contains OBD Filter Device (OFD) LDLM-related code which is just + * intent handling for glimpse lock. + * + * Author: Andreas Dilger + * Author: Jinshan Xiong + * Author: Alexey Zhuravlev + * Author: Mikhail Pershin */ #define DEBUG_SUBSYSTEM S_FILTER @@ -49,6 +50,22 @@ struct ofd_intent_args { int *liblustre; }; +/** + * OFD interval callback. + * + * The interval_callback_t is part of interval_iterate_reverse() and is called + * for each interval in tree. The OFD interval callback searches for locks + * covering extents beyond the given args->size. This is used to decide if LVB + * data is outdated. + * + * \param[in] n interval node + * \param[in] args intent arguments + * + * \retval INTERVAL_ITER_STOP if the interval is lower than + * file size, caller stops execution + * \retval INTERVAL_ITER_CONT if callback finished successfully + * and caller may continue execution + */ static enum interval_iter ofd_intent_cb(struct interval_node *n, void *args) { struct ldlm_interval *node = (struct ldlm_interval *)n; @@ -87,6 +104,28 @@ static enum interval_iter ofd_intent_cb(struct interval_node *n, void *args) return INTERVAL_ITER_CONT; } +/** + * OFD lock intent policy + * + * This defines ldlm_namespace::ns_policy interface for OFD. + * Intent policy is called when lock has an intent, for OFD that + * means glimpse lock and policy fills Lock Value Block (LVB). + * + * If already granted lock is found it will be placed in \a lockp and + * returned back to caller function. + * + * \param[in] ns namespace + * \param[in,out] lockp pointer to the lock + * \param[in] req_cookie incoming request + * \param[in] mode LDLM mode + * \param[in] flags LDLM flags + * \param[in] data opaque data, not used in OFD policy + * + * \retval ELDLM_LOCK_REPLACED if already granted lock was found + * and placed in \a lockp + * \retval ELDLM_LOCK_ABORTED in other cases except error + * \retval negative value on error + */ int ofd_intent_policy(struct ldlm_namespace *ns, struct ldlm_lock **lockp, void *req_cookie, ldlm_mode_t mode, __u64 flags, void *data) -- 1.8.3.1