1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (C) 2001 Cluster File Systems, Inc. <braam@clusterfs.com>
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.
21 * Basic Lustre library routines.
30 # include <sys/types.h>
32 # include <asm/semaphore.h>
33 # include <linux/rwsem.h>
34 # include <linux/sched.h>
35 # include <linux/signal.h>
36 # include <linux/types.h>
38 #include <libcfs/kp30.h>
39 #include <linux/lustre_idl.h>
40 #include <linux/lustre_cfg.h>
43 #if BITS_PER_LONG > 32
44 # define LI_POISON ((int)0x5a5a5a5a5a5a5a5a)
45 # define LL_POISON ((long)0x5a5a5a5a5a5a5a5a)
46 # define LP_POISON ((void *)(long)0x5a5a5a5a5a5a5a5a)
48 # define LI_POISON ((int)0x5a5a5a5a)
49 # define LL_POISON ((long)0x5a5a5a5a)
50 # define LP_POISON ((void *)(long)0x5a5a5a5a)
55 unsigned int ll_rand(void); /* returns a random 32-bit integer */
56 void ll_srand(unsigned int, unsigned int); /* seed the generator */
59 struct ptlrpc_request;
63 #include <linux/lustre_ha.h>
64 #include <linux/lustre_net.h>
65 #include <linux/lustre_compat25.h>
66 #include <linux/lvfs.h>
68 int target_handle_connect(struct ptlrpc_request *req, svc_handler_t handler);
69 int target_handle_disconnect(struct ptlrpc_request *req);
70 void target_destroy_export(struct obd_export *exp);
71 int target_handle_reconnect(struct lustre_handle *conn, struct obd_export *exp,
72 struct obd_uuid *cluuid);
73 int target_handle_ping(struct ptlrpc_request *req);
74 void target_committed_to_req(struct ptlrpc_request *req);
76 #ifdef HAVE_QUOTA_SUPPORT
77 /* quotacheck callback, dqacq/dqrel callback handler */
78 int target_handle_qc_callback(struct ptlrpc_request *req);
79 int target_handle_dqacq_callback(struct ptlrpc_request *req);
81 #define target_handle_dqacq_callback(req) ldlm_callback_reply(req, -ENOTSUPP)
82 #define target_handle_qc_callback(req) (0)
85 void target_cancel_recovery_timer(struct obd_device *obd);
87 #define OBD_RECOVERY_TIMEOUT (obd_timeout * 5 * HZ / 2) /* *waves hands* */
88 void target_start_recovery_timer(struct obd_device *obd, svc_handler_t handler);
89 void target_abort_recovery(void *data);
90 void target_cleanup_recovery(struct obd_device *obd);
91 int target_queue_recovery_request(struct ptlrpc_request *req,
92 struct obd_device *obd);
93 int target_queue_final_reply(struct ptlrpc_request *req, int rc);
94 void target_send_reply(struct ptlrpc_request *req, int rc, int fail_id);
98 int client_sanobd_setup(struct obd_device *obddev, struct lustre_cfg* lcfg);
99 struct client_obd *client_conn2cli(struct lustre_handle *conn);
101 struct mdc_open_data;
102 struct obd_client_handle {
103 struct lustre_handle och_fh;
104 struct llog_cookie och_cookie;
105 struct mdc_open_data *och_mod;
108 #define OBD_CLIENT_HANDLE_MAGIC 0xd15ea5ed
111 void statfs_pack(struct obd_statfs *osfs, struct kstatfs *sfs);
112 void statfs_unpack(struct kstatfs *sfs, struct obd_statfs *osfs);
117 struct task_struct *l_owner;
118 struct semaphore l_sem;
122 void l_lock_init(struct lustre_lock *);
123 void l_lock(struct lustre_lock *);
124 void l_unlock(struct lustre_lock *);
125 int l_has_lock(struct lustre_lock *);
131 #define OBD_IOCTL_VERSION 0x00010004
133 struct obd_ioctl_data {
135 uint32_t ioc_version;
141 struct obdo ioc_obdo1;
142 struct obdo ioc_obdo2;
147 uint32_t ioc_command;
153 /* buffers the kernel will treat as user pointers */
159 /* inline buffers for various arguments */
160 uint32_t ioc_inllen1;
162 uint32_t ioc_inllen2;
164 uint32_t ioc_inllen3;
166 uint32_t ioc_inllen4;
172 struct obd_ioctl_hdr {
174 uint32_t ioc_version;
177 static inline int obd_ioctl_packlen(struct obd_ioctl_data *data)
179 int len = size_round(sizeof(struct obd_ioctl_data));
180 len += size_round(data->ioc_inllen1);
181 len += size_round(data->ioc_inllen2);
182 len += size_round(data->ioc_inllen3);
183 len += size_round(data->ioc_inllen4);
188 static inline int obd_ioctl_is_invalid(struct obd_ioctl_data *data)
190 if (data->ioc_len > (1<<30)) {
191 CERROR("OBD ioctl: ioc_len larger than 1<<30\n");
194 if (data->ioc_inllen1 > (1<<30)) {
195 CERROR("OBD ioctl: ioc_inllen1 larger than 1<<30\n");
198 if (data->ioc_inllen2 > (1<<30)) {
199 CERROR("OBD ioctl: ioc_inllen2 larger than 1<<30\n");
202 if (data->ioc_inllen3 > (1<<30)) {
203 CERROR("OBD ioctl: ioc_inllen3 larger than 1<<30\n");
206 if (data->ioc_inllen4 > (1<<30)) {
207 CERROR("OBD ioctl: ioc_inllen4 larger than 1<<30\n");
210 if (data->ioc_inlbuf1 && !data->ioc_inllen1) {
211 CERROR("OBD ioctl: inlbuf1 pointer but 0 length\n");
214 if (data->ioc_inlbuf2 && !data->ioc_inllen2) {
215 CERROR("OBD ioctl: inlbuf2 pointer but 0 length\n");
218 if (data->ioc_inlbuf3 && !data->ioc_inllen3) {
219 CERROR("OBD ioctl: inlbuf3 pointer but 0 length\n");
222 if (data->ioc_inlbuf4 && !data->ioc_inllen4) {
223 CERROR("OBD ioctl: inlbuf4 pointer but 0 length\n");
226 if (data->ioc_pbuf1 && !data->ioc_plen1) {
227 CERROR("OBD ioctl: pbuf1 pointer but 0 length\n");
230 if (data->ioc_pbuf2 && !data->ioc_plen2) {
231 CERROR("OBD ioctl: pbuf2 pointer but 0 length\n");
234 if (data->ioc_plen1 && !data->ioc_pbuf1) {
235 CERROR("OBD ioctl: plen1 set but NULL pointer\n");
238 if (data->ioc_plen2 && !data->ioc_pbuf2) {
239 CERROR("OBD ioctl: plen2 set but NULL pointer\n");
242 if (obd_ioctl_packlen(data) > data->ioc_len) {
243 CERROR("OBD ioctl: packlen exceeds ioc_len (%d > %d)\n",
244 obd_ioctl_packlen(data), data->ioc_len);
251 static inline int obd_ioctl_pack(struct obd_ioctl_data *data, char **pbuf,
255 struct obd_ioctl_data *overlay;
256 data->ioc_len = obd_ioctl_packlen(data);
257 data->ioc_version = OBD_IOCTL_VERSION;
259 if (*pbuf && data->ioc_len > max)
262 *pbuf = malloc(data->ioc_len);
266 overlay = (struct obd_ioctl_data *)*pbuf;
267 memcpy(*pbuf, data, sizeof(*data));
269 ptr = overlay->ioc_bulk;
270 if (data->ioc_inlbuf1)
271 LOGL(data->ioc_inlbuf1, data->ioc_inllen1, ptr);
272 if (data->ioc_inlbuf2)
273 LOGL(data->ioc_inlbuf2, data->ioc_inllen2, ptr);
274 if (data->ioc_inlbuf3)
275 LOGL(data->ioc_inlbuf3, data->ioc_inllen3, ptr);
276 if (data->ioc_inlbuf4)
277 LOGL(data->ioc_inlbuf4, data->ioc_inllen4, ptr);
278 if (obd_ioctl_is_invalid(overlay))
284 static inline int obd_ioctl_unpack(struct obd_ioctl_data *data, char *pbuf,
288 struct obd_ioctl_data *overlay;
292 overlay = (struct obd_ioctl_data *)pbuf;
294 /* Preserve the caller's buffer pointers */
295 overlay->ioc_inlbuf1 = data->ioc_inlbuf1;
296 overlay->ioc_inlbuf2 = data->ioc_inlbuf2;
297 overlay->ioc_inlbuf3 = data->ioc_inlbuf3;
298 overlay->ioc_inlbuf4 = data->ioc_inlbuf4;
300 memcpy(data, pbuf, sizeof(*data));
302 ptr = overlay->ioc_bulk;
303 if (data->ioc_inlbuf1)
304 LOGU(data->ioc_inlbuf1, data->ioc_inllen1, ptr);
305 if (data->ioc_inlbuf2)
306 LOGU(data->ioc_inlbuf2, data->ioc_inllen2, ptr);
307 if (data->ioc_inlbuf3)
308 LOGU(data->ioc_inlbuf3, data->ioc_inllen3, ptr);
309 if (data->ioc_inlbuf4)
310 LOGU(data->ioc_inlbuf4, data->ioc_inllen4, ptr);
316 #include <linux/obd_support.h>
318 /* buffer MUST be at least the size of obd_ioctl_hdr */
319 static inline int obd_ioctl_getdata(char **buf, int *len, void *arg)
321 struct obd_ioctl_hdr hdr;
322 struct obd_ioctl_data *data;
327 err = copy_from_user(&hdr, (void *)arg, sizeof(hdr));
331 if (hdr.ioc_version != OBD_IOCTL_VERSION) {
332 CERROR("Version mismatch kernel vs application\n");
336 if (hdr.ioc_len > OBD_MAX_IOCTL_BUFFER) {
337 CERROR("User buffer len %d exceeds %d max buffer\n",
338 hdr.ioc_len, OBD_MAX_IOCTL_BUFFER);
342 if (hdr.ioc_len < sizeof(struct obd_ioctl_data)) {
343 CERROR("user buffer too small for ioctl (%d)\n", hdr.ioc_len);
347 /* XXX allocate this more intelligently, using kmalloc when
349 OBD_VMALLOC(*buf, hdr.ioc_len);
351 CERROR("Cannot allocate control buffer of len %d\n",
356 data = (struct obd_ioctl_data *)*buf;
358 err = copy_from_user(*buf, (void *)arg, hdr.ioc_len);
360 OBD_VFREE(*buf, hdr.ioc_len);
364 if (obd_ioctl_is_invalid(data)) {
365 CERROR("ioctl not correctly formatted\n");
366 OBD_VFREE(*buf, hdr.ioc_len);
370 if (data->ioc_inllen1) {
371 data->ioc_inlbuf1 = &data->ioc_bulk[0];
372 offset += size_round(data->ioc_inllen1);
375 if (data->ioc_inllen2) {
376 data->ioc_inlbuf2 = &data->ioc_bulk[0] + offset;
377 offset += size_round(data->ioc_inllen2);
380 if (data->ioc_inllen3) {
381 data->ioc_inlbuf3 = &data->ioc_bulk[0] + offset;
382 offset += size_round(data->ioc_inllen3);
385 if (data->ioc_inllen4) {
386 data->ioc_inlbuf4 = &data->ioc_bulk[0] + offset;
392 static inline void obd_ioctl_freedata(char *buf, int len)
401 #define OBD_IOC_CREATE _IOR ('f', 101, long)
402 #define OBD_IOC_DESTROY _IOW ('f', 104, long)
403 #define OBD_IOC_PREALLOCATE _IOWR('f', 105, long)
405 #define OBD_IOC_SETATTR _IOW ('f', 107, long)
406 #define OBD_IOC_GETATTR _IOR ('f', 108, long)
407 #define OBD_IOC_READ _IOWR('f', 109, long)
408 #define OBD_IOC_WRITE _IOWR('f', 110, long)
411 #define OBD_IOC_STATFS _IOWR('f', 113, long)
412 #define OBD_IOC_SYNC _IOW ('f', 114, long)
413 #define OBD_IOC_READ2 _IOWR('f', 115, long)
414 #define OBD_IOC_FORMAT _IOWR('f', 116, long)
415 #define OBD_IOC_PARTITION _IOWR('f', 117, long)
416 #define OBD_IOC_COPY _IOWR('f', 120, long)
417 #define OBD_IOC_MIGR _IOWR('f', 121, long)
418 #define OBD_IOC_PUNCH _IOWR('f', 122, long)
420 #define OBD_IOC_MODULE_DEBUG _IOWR('f', 124, long)
421 #define OBD_IOC_BRW_READ _IOWR('f', 125, long)
422 #define OBD_IOC_BRW_WRITE _IOWR('f', 126, long)
423 #define OBD_IOC_NAME2DEV _IOWR('f', 127, long)
424 #define OBD_IOC_UUID2DEV _IOWR('f', 130, long)
425 #define OBD_IOC_GETNAME _IOR ('f', 131, long)
427 #define OBD_IOC_LOV_GET_CONFIG _IOWR('f', 132, long)
428 #define OBD_IOC_CLIENT_RECOVER _IOW ('f', 133, long)
430 #define OBD_IOC_DEC_FS_USE_COUNT _IO ('f', 139 )
431 #define OBD_IOC_NO_TRANSNO _IOW ('f', 140, long)
432 #define OBD_IOC_SET_READONLY _IOW ('f', 141, long)
433 #define OBD_IOC_ABORT_RECOVERY _IOR ('f', 142, long)
435 #define OBD_GET_VERSION _IOWR ('f', 144, long)
437 #define OBD_IOC_CLOSE_UUID _IOWR ('f', 147, long)
439 #define OBD_IOC_LOV_SETSTRIPE _IOW ('f', 154, long)
440 #define OBD_IOC_LOV_GETSTRIPE _IOW ('f', 155, long)
441 #define OBD_IOC_LOV_SETEA _IOW ('f', 156, long)
443 #define OBD_IOC_QUOTACHECK _IOW ('f', 160, int)
444 #define OBD_IOC_POLL_QUOTACHECK _IOR ('f', 161, struct if_quotacheck *)
445 #define OBD_IOC_QUOTACTL _IOWR('f', 162, struct if_quotactl *)
447 #define OBD_IOC_MOUNTOPT _IOWR('f', 170, long)
449 #define OBD_IOC_RECORD _IOWR('f', 180, long)
450 #define OBD_IOC_ENDRECORD _IOWR('f', 181, long)
451 #define OBD_IOC_PARSE _IOWR('f', 182, long)
452 #define OBD_IOC_DORECORD _IOWR('f', 183, long)
453 #define OBD_IOC_PROCESS_CFG _IOWR('f', 184, long)
454 #define OBD_IOC_DUMP_LOG _IOWR('f', 185, long)
455 #define OBD_IOC_CLEAR_LOG _IOWR('f', 186, long)
456 #define OBD_IOC_PARAM _IOW ('f', 187, long)
458 #define OBD_IOC_CATLOGLIST _IOWR('f', 190, long)
459 #define OBD_IOC_LLOG_INFO _IOWR('f', 191, long)
460 #define OBD_IOC_LLOG_PRINT _IOWR('f', 192, long)
461 #define OBD_IOC_LLOG_CANCEL _IOWR('f', 193, long)
462 #define OBD_IOC_LLOG_REMOVE _IOWR('f', 194, long)
463 #define OBD_IOC_LLOG_CHECK _IOWR('f', 195, long)
464 #define OBD_IOC_LLOG_CATINFO _IOWR('f', 196, long)
466 #define ECHO_IOC_GET_STRIPE _IOWR('f', 200, long)
467 #define ECHO_IOC_SET_STRIPE _IOWR('f', 201, long)
468 #define ECHO_IOC_ENQUEUE _IOWR('f', 202, long)
469 #define ECHO_IOC_CANCEL _IOWR('f', 203, long)
471 /* XXX _IOWR('f', 250, long) has been defined in
472 * lnet/include/libcfs/kp30.h for debug, don't use it
475 /* Until such time as we get_info the per-stripe maximum from the OST,
476 * we define this to be 2T - 4k, which is the ext3 maxbytes. */
477 #define LUSTRE_STRIPE_MAXBYTES 0x1fffffff000ULL
479 #define POISON_BULK 0
482 * l_wait_event is a flexible sleeping function, permitting simple caller
483 * configuration of interrupt and timeout sensitivity along with actions to
484 * be performed in the event of either exception.
486 * The first form of usage looks like this:
488 * struct l_wait_info lwi = LWI_TIMEOUT_INTR(timeout, timeout_handler,
489 * intr_handler, callback_data);
490 * rc = l_wait_event(waitq, condition, &lwi);
492 * l_wait_event() makes the current process wait on 'waitq' until 'condition'
493 * is TRUE or a "killable" signal (SIGTERM, SIKGILL, SIGINT) is pending. It
494 * returns 0 to signify 'condition' is TRUE, but if a signal wakes it before
495 * 'condition' becomes true, it optionally calls the specified 'intr_handler'
496 * if not NULL, and returns -EINTR.
498 * If a non-zero timeout is specified, signals are ignored until the timeout
499 * has expired. At this time, if 'timeout_handler' is not NULL it is called.
500 * If it returns FALSE l_wait_event() continues to wait as described above with
501 * signals enabled. Otherwise it returns -ETIMEDOUT.
503 * LWI_INTR(intr_handler, callback_data) is shorthand for
504 * LWI_TIMEOUT_INTR(0, NULL, intr_handler, callback_data)
506 * The second form of usage looks like this:
508 * struct l_wait_info lwi = LWI_TIMEOUT(timeout, timeout_handler);
509 * rc = l_wait_event(waitq, condition, &lwi);
511 * This form is the same as the first except that it COMPLETELY IGNORES
512 * SIGNALS. The caller must therefore beware that if 'timeout' is zero, or if
513 * 'timeout_handler' is not NULL and returns FALSE, then the ONLY thing that
514 * can unblock the current process is 'condition' becoming TRUE.
516 * Another form of usage is:
517 * struct l_wait_info lwi = LWI_TIMEOUT_INTERVAL(timeout, interval,
519 * rc = l_wait_event(waitq, condition, &lwi);
520 * This is the same as previous case, but condition is checked once every
521 * 'interval' jiffies (if non-zero).
523 * Subtle synchronization point: this macro does *not* necessary takes
524 * wait-queue spin-lock before returning, and, hence, following idiom is safe
525 * ONLY when caller provides some external locking:
529 * l_wait_event(&obj->wq, ....); (1)
531 * wake_up(&obj->wq): (2)
532 * spin_lock(&q->lock); (2.1)
533 * __wake_up_common(q, ...); (2.2)
534 * spin_unlock(&q->lock, flags); (2.3)
536 * OBD_FREE_PTR(obj); (3)
538 * As l_wait_event() may "short-cut" execution and return without taking
539 * wait-queue spin-lock, some additional synchronization is necessary to
540 * guarantee that step (3) can begin only after (2.3) finishes.
542 * XXX nikita: some ptlrpc daemon threads have races of that sort.
546 #define LWI_ON_SIGNAL_NOOP ((void (*)(void *))(-1))
551 int (*lwi_on_timeout)(void *);
552 void (*lwi_on_signal)(void *);
556 /* NB: LWI_TIMEOUT ignores signals completely */
557 #define LWI_TIMEOUT(time, cb, data) \
558 ((struct l_wait_info) { \
559 .lwi_timeout = time, \
560 .lwi_on_timeout = cb, \
561 .lwi_cb_data = data, \
565 #define LWI_TIMEOUT_INTERVAL(time, interval, cb, data) \
566 ((struct l_wait_info) { \
567 .lwi_timeout = time, \
568 .lwi_on_timeout = cb, \
569 .lwi_cb_data = data, \
570 .lwi_interval = interval \
574 #define LWI_TIMEOUT_INTR(time, time_cb, sig_cb, data) \
575 ((struct l_wait_info) { \
576 .lwi_timeout = time, \
577 .lwi_on_timeout = time_cb, \
578 .lwi_on_signal = (sig_cb == NULL) ? LWI_ON_SIGNAL_NOOP : sig_cb, \
579 .lwi_cb_data = data, \
583 #define LWI_INTR(cb, data) LWI_TIMEOUT_INTR(0, NULL, cb, data)
585 #define LUSTRE_FATAL_SIGS (sigmask(SIGKILL) | sigmask(SIGINT) | \
586 sigmask(SIGTERM) | sigmask(SIGQUIT) | \
590 static inline sigset_t l_w_e_set_sigs(int sigs)
593 unsigned long irqflags;
595 SIGNAL_MASK_LOCK(current, irqflags);
596 old = current->blocked;
597 siginitsetinv(¤t->blocked, sigs);
599 SIGNAL_MASK_UNLOCK(current, irqflags);
605 * wait for @condition to become true, but no longer than timeout, specified
608 #define __l_wait_event(wq, condition, info, ret, excl) \
610 wait_queue_t __wait; \
611 unsigned long __timeout = info->lwi_timeout; \
612 unsigned long __irqflags; \
613 sigset_t __blocked; \
619 init_waitqueue_entry(&__wait, current); \
621 add_wait_queue_exclusive(&wq, &__wait); \
623 add_wait_queue(&wq, &__wait); \
625 /* Block all signals (just the non-fatal ones if no timeout). */ \
626 if (info->lwi_on_signal != NULL && __timeout == 0) \
627 __blocked = l_w_e_set_sigs(LUSTRE_FATAL_SIGS); \
629 __blocked = l_w_e_set_sigs(0); \
632 set_current_state(TASK_INTERRUPTIBLE); \
637 if (__timeout == 0) { \
640 unsigned long interval = info->lwi_interval? \
641 min_t(unsigned long, \
642 info->lwi_interval,__timeout):\
644 __timeout -= interval - schedule_timeout(interval); \
645 if (__timeout == 0) { \
646 if (info->lwi_on_timeout == NULL || \
647 info->lwi_on_timeout(info->lwi_cb_data)) { \
651 /* Take signals after the timeout expires. */ \
652 if (info->lwi_on_signal != NULL) \
653 (void)l_w_e_set_sigs(LUSTRE_FATAL_SIGS); \
660 if (signal_pending(current)) { \
661 if (info->lwi_on_signal != NULL && __timeout == 0) { \
662 if (info->lwi_on_signal != LWI_ON_SIGNAL_NOOP) \
663 info->lwi_on_signal(info->lwi_cb_data);\
667 /* We have to do this here because some signals */ \
668 /* are not blockable - ie from strace(1). */ \
669 /* In these cases we want to schedule_timeout() */ \
670 /* again, because we don't want that to return */ \
671 /* -EINTR when the RPC actually succeeded. */ \
672 /* the RECALC_SIGPENDING below will deliver the */ \
673 /* signal properly. */ \
674 SIGNAL_MASK_LOCK(current, __irqflags); \
676 SIGNAL_MASK_UNLOCK(current, __irqflags); \
680 SIGNAL_MASK_LOCK(current, __irqflags); \
681 current->blocked = __blocked; \
683 SIGNAL_MASK_UNLOCK(current, __irqflags); \
685 current->state = TASK_RUNNING; \
686 remove_wait_queue(&wq, &__wait); \
689 #else /* !__KERNEL__ */
690 #define __l_wait_event(wq, condition, info, ret, excl) \
692 long __timeout = info->lwi_timeout; \
695 int __timed_out = 0; \
701 if (__timeout == 0) \
702 __timeout = 1000000000; \
704 __then = time(NULL); \
706 while (!(condition)) { \
707 if (liblustre_wait_event(info->lwi_interval?:__timeout) || \
708 (info->lwi_interval && info->lwi_interval < __timeout)) {\
709 if (__timeout != 0 && info->lwi_timeout != 0) { \
710 __now = time(NULL); \
711 __timeout -= __now - __then; \
719 if (info->lwi_timeout != 0 && !__timed_out) { \
721 if (info->lwi_on_timeout == NULL || \
722 info->lwi_on_timeout(info->lwi_cb_data)) { \
730 #endif /* __KERNEL__ */
732 #define l_wait_event(wq, condition, info) \
735 struct l_wait_info *__info = (info); \
737 __l_wait_event(wq, condition, __info, __ret, 0); \
741 #define l_wait_event_exclusive(wq, condition, info) \
744 struct l_wait_info *__info = (info); \
746 __l_wait_event(wq, condition, __info, __ret, 1); \
751 /* initialize ost_lvb according to inode */
752 static inline void inode_init_lvb(struct inode *inode, struct ost_lvb *lvb)
754 lvb->lvb_size = inode->i_size;
755 lvb->lvb_blocks = inode->i_blocks;
756 lvb->lvb_mtime = LTIME_S(inode->i_mtime);
757 lvb->lvb_atime = LTIME_S(inode->i_atime);
758 lvb->lvb_ctime = LTIME_S(inode->i_ctime);
761 /* defined in liblustre/llite_lib.h */
765 #define LIBLUSTRE_CLIENT (0)
767 #define LIBLUSTRE_CLIENT (1)
770 #endif /* _LUSTRE_LIB_H */