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 LL_IT2STR(it) \
26 ((it) ? ldlm_it2str((it)->it_op) : "0")
28 #define MEA_SIZE_LMV(lmv) \
29 ((lmv)->desc.ld_tgt_count * \
30 sizeof(struct lustre_id) + sizeof(struct mea))
33 struct lustre_id id; /* id of dirobj */
34 unsigned long size; /* slave size value */
38 #define O_FREEING (1 << 0)
41 struct list_head list;
42 struct semaphore guard;
43 int state; /* object state. */
44 atomic_t count; /* ref counter. */
45 struct lustre_id id; /* master id of dir */
46 void *update; /* bitmap of status (up-to-date) */
48 int objcount; /* number of slaves */
49 struct lmv_inode *objs; /* array of dirobjs */
50 struct obd_device *obd; /* pointer to LMV itself */
54 lmv_lock_obj(struct lmv_obj *obj)
61 lmv_unlock_obj(struct lmv_obj *obj)
67 void lmv_add_obj(struct lmv_obj *obj);
68 void lmv_del_obj(struct lmv_obj *obj);
70 void lmv_put_obj(struct lmv_obj *obj);
71 void lmv_free_obj(struct lmv_obj *obj);
73 int lmv_setup_mgr(struct obd_device *obd);
74 void lmv_cleanup_mgr(struct obd_device *obd);
75 int lmv_check_connect(struct obd_device *obd);
77 struct lmv_obj *lmv_get_obj(struct lmv_obj *obj);
79 struct lmv_obj *lmv_grab_obj(struct obd_device *obd,
80 struct lustre_id *id);
82 struct lmv_obj *lmv_alloc_obj(struct obd_device *obd,
86 struct lmv_obj *lmv_create_obj(struct obd_export *exp,
90 int lmv_delete_obj(struct obd_export *exp, struct lustre_id *id);
92 int lmv_intent_lock(struct obd_export *, struct lustre_id *,
93 const char *, int, void *, int,
94 struct lustre_id *, struct lookup_intent *, int,
95 struct ptlrpc_request **, ldlm_blocking_callback);
97 int lmv_intent_lookup(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_getattr(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_open(struct obd_export *, struct lustre_id *, const char *,
108 int, void *, int, struct lustre_id *, struct lookup_intent *,
109 int, struct ptlrpc_request **, ldlm_blocking_callback);
111 int lmv_revalidate_slaves(struct obd_export *, struct ptlrpc_request **,
112 struct lustre_id *, struct lookup_intent *, int,
113 ldlm_blocking_callback cb_blocking);
115 int lmv_get_mea_and_update_object(struct obd_export *, struct lustre_id *);
116 int lmv_dirobj_blocking_ast(struct ldlm_lock *, struct ldlm_lock_desc *,
119 static inline struct mea *
120 lmv_splitted_dir_body(struct ptlrpc_request *req, int offset)
122 struct mds_body *body;
127 body = lustre_msg_buf(req->rq_repmsg, offset, sizeof(*body));
129 if (!body || !S_ISDIR(body->mode) || !body->eadatasize)
132 mea = lustre_msg_buf(req->rq_repmsg, offset + 1,
136 if (mea->mea_count == 0)
143 extern struct file_operations lmv_proc_target_fops;