From 2ab5eabcb06e4b32376a51f5681b304a369d714d Mon Sep 17 00:00:00 2001 From: donmilos Date: Mon, 23 Jun 2003 01:35:23 +0000 Subject: [PATCH] Remove files accidentally added to HEAD. --- lustre/ldlm/ldlm_extent.c | 122 --------------------------------------- lustre/ldlm/ldlm_plain.c | 142 ---------------------------------------------- 2 files changed, 264 deletions(-) delete mode 100644 lustre/ldlm/ldlm_extent.c delete mode 100644 lustre/ldlm/ldlm_plain.c diff --git a/lustre/ldlm/ldlm_extent.c b/lustre/ldlm/ldlm_extent.c deleted file mode 100644 index f6a9f5e..0000000 --- a/lustre/ldlm/ldlm_extent.c +++ /dev/null @@ -1,122 +0,0 @@ -/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- - * vim:expandtab:shiftwidth=8:tabstop=8: - * - * Copyright (c) 2002 Cluster File Systems, Inc. - * Author: Peter Braam - * Author: Phil Schwan - * - * This file is part of Lustre, http://www.lustre.org. - * - * Lustre is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * Lustre 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 for more details. - * - * You should have received a copy of the GNU General Public License - * along with Lustre; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#define DEBUG_SUBSYSTEM S_LDLM -#ifndef __KERNEL__ -# include -#endif - -#include -#include -#include - -/* This function will be called to judge if one extent overlaps with another */ -int ldlm_extent_compat(struct ldlm_lock *a, struct ldlm_lock *b) -{ - if ((a->l_extent.start <= b->l_extent.end) && - (a->l_extent.end >= b->l_extent.start)) - RETURN(0); - - RETURN(1); -} - -/* The purpose of this function is to return: - * - the maximum extent - * - containing the requested extent - * - and not overlapping existing conflicting extents outside the requested one - * - * An alternative policy is to not shrink the new extent when conflicts exist. - * - * To reconstruct our formulas, take a deep breath. */ -static void policy_internal(struct list_head *queue, struct ldlm_extent *req_ex, - struct ldlm_extent *new_ex, ldlm_mode_t mode) -{ - struct list_head *tmp; - - list_for_each(tmp, queue) { - struct ldlm_lock *lock; - lock = list_entry(tmp, struct ldlm_lock, l_res_link); - - /* if lock doesn't overlap new_ex, skip it. */ - if (lock->l_extent.end < new_ex->start || - lock->l_extent.start > new_ex->end) - continue; - - /* Locks are compatible, overlap doesn't matter */ - if (lockmode_compat(lock->l_req_mode, mode)) - continue; - - if (lock->l_extent.start < req_ex->start) { - if (lock->l_extent.end == ~0) { - new_ex->start = req_ex->start; - new_ex->end = req_ex->end; - return; - } - new_ex->start = MIN(lock->l_extent.end + 1, - req_ex->start); - } - - if (lock->l_extent.end > req_ex->end) { - if (lock->l_extent.start == 0) { - new_ex->start = req_ex->start; - new_ex->end = req_ex->end; - return; - } - new_ex->end = MAX(lock->l_extent.start - 1, - req_ex->end); - } - } -} - -/* apply the internal policy by walking all the lists */ -int ldlm_extent_policy(struct ldlm_namespace *ns, struct ldlm_lock **lockp, - void *req_cookie, ldlm_mode_t mode, int flags, - void *data) -{ - struct ldlm_lock *lock = *lockp; - struct ldlm_resource *res = lock->l_resource; - struct ldlm_extent *req_ex = req_cookie; - struct ldlm_extent new_ex; - new_ex.start = 0; - new_ex.end = ~0; - - if (!res) - LBUG(); - - l_lock(&ns->ns_lock); - policy_internal(&res->lr_granted, req_ex, &new_ex, mode); - policy_internal(&res->lr_converting, req_ex, &new_ex, mode); - policy_internal(&res->lr_waiting, req_ex, &new_ex, mode); - l_unlock(&ns->ns_lock); - - memcpy(&lock->l_extent, &new_ex, sizeof(new_ex)); - - LDLM_DEBUG(lock, "requested extent ["LPU64"->"LPU64"], new extent [" - LPU64"->"LPU64"]", - req_ex->start, req_ex->end, new_ex.start, new_ex.end); - - if (new_ex.end != req_ex->end || new_ex.start != req_ex->start) - return ELDLM_LOCK_CHANGED; - else - return 0; -} diff --git a/lustre/ldlm/ldlm_plain.c b/lustre/ldlm/ldlm_plain.c deleted file mode 100644 index fc6f029..0000000 --- a/lustre/ldlm/ldlm_plain.c +++ /dev/null @@ -1,142 +0,0 @@ -/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- - * vim:expandtab:shiftwidth=8:tabstop=8: - * - * Copyright (c) 2002, 2003 Cluster File Systems, Inc. - * Author: Peter Braam - * Author: Phil Schwan - * - * This file is part of Lustre, http://www.lustre.org. - * - * Lustre is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * Lustre 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 for more details. - * - * You should have received a copy of the GNU General Public License - * along with Lustre; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#define DEBUG_SUBSYSTEM S_LDLM - -#ifdef __KERNEL__ -#include -#include -#include -#else -#include -#endif - -static int -ldlm_plain_compat_queue(struct list_head *queue, struct ldlm_lock *new, - int send_cbs, int first_enq) -{ - struct list_head *tmp, *pos; - ldlm_mode_t mode = new->l_req_mode; - int compat = 1; - ENTRY; - - list_for_each_safe(tmp, pos, queue) { - struct ldlm_lock *old; - - old = list_entry(tmp, struct ldlm_lock, l_res_link); - if (old == new) - continue; - - if (lockmode_compat(old->l_req_mode, mode) && - lockmode_compat(old->l_granted_mode, mode)) { - CDEBUG(D_OTHER, "lock modes are compatible, next.\n"); - continue; - } - - compat = 0; - - /* if we're reprocessing the lock then the blocking ASTs - * have already been sent. No need to continue. */ - if (!first_enq) - break; - - if (send_cbs && (old->l_blocking_ast != NULL)) { - CDEBUG(D_DLMTRACE, "lock %p incompatible; " - "sending blocking AST.\n", old); - ldlm_add_ast_work_item(old, new, NULL, 0); - } else if (!(old->l_flags & LDLM_FL_LOCAL)) { - CDEBUG(D_DLMTRACE, "lock %p incompatible; " - "setting blocking AST.\n", old); - old->l_flags |= LDLM_FL_AST_SENT; - } else { - CDEBUG(D_DLMTRACE, "local lock %p incompatible.\n", - old); - } - } - - RETURN(compat); -} - -int -ldlm_plain_enqueue(struct ldlm_lock **lockp, void *cookie, int *flags, - int first_enq, ldlm_error_t *err) -{ - struct ldlm_lock *lock = *lockp; - struct ldlm_resource *res = lock->l_resource; - int convert_compat = 1; - int waiting_compat = 1; - int granted_compat = 1; - ENTRY; - - /* FIXME: We may want to optimize by checking lr_most_restr */ - - /* On the first enqueue of this lock scan all of the queues - * to set the LDLM_FL_AST_SENT flag in conflicting locks. - * When the completion AST on the client side runs and sees - * this flag is will set the LDLM_FL_CB_PENDING flag in the - * lock so the client will know to cancel the lock as soon - * as possible. This saves us from sending a blocking AST - * in addition to the completion AST. - * - * If it's NOT the first enqueue of this lock then it must be - * the first eligible lock in the queues because of the way that - * ldlm_reprocess_all() works. So we don't have to check the - * converting or waiting queues. */ - if (first_enq) { - if (!list_empty(&res->lr_converting)) { - convert_compat = 0; - ldlm_plain_compat_queue(&res->lr_converting, - lock, 0, first_enq); - } - if (!list_empty(&res->lr_waiting)) { - waiting_compat = 0; - ldlm_plain_compat_queue(&res->lr_waiting, - lock, 0, first_enq); - } - } - granted_compat = - ldlm_plain_compat_queue(&res->lr_granted, lock, 1, first_enq); - - if (!convert_compat) { - *flags |= LDLM_FL_BLOCK_CONV; - RETURN(LDLM_ITER_STOP); - } - if (!waiting_compat) { - *flags |= LDLM_FL_BLOCK_WAIT; - RETURN(LDLM_ITER_STOP); - } - if (!granted_compat) { - *flags |= LDLM_FL_BLOCK_GRANTED; - RETURN(LDLM_ITER_STOP); - } - - list_del_init(&lock->l_res_link); - ldlm_grant_lock(lock, NULL, 0); - - if (lock->l_flags & LDLM_FL_AST_SENT) { - CDEBUG(D_DLMTRACE, "granted lock %p with AST set\n", lock); - *flags |= (lock->l_flags & LDLM_FL_AST_SENT); - } - - RETURN(LDLM_ITER_CONTINUE); -} -- 1.8.3.1