1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (C) 2002, 2003, 2004 Cluster File Systems, Inc.
6 * This file is part of Lustre, http://www.lustre.org.
8 * Lustre is free software; you can redistribute it and/or
9 * modify it under the terms of version 2 of the GNU General Public
10 * License as published by the Free Software Foundation.
12 * Lustre is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Lustre; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #ifndef _LMV_INTERNAL_H_
23 #define _LMV_INTERNAL_H_
25 #define LMV_MAX_TGT_COUNT 128
27 #define lmv_init_lock(lmv) down(&lmv->init_sem);
28 #define lmv_init_unlock(lmv) up(&lmv->init_sem);
30 #define LL_IT2STR(it) \
31 ((it) ? ldlm_it2str((it)->it_op) : "0")
33 #define MEA_SIZE_LMV(lmv) \
34 ((lmv)->desc.ld_tgt_count * \
35 sizeof(struct lustre_id) + sizeof(struct mea))
38 struct lustre_id id; /* id of dirobj */
39 unsigned long size; /* slave size value */
43 #define O_FREEING (1 << 0)
46 struct list_head list;
47 struct semaphore guard;
48 int state; /* object state. */
49 atomic_t count; /* ref counter. */
50 struct lustre_id id; /* master id of dir */
51 void *update; /* bitmap of status (up-to-date) */
53 int objcount; /* number of slaves */
54 struct lmv_inode *objs; /* array of dirobjs */
55 struct obd_device *obd; /* pointer to LMV itself */
59 lmv_lock_obj(struct lmv_obj *obj)
66 lmv_unlock_obj(struct lmv_obj *obj)
72 void lmv_add_obj(struct lmv_obj *obj);
73 void lmv_del_obj(struct lmv_obj *obj);
75 void lmv_put_obj(struct lmv_obj *obj);
76 void lmv_free_obj(struct lmv_obj *obj);
78 int lmv_setup_mgr(struct obd_device *obd);
79 void lmv_cleanup_mgr(struct obd_device *obd);
80 int lmv_check_connect(struct obd_device *obd);
82 struct lmv_obj *lmv_get_obj(struct lmv_obj *obj);
84 struct lmv_obj *lmv_grab_obj(struct obd_device *obd,
85 struct lustre_id *id);
87 struct lmv_obj *lmv_alloc_obj(struct obd_device *obd,
91 struct lmv_obj *lmv_create_obj(struct obd_export *exp,
95 int lmv_delete_obj(struct obd_export *exp, struct lustre_id *id);
97 int lmv_intent_lock(struct obd_export *, struct lustre_id *,
98 const char *, int, void *, int,
99 struct lustre_id *, struct lookup_intent *, int,
100 struct ptlrpc_request **, ldlm_blocking_callback);
102 int lmv_intent_lookup(struct obd_export *, struct lustre_id *,
103 const char *, int, void *, int,
104 struct lustre_id *, struct lookup_intent *, int,
105 struct ptlrpc_request **, ldlm_blocking_callback);
107 int lmv_intent_getattr(struct obd_export *, struct lustre_id *,
108 const char *, int, void *, int,
109 struct lustre_id *, struct lookup_intent *, int,
110 struct ptlrpc_request **, ldlm_blocking_callback);
112 int lmv_intent_open(struct obd_export *, struct lustre_id *, const char *,
113 int, void *, int, struct lustre_id *, struct lookup_intent *,
114 int, struct ptlrpc_request **, ldlm_blocking_callback);
116 int lmv_revalidate_slaves(struct obd_export *, struct ptlrpc_request **,
117 struct lustre_id *, struct lookup_intent *, int,
118 ldlm_blocking_callback cb_blocking);
120 int lmv_get_mea_and_update_object(struct obd_export *, struct lustre_id *);
121 int lmv_dirobj_blocking_ast(struct ldlm_lock *, struct ldlm_lock_desc *,
124 static inline struct mea *
125 lmv_splitted_dir_body(struct ptlrpc_request *req, int offset)
127 struct mds_body *body;
132 body = lustre_msg_buf(req->rq_repmsg, offset, sizeof(*body));
134 if (!body || !S_ISDIR(body->mode) || !body->eadatasize)
137 mea = lustre_msg_buf(req->rq_repmsg, offset + 1,
141 if (mea->mea_count == 0)
148 extern struct file_operations lmv_proc_target_fops;