From: adilger Date: Fri, 5 Mar 2004 03:52:30 +0000 (+0000) Subject: Land b1_2 onto HEAD (20040304_171022) X-Git-Tag: v1_7_100~2513 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=ff17cc7e0282d9b1522810e0c5d12171c4d46a2d Land b1_2 onto HEAD (20040304_171022) b=2733, b=2773, b=2529, b=2730, b=2819, b=2814, b=2822, b=1450, b=2676, b=2681 b=2817, b=2706, b=2816, b=1987, b=2884, b=1191, b=2809, b=2765, b=2805, b=1972 --- diff --git a/lnet/include/linux/kp30.h b/lnet/include/linux/kp30.h index 53828de..c080a57 100644 --- a/lnet/include/linux/kp30.h +++ b/lnet/include/linux/kp30.h @@ -21,57 +21,57 @@ extern unsigned int portal_debug; extern unsigned int portal_printk; extern unsigned int portal_cerror; /* Debugging subsystems (32 bits, non-overlapping) */ -#define S_UNDEFINED (1 << 0) -#define S_MDC (1 << 1) -#define S_MDS (1 << 2) -#define S_OSC (1 << 3) -#define S_OST (1 << 4) -#define S_CLASS (1 << 5) -#define S_LOG (1 << 6) -#define S_LLITE (1 << 7) -#define S_RPC (1 << 8) -#define S_MGMT (1 << 9) -#define S_PORTALS (1 << 10) -#define S_SOCKNAL (1 << 11) -#define S_QSWNAL (1 << 12) -#define S_PINGER (1 << 13) -#define S_FILTER (1 << 14) -#define S_PTLBD (1 << 15) -#define S_ECHO (1 << 16) -#define S_LDLM (1 << 17) -#define S_LOV (1 << 18) -#define S_GMNAL (1 << 19) -#define S_PTLROUTER (1 << 20) -#define S_COBD (1 << 21) -#define S_IBNAL (1 << 22) +#define S_UNDEFINED 0x00000001 +#define S_MDC 0x00000002 +#define S_MDS 0x00000004 +#define S_OSC 0x00000008 +#define S_OST 0x00000010 +#define S_CLASS 0x00000020 +#define S_LOG 0x00000040 +#define S_LLITE 0x00000080 +#define S_RPC 0x00000100 +#define S_MGMT 0x00000200 +#define S_PORTALS 0x00000400 +#define S_SOCKNAL 0x00000800 +#define S_QSWNAL 0x00001000 +#define S_PINGER 0x00002000 +#define S_FILTER 0x00004000 +#define S_PTLBD 0x00008000 +#define S_ECHO 0x00010000 +#define S_LDLM 0x00020000 +#define S_LOV 0x00040000 +#define S_GMNAL 0x00080000 +#define S_PTLROUTER 0x00100000 +#define S_COBD 0x00200000 +#define S_IBNAL 0x00400000 /* If you change these values, please keep portals/utils/debug.c * up to date! */ /* Debugging masks (32 bits, non-overlapping) */ -#define D_TRACE (1 << 0) /* ENTRY/EXIT markers */ -#define D_INODE (1 << 1) -#define D_SUPER (1 << 2) -#define D_EXT2 (1 << 3) /* anything from ext2_debug */ -#define D_MALLOC (1 << 4) /* print malloc, free information */ -#define D_CACHE (1 << 5) /* cache-related items */ -#define D_INFO (1 << 6) /* general information */ -#define D_IOCTL (1 << 7) /* ioctl related information */ -#define D_BLOCKS (1 << 8) /* ext2 block allocation */ -#define D_NET (1 << 9) /* network communications */ -#define D_WARNING (1 << 10) /* CWARN(...) == CDEBUG (D_WARNING, ...) */ -#define D_BUFFS (1 << 11) -#define D_OTHER (1 << 12) -#define D_DENTRY (1 << 13) -#define D_PORTALS (1 << 14) /* ENTRY/EXIT markers */ -#define D_PAGE (1 << 15) /* bulk page handling */ -#define D_DLMTRACE (1 << 16) -#define D_ERROR (1 << 17) /* CERROR(...) == CDEBUG (D_ERROR, ...) */ -#define D_EMERG (1 << 18) /* CEMERG(...) == CDEBUG (D_EMERG, ...) */ -#define D_HA (1 << 19) /* recovery and failover */ -#define D_RPCTRACE (1 << 20) /* for distributed debugging */ -#define D_VFSTRACE (1 << 21) -#define D_READA (1 << 22) /* read-ahead */ +#define D_TRACE 0x00000001 /* ENTRY/EXIT markers */ +#define D_INODE 0x00000002 +#define D_SUPER 0x00000004 +#define D_EXT2 0x00000008 /* anything from ext2_debug */ +#define D_MALLOC 0x00000010 /* print malloc, free information */ +#define D_CACHE 0x00000020 /* cache-related items */ +#define D_INFO 0x00000040 /* general information */ +#define D_IOCTL 0x00000080 /* ioctl related information */ +#define D_BLOCKS 0x00000100 /* ext2 block allocation */ +#define D_NET 0x00000200 /* network communications */ +#define D_WARNING 0x00000400 /* CWARN(...) == CDEBUG (D_WARNING, ...) */ +#define D_BUFFS 0x00000800 +#define D_OTHER 0x00001000 +#define D_DENTRY 0x00002000 +#define D_PORTALS 0x00004000 /* ENTRY/EXIT markers */ +#define D_PAGE 0x00008000 /* bulk page handling */ +#define D_DLMTRACE 0x00010000 +#define D_ERROR 0x00020000 /* CERROR(...) == CDEBUG (D_ERROR, ...) */ +#define D_EMERG 0x00040000 /* CEMERG(...) == CDEBUG (D_EMERG, ...) */ +#define D_HA 0x00080000 /* recovery and failover */ +#define D_RPCTRACE 0x00100000 /* for distributed debugging */ +#define D_VFSTRACE 0x00200000 +#define D_READA 0x00400000 /* read-ahead */ #ifdef __KERNEL__ # include /* THREAD_SIZE */ @@ -234,6 +234,12 @@ extern void kportal_assertion_failed(char *expr, char *file, const char *func, #define LASSERTF(cond, fmt...) do { } while (0) #endif +#ifdef CONFIG_SMP +#define LASSERT_SPIN_LOCKED(lock) LASSERT(spin_is_locked(lock)) +#else +#define LASSERT_SPIN_LOCKED(lock) do {} while(0) +#endif + #ifdef __arch_um__ #define LBUG_WITH_LOC(file, func, line) \ do { \ diff --git a/lnet/klnds/socklnd/socklnd_cb.c b/lnet/klnds/socklnd/socklnd_cb.c index 72bd0b7..c89e20e 100644 --- a/lnet/klnds/socklnd/socklnd_cb.c +++ b/lnet/klnds/socklnd/socklnd_cb.c @@ -760,19 +760,19 @@ ksocknal_find_target_peer_locked (ksock_tx_t *tx, ptl_nid_t nid) } ksock_conn_t * -ksocknal_find_conn_locked (ksock_tx_t *tx, ksock_peer_t *peer) +ksocknal_find_conn_locked (ksock_tx_t *tx, ksock_peer_t *peer) { struct list_head *tmp; ksock_conn_t *typed = NULL; int tnob = 0; ksock_conn_t *fallback = NULL; int fnob = 0; - + /* Find the conn with the shortest tx queue */ list_for_each (tmp, &peer->ksnp_conns) { ksock_conn_t *c = list_entry(tmp, ksock_conn_t, ksnc_list); int nob = atomic_read(&c->ksnc_tx_nob) + - c->ksnc_sock->sk->sk_wmem_queued; + c->ksnc_sock->sk->sk_wmem_queued; LASSERT (!c->ksnc_closing); diff --git a/lnet/lnet/api-init.c b/lnet/lnet/api-init.c index b811391..e2921ac 100644 --- a/lnet/lnet/api-init.c +++ b/lnet/lnet/api-init.c @@ -29,7 +29,7 @@ int ptl_init; unsigned int portal_subsystem_debug = ~0 - (S_PORTALS | S_QSWNAL | S_SOCKNAL | S_GMNAL | S_IBNAL); unsigned int portal_debug = (D_WARNING | D_DLMTRACE | D_ERROR | D_EMERG | D_HA | - D_RPCTRACE | D_VFSTRACE); + D_RPCTRACE | D_VFSTRACE | D_MALLOC); unsigned int portal_cerror = 1; unsigned int portal_printk; unsigned int portal_stack; diff --git a/lnet/ulnds/procapi.c b/lnet/ulnds/procapi.c index bddfe9a..c27f555 100644 --- a/lnet/ulnds/procapi.c +++ b/lnet/ulnds/procapi.c @@ -71,7 +71,7 @@ void procbridge_wakeup_nal(procbridge p) * side, and collects the result */ static int procbridge_forward(nal_t *n, int id, void *args, size_t args_len, - void *ret, ptl_size_t ret_len) + void *ret, size_t ret_len) { bridge b = (bridge) n->nal_data; diff --git a/lnet/ulnds/socklnd/procapi.c b/lnet/ulnds/socklnd/procapi.c index bddfe9a..c27f555 100644 --- a/lnet/ulnds/socklnd/procapi.c +++ b/lnet/ulnds/socklnd/procapi.c @@ -71,7 +71,7 @@ void procbridge_wakeup_nal(procbridge p) * side, and collects the result */ static int procbridge_forward(nal_t *n, int id, void *args, size_t args_len, - void *ret, ptl_size_t ret_len) + void *ret, size_t ret_len) { bridge b = (bridge) n->nal_data; diff --git a/lnet/utils/debug.c b/lnet/utils/debug.c index 2ca4dc3..01e690f 100644 --- a/lnet/utils/debug.c +++ b/lnet/utils/debug.c @@ -66,7 +66,8 @@ static int debug_mask = ~0; static const char *portal_debug_subsystems[] = {"undefined", "mdc", "mds", "osc", "ost", "class", "log", "llite", "rpc", "mgmt", "portals", "socknal", "qswnal", "pinger", "filter", - "ptlbd", "echo", "ldlm", "lov", "gmnal", "router", "cobd", NULL}; + "ptlbd", "echo", "ldlm", "lov", "gmnal", "router", "cobd", "ibnal", + NULL}; static const char *portal_debug_masks[] = {"trace", "inode", "super", "ext2", "malloc", "cache", "info", "ioctl", "blocks", "net", "warning", "buffs", "other", "dentry", "portals", diff --git a/lustre/ChangeLog b/lustre/ChangeLog index 0a5e0de..274a565 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -1,4 +1,4 @@ -tbd Cluster File Systems, Inc. +2004-03-04 Cluster File Systems, Inc. * version 1.2.0 * bug fixes - account for cache space usage on clients to avoid data loss (974) @@ -19,6 +19,7 @@ tbd Cluster File Systems, Inc. - ptlrpc cleanup bug (2710) - mds timeout on local locks (2588) - namespace lock held during RPCs (2431) + - handle interrupted sync write properly (2503) - don't try to handle a message that hasn't been replied to (2699) - client assert failure during cleanup after abort recovery (2701) - leak mdc device after failed mount (2712) @@ -37,8 +38,27 @@ tbd Cluster File Systems, Inc. - don't delete objects on OST if given a bogus objid from MDS (2751) - handle large client PAGE_SIZE readdir on small PAGE_SIZE MDS (2777) - if rq_no_resend, then timeout request after recovery (2432) + - fix MDS llog_logid record size, 64-bit array alignment (2733) + - don't call usermode_helper from ptlrpcd, DEFAULT upcall (2773) + - put magic in mount.lustre data, check for bad/NULL mount data (2529) + - MDS recovery shouldn't delete objects that it has given out (2730) + - if enqueue arrives after completion, don't clobber LVB (2819) + - don't unlock pages twice when trigger_group_io returns error (2814) + - don't deref NULL rq_repmsg if ldlm_handle_enqueue failed (2822) + - don't write pages to disk if there was an error (1450) + - don't ping imports that have recovery disabled (2676) + - take buffered bytes into account when balancing socknal conn (2817) + - hold a DLM lock over readdir always, use truncate_inode_pages (2706) + - reconnect unlink llog connection after MDS reconnects to OST (2816) + - remove little-endian swabbing of llog records (1987) + - set/limit i_blksize to LL_MAX_BLKSIZE on client (2884) + - retry reposting request buffers if they fail (1191) + - grow extent at grant time to avoid granting a revoked lock (2809) + - lock revoke doesn't evict page if covered by a second lock (2765) + - disable VM readahead to avoid reading outside lock extents (2805) * miscellania - return LL_SUPER_MAGIC from statfs for the filesystem type (1972) + - updated kernel patches for hp-2.4.20 kernel (2681) 2004-02-07 Cluster File Systems, Inc. * version 1.0.4 diff --git a/lustre/cobd/cache_obd.c b/lustre/cobd/cache_obd.c index 5c978bf..e725ecf 100644 --- a/lustre/cobd/cache_obd.c +++ b/lustre/cobd/cache_obd.c @@ -188,10 +188,9 @@ static int cobd_preprw(int cmd, struct obd_export *exp, struct obdo *oa, static int cobd_commitrw(int cmd, struct obd_export *exp, struct obdo *oa, int objcount, struct obd_ioobj *obj, int niocount, struct niobuf_local *local, - struct obd_trans_info *oti) + struct obd_trans_info *oti, int rc) { struct obd_export *cobd_exp; - int rc; if (exp->exp_obd == NULL) return -EINVAL; @@ -200,7 +199,8 @@ static int cobd_commitrw(int cmd, struct obd_export *exp, struct obdo *oa, return -EOPNOTSUPP; cobd_exp = exp->exp_obd->u.cobd.cobd_target_exp; - rc = obd_commitrw(cmd, cobd_exp, oa, objcount, obj,niocount,local,oti); + rc = obd_commitrw(cmd, cobd_exp, oa, objcount, obj, niocount, local, + oti, rc); return rc; } @@ -212,7 +212,7 @@ static int cobd_brw(int cmd, struct obd_export *exp, struct obdo *oa, struct cache_obd *cobd; if (obd == NULL) { - CERROR("invalid client cookie "LPX64"\n", + CERROR("invalid client cookie "LPX64"\n", exp->exp_handle.h_cookie); return -EINVAL; } diff --git a/lustre/include/linux/lustre_cfg.h b/lustre/include/linux/lustre_cfg.h index a9a278f..d8c84be 100644 --- a/lustre/include/linux/lustre_cfg.h +++ b/lustre/include/linux/lustre_cfg.h @@ -248,6 +248,7 @@ static inline void lustre_cfg_freedata(char *buf, int len) /* Passed by mount */ struct lustre_mount_data { + uint32_t lmd_magic; uint32_t lmd_version; uint64_t lmd_local_nid; uint64_t lmd_server_nid; diff --git a/lustre/include/linux/lustre_dlm.h b/lustre/include/linux/lustre_dlm.h index e37dcb1..b8515a3 100644 --- a/lustre/include/linux/lustre_dlm.h +++ b/lustre/include/linux/lustre_dlm.h @@ -8,7 +8,7 @@ #ifdef __KERNEL__ # include -#endif +#endif #include #include @@ -91,15 +91,13 @@ typedef enum { #define LDLM_CB_BLOCKING 1 #define LDLM_CB_CANCELING 2 -#define L2B(c) (1 << c) - /* compatibility matrix */ -#define LCK_COMPAT_EX L2B(LCK_NL) -#define LCK_COMPAT_PW (LCK_COMPAT_EX | L2B(LCK_CR)) -#define LCK_COMPAT_PR (LCK_COMPAT_PW | L2B(LCK_PR)) -#define LCK_COMPAT_CW (LCK_COMPAT_PW | L2B(LCK_CW)) -#define LCK_COMPAT_CR (LCK_COMPAT_CW | L2B(LCK_PR) | L2B(LCK_PW)) -#define LCK_COMPAT_NL (LCK_COMPAT_CR | L2B(LCK_EX)) +#define LCK_COMPAT_EX LCK_NL +#define LCK_COMPAT_PW (LCK_COMPAT_EX | LCK_CR) +#define LCK_COMPAT_PR (LCK_COMPAT_PW | LCK_PR) +#define LCK_COMPAT_CW (LCK_COMPAT_PW | LCK_CW) +#define LCK_COMPAT_CR (LCK_COMPAT_CW | LCK_PR | LCK_PW) +#define LCK_COMPAT_NL (LCK_COMPAT_CR | LCK_EX) static ldlm_mode_t lck_compat_array[] = { [LCK_EX] LCK_COMPAT_EX, @@ -110,12 +108,14 @@ static ldlm_mode_t lck_compat_array[] = { [LCK_NL] LCK_COMPAT_NL }; -static inline int lockmode_compat(ldlm_mode_t exist, ldlm_mode_t new) +static inline void lockmode_verify(ldlm_mode_t mode) { - LASSERT(exist >= LCK_EX && exist <= LCK_NL); - LASSERT(new >= LCK_EX && new <= LCK_NL); + LASSERT(mode >= LCK_EX && mode <= LCK_NL); +} - return (lck_compat_array[exist] & L2B(new)); +static inline int lockmode_compat(ldlm_mode_t exist, ldlm_mode_t new) +{ + return (lck_compat_array[exist] & new); } /* @@ -133,8 +133,8 @@ static inline int lockmode_compat(ldlm_mode_t exist, ldlm_mode_t new) - */ -struct ldlm_lock; -struct ldlm_resource; +struct ldlm_lock; +struct ldlm_resource; struct ldlm_namespace; typedef int (*ldlm_res_policy)(struct ldlm_namespace *, struct ldlm_lock **, @@ -155,7 +155,7 @@ struct ldlm_namespace { struct list_head ns_root_list; /* all root resources in ns */ struct lustre_lock ns_lock; /* protects hash, refcount, list */ struct list_head ns_list_chain; /* position in global NS list */ - /* + /* struct proc_dir_entry *ns_proc_dir; */ @@ -200,8 +200,6 @@ struct ldlm_lock { struct list_head l_lru; struct list_head l_res_link; // position in one of three res lists struct list_head l_export_chain; // per-export chain of locks - struct list_head l_pending_chain; // locks with callbacks pending - unsigned long l_callback_timeout; ldlm_mode_t l_req_mode; ldlm_mode_t l_granted_mode; @@ -209,22 +207,13 @@ struct ldlm_lock { ldlm_completion_callback l_completion_ast; ldlm_blocking_callback l_blocking_ast; ldlm_glimpse_callback l_glimpse_ast; - void *l_ast_data; struct obd_export *l_export; - /* XXX phil can fix this, I'm sure */ struct obd_export *l_conn_export; -// struct lustre_handle *l_connh; __u32 l_flags; struct lustre_handle l_remote_handle; ldlm_policy_data_t l_policy_data; - /* This LVB is used only on the client side, as temporary storage for - * a lock value block received during an enqueue */ - __u32 l_lvb_len; - void *l_lvb_data; - void *l_lvb_swabber; - __u32 l_readers; __u32 l_writers; __u8 l_destroyed; @@ -234,9 +223,20 @@ struct ldlm_lock { * on this waitq to learn when it becomes granted. */ wait_queue_head_t l_waitq; struct timeval l_enqueued_time; - unsigned long l_last_used; /* jiffies */ -}; + unsigned long l_last_used; /* jiffies */ + struct ldlm_extent l_req_extent; + + /* Client-side-only members */ + __u32 l_lvb_len; /* temporary storage for */ + void *l_lvb_data; /* an LVB received during */ + void *l_lvb_swabber; /* an enqueue */ + void *l_ast_data; + + /* Server-side-only members */ + struct list_head l_pending_chain; /* callbacks pending */ + unsigned long l_callback_timeout; +}; #define LDLM_PLAIN 10 #define LDLM_EXTENT 11 @@ -308,7 +308,8 @@ do { \ CDEBUG(level, "### " format \ " ns: %s lock: %p/"LPX64" lrc: %d/%d,%d mode: %s/%s " \ "res: "LPU64"/"LPU64" rrc: %d type: %s ["LPU64"->"LPU64\ - "] flags: %x remote: "LPX64" expref: %d\n" , ## a, \ + "] (req "LPU64"->"LPU64") flags: %x remote: "LPX64 \ + " expref: %d\n" , ## a, \ lock->l_resource->lr_namespace->ns_name, lock, \ lock->l_handle.h_cookie, atomic_read(&lock->l_refc), \ lock->l_readers, lock->l_writers, \ @@ -320,6 +321,7 @@ do { \ ldlm_typename[lock->l_resource->lr_type], \ lock->l_policy_data.l_extent.start, \ lock->l_policy_data.l_extent.end, \ + lock->l_req_extent.start, lock->l_req_extent.end, \ lock->l_flags, lock->l_remote_handle.cookie, \ lock->l_export ? \ atomic_read(&lock->l_export->exp_refcount) : -99); \ diff --git a/lustre/include/linux/lustre_export.h b/lustre/include/linux/lustre_export.h index 218807c..9be781f 100644 --- a/lustre/include/linux/lustre_export.h +++ b/lustre/include/linux/lustre_export.h @@ -26,7 +26,7 @@ struct mds_export_data { struct osc_creator { spinlock_t oscc_lock; struct list_head oscc_list; - struct obd_export *oscc_exp; + struct obd_device *oscc_obd; obd_id oscc_last_id;//last available pre-created object obd_id oscc_next_id;// what object id to give out next int oscc_initial_create_count; @@ -38,10 +38,6 @@ struct osc_creator { wait_queue_head_t oscc_waitq; /* creating procs wait on this */ }; -struct osc_export_data { - struct osc_creator oed_oscc; -}; - struct ldlm_export_data { struct list_head led_held_locks; /* protected by namespace lock */ }; @@ -83,14 +79,12 @@ struct obd_export { struct mds_export_data eu_mds_data; struct filter_export_data eu_filter_data; struct ec_export_data eu_ec_data; - struct osc_export_data eu_osc_data; } u; }; #define exp_mds_data u.eu_mds_data #define exp_lov_data u.eu_lov_data #define exp_filter_data u.eu_filter_data -#define exp_osc_data u.eu_osc_data #define exp_ec_data u.eu_ec_data extern struct obd_export *class_conn2export(struct lustre_handle *conn); diff --git a/lustre/include/linux/lustre_ha.h b/lustre/include/linux/lustre_ha.h index 4dfc81d..808ff44 100644 --- a/lustre/include/linux/lustre_ha.h +++ b/lustre/include/linux/lustre_ha.h @@ -19,6 +19,7 @@ void ptlrpc_free_committed(struct obd_import *imp); void ptlrpc_wake_delayed(struct obd_import *imp); int ptlrpc_recover_import(struct obd_import *imp, char *new_uuid); int ptlrpc_set_import_active(struct obd_import *imp, int active); +void ptlrpc_invalidate_import(struct obd_import *imp); void ptlrpc_fail_import(struct obd_import *imp, int generation); void ptlrpc_fail_export(struct obd_export *exp); diff --git a/lustre/include/linux/lustre_idl.h b/lustre/include/linux/lustre_idl.h index b2dbd86..c0452ea 100644 --- a/lustre/include/linux/lustre_idl.h +++ b/lustre/include/linux/lustre_idl.h @@ -458,7 +458,10 @@ extern void lustre_swab_ost_last_id(obd_id *id); struct ost_lvb { __u64 lvb_size; - __u64 lvb_time; + __u64 lvb_mtime; + __u64 lvb_atime; + __u64 lvb_ctime; + __u64 lvb_blocks; }; extern void lustre_swab_ost_lvb(struct ost_lvb *); @@ -716,11 +719,11 @@ extern void lustre_swab_ldlm_res_id (struct ldlm_res_id *id); /* lock types */ typedef enum { LCK_EX = 1, - LCK_PW, - LCK_PR, - LCK_CW, - LCK_CR, - LCK_NL + LCK_PW = 2, + LCK_PR = 4, + LCK_CW = 8, + LCK_CR = 16, + LCK_NL = 32 } ldlm_mode_t; struct ldlm_extent { @@ -759,7 +762,7 @@ struct ldlm_resource_desc { __u32 lr_type; __u32 lr_padding; struct ldlm_res_id lr_name; -} __attribute__((packed)); +}; extern void lustre_swab_ldlm_resource_desc (struct ldlm_resource_desc *r); @@ -768,7 +771,7 @@ struct ldlm_lock_desc { ldlm_mode_t l_req_mode; ldlm_mode_t l_granted_mode; ldlm_policy_data_t l_policy_data; -} __attribute__((packed)); +}; extern void lustre_swab_ldlm_lock_desc (struct ldlm_lock_desc *l); @@ -778,12 +781,13 @@ struct ldlm_request { struct ldlm_lock_desc lock_desc; struct lustre_handle lock_handle1; struct lustre_handle lock_handle2; -} __attribute__((packed)); +}; extern void lustre_swab_ldlm_request (struct ldlm_request *rq); struct ldlm_reply { __u32 lock_flags; + __u32 lock_padding; struct ldlm_lock_desc lock_desc; struct lustre_handle lock_handle; __u64 lock_policy_res1; @@ -863,6 +867,13 @@ struct llog_logid { __u32 lgl_ogen; } __attribute__((packed)); +/* Records written to the CATALOGS list */ +#define CATLIST "CATALOGS" +struct llog_catid { + struct llog_logid lci_logid; + __u32 lci_padding[3]; +} __attribute__((packed)); + /* Log data record types - there is no specific reason that these need to * be related to the RPC opcodes, but no reason not to (may be handy later?) */ @@ -874,7 +885,7 @@ typedef enum { PTL_CFG_REC = 0x10630000, LLOG_GEN_REC = 0x10640000, LLOG_HDR_MAGIC = 0x10645539, - LLOG_LOGID_MAGIC = 0x1064553a, + LLOG_LOGID_MAGIC = 0x1064553b, } llog_op_type; /* Log record header - stored in little endian order. @@ -896,7 +907,7 @@ struct llog_rec_tail { struct llog_logid_rec { struct llog_rec_hdr lid_hdr; struct llog_logid lid_id; - __u32 padding; + __u32 padding[5]; struct llog_rec_tail lid_tail; } __attribute__((packed)); diff --git a/lustre/include/linux/lustre_import.h b/lustre/include/linux/lustre_import.h index c940ac1..14943f8 100644 --- a/lustre/include/linux/lustre_import.h +++ b/lustre/include/linux/lustre_import.h @@ -39,6 +39,11 @@ static inline char * ptlrpc_import_state_name(enum lustre_imp_state state) return import_state_names[state]; } +enum obd_import_event { + IMP_EVENT_DISCON = 0x808001, + IMP_EVENT_INVALIDATE = 0x808002, + IMP_EVENT_ACTIVE = 0x808003, +}; struct obd_import { struct portals_handle imp_handle; @@ -75,7 +80,8 @@ struct obd_import { /* flags */ int imp_invalid:1, imp_replayable:1, imp_dlm_fake:1, imp_server_timeout:1, - imp_initial_recov:1; + imp_initial_recov:1, imp_force_verify:1, + imp_pingable:1; __u32 imp_connect_op; }; diff --git a/lustre/include/linux/lustre_lib.h b/lustre/include/linux/lustre_lib.h index 9013e8a..4eef3be 100644 --- a/lustre/include/linux/lustre_lib.h +++ b/lustre/include/linux/lustre_lib.h @@ -674,3 +674,23 @@ do { \ }) #endif /* _LUSTRE_LIB_H */ + +#define LMD_MAGIC 0xbdacbdac + +#define lmd_bad_magic(LMDP) \ +({ \ + struct lustre_mount_data *_lmd__ = (LMDP); \ + int _ret__ = 0; \ + if (!_lmd__) { \ + CERROR("Missing mount data: " \ + "check that /sbin/mount.lustre is installed.\n");\ + _ret__ = 1; \ + } else if (_lmd__->lmd_magic != LMD_MAGIC) { \ + CERROR("Invalid mount data (%#x != %#x): " \ + "check that /sbin/mount.lustre is installed\n", \ + _lmd__->lmd_magic, LMD_MAGIC); \ + _ret__ = 1; \ + } \ + _ret__; \ +}) + diff --git a/lustre/include/linux/lustre_log.h b/lustre/include/linux/lustre_log.h index 1ea4740f..1d0ff9f 100644 --- a/lustre/include/linux/lustre_log.h +++ b/lustre/include/linux/lustre_log.h @@ -121,7 +121,7 @@ int llog_obd_origin_add(struct llog_ctxt *ctxt, int llog_cat_initialize(struct obd_device *obd, int count); int obd_llog_init(struct obd_device *obd, struct obd_device *disk_obd, - int count, struct llog_logid *logid); + int count, struct llog_catid *logid); int obd_llog_finish(struct obd_device *obd, int count); @@ -134,7 +134,8 @@ int llog_catlog_list(struct obd_device *obd, int count, int llog_initiator_connect(struct llog_ctxt *ctxt); int llog_receptor_accept(struct llog_ctxt *ctxt, struct obd_import *imp); int llog_origin_connect(struct llog_ctxt *ctxt, int count, - struct llog_logid *logid, struct llog_gen *gen); + struct llog_logid *logid, struct llog_gen *gen, + struct obd_uuid *uuid); int llog_handle_connect(struct ptlrpc_request *req); /* recov_thread.c */ @@ -143,7 +144,8 @@ int llog_obd_repl_cancel(struct llog_ctxt *ctxt, struct llog_cookie *cookies, int flags); int llog_obd_repl_sync(struct llog_ctxt *ctxt, struct obd_export *exp); int llog_repl_connect(struct llog_ctxt *ctxt, int count, - struct llog_logid *logid, struct llog_gen *gen); + struct llog_logid *logid, struct llog_gen *gen, + struct obd_uuid *uuid); struct llog_operations { int (*lop_write_rec)(struct llog_handle *loghandle, @@ -169,15 +171,15 @@ struct llog_operations { int (*lop_cancel)(struct llog_ctxt *ctxt, struct lov_stripe_md *lsm, int count, struct llog_cookie *cookies, int flags); int (*lop_connect)(struct llog_ctxt *ctxt, int count, - struct llog_logid *logid, struct llog_gen *gen); + struct llog_logid *logid, struct llog_gen *gen, + struct obd_uuid *uuid); /* XXX add 2 more: commit callbacks and llog recovery functions */ }; /* llog_lvfs.c */ -int llog_get_cat_list(struct obd_device *obd, struct obd_device *disk_obd, - char *name, int count, struct llog_logid *idarray); extern struct llog_operations llog_lvfs_ops; - +int llog_get_cat_list(struct obd_device *obd, struct obd_device *disk_obd, + char *name, int count, struct llog_catid *idarray); struct llog_ctxt { int loc_idx; /* my index the obd array of ctxt's */ @@ -222,7 +224,7 @@ static inline int llog_obd2ops(struct llog_ctxt *ctxt, { if (ctxt == NULL) return -ENOTCONN; - + *lop = ctxt->loc_logops; if (*lop == NULL) return -EOPNOTSUPP; @@ -269,10 +271,10 @@ static inline int llog_write_rec(struct llog_handle *handle, RETURN(-EOPNOTSUPP); if (buf) - buflen = le32_to_cpu(rec->lrh_len) + sizeof(struct llog_rec_hdr) + buflen = rec->lrh_len + sizeof(struct llog_rec_hdr) + sizeof(struct llog_rec_tail); else - buflen = le32_to_cpu(rec->lrh_len); + buflen = rec->lrh_len; LASSERT(size_round(buflen) == buflen); rc = lop->lop_write_rec(handle, rec, logcookies, numcookies, buf, idx); @@ -368,7 +370,8 @@ static inline int llog_create(struct llog_ctxt *ctxt, struct llog_handle **res, } static inline int llog_connect(struct llog_ctxt *ctxt, int count, - struct llog_logid *logid, struct llog_gen *gen) + struct llog_logid *logid, struct llog_gen *gen, + struct obd_uuid *uuid) { struct llog_operations *lop; int rc; @@ -380,7 +383,7 @@ static inline int llog_connect(struct llog_ctxt *ctxt, int count, if (lop->lop_connect == NULL) RETURN(-EOPNOTSUPP); - rc = lop->lop_connect(ctxt, count, logid, gen); + rc = lop->lop_connect(ctxt, count, logid, gen, uuid); RETURN(rc); } diff --git a/lustre/include/linux/lustre_net.h b/lustre/include/linux/lustre_net.h index 8b34ada..13ce57e 100644 --- a/lustre/include/linux/lustre_net.h +++ b/lustre/include/linux/lustre_net.h @@ -243,8 +243,9 @@ struct ptlrpc_request { spinlock_t rq_lock; /* client-side flags */ unsigned int rq_intr:1, rq_replied:1, rq_err:1, - rq_timedout:1, rq_resend:1, rq_restart:1, rq_replay:1, - rq_no_resend:1, rq_waiting:1, rq_receiving_reply:1; + rq_timedout:1, rq_resend:1, rq_restart:1, rq_replay:1, + rq_no_resend:1, rq_waiting:1, rq_receiving_reply:1, + rq_no_delay:1; int rq_phase; /* client-side refcount for SENT race */ atomic_t rq_refcount; @@ -404,7 +405,6 @@ struct ptlrpc_request_buffer_desc { struct ptlrpc_srv_ni *rqbd_srv_ni; ptl_handle_md_t rqbd_md_h; int rqbd_refcount; - int rqbd_eventcount; char *rqbd_buffer; struct ptlrpc_cb_id rqbd_cbid; struct ptlrpc_request rqbd_req; @@ -425,7 +425,7 @@ struct ptlrpc_srv_ni { /* Interface-specific service state */ struct ptlrpc_service *sni_service; /* owning service */ struct ptlrpc_ni *sni_ni; /* network interface */ - struct list_head sni_rqbds; /* all the request buffers */ + struct list_head sni_active_rqbds; /* req buffers receiving */ struct list_head sni_active_replies; /* all the active replies */ int sni_nrqbd_receiving; /* # posted request buffers */ }; @@ -440,6 +440,7 @@ struct ptlrpc_service { int srv_nthreads; /* # running threads */ int srv_n_difficult_replies; /* # 'difficult' replies */ int srv_n_active_reqs; /* # reqs being served */ + int srv_rqbd_timeout; /* timeout before re-posting reqs */ __u32 srv_req_portal; __u32 srv_rep_portal; @@ -447,6 +448,8 @@ struct ptlrpc_service { int srv_n_queued_reqs; /* # reqs waiting to be served */ struct list_head srv_request_queue; /* reqs waiting for service */ + struct list_head srv_idle_rqbds; /* request buffers to be reposted */ + atomic_t srv_outstanding_replies; struct list_head srv_reply_queue; /* replies waiting for service */ @@ -509,7 +512,7 @@ int ptlrpc_reply(struct ptlrpc_request *req); int ptlrpc_error(struct ptlrpc_request *req); void ptlrpc_resend_req(struct ptlrpc_request *request); int ptl_send_rpc(struct ptlrpc_request *request); -void ptlrpc_register_rqbd (struct ptlrpc_request_buffer_desc *rqbd); +int ptlrpc_register_rqbd (struct ptlrpc_request_buffer_desc *rqbd); /* ptlrpc/client.c */ void ptlrpc_init_client(int req_portal, int rep_portal, char *name, diff --git a/lustre/include/linux/lvfs.h b/lustre/include/linux/lvfs.h index bf27a40..b18769f 100644 --- a/lustre/include/linux/lvfs.h +++ b/lustre/include/linux/lvfs.h @@ -56,8 +56,8 @@ void pop_ctxt(struct obd_run_ctxt *saved, struct obd_run_ctxt *new_ctx, #ifdef __KERNEL__ -struct dentry *simple_mkdir(struct dentry *dir, char *name, int mode); -struct dentry *simple_mknod(struct dentry *dir, char *name, int mode); +struct dentry *simple_mkdir(struct dentry *dir, char *name, int mode, int fix); +struct dentry *simple_mknod(struct dentry *dir, char *name, int mode, int fix); int lustre_fread(struct file *file, void *buf, int len, loff_t *off); int lustre_fwrite(struct file *file, const void *buf, int len, loff_t *off); int lustre_fsync(struct file *file); diff --git a/lustre/include/linux/obd.h b/lustre/include/linux/obd.h index 365708b..24ee1c2 100644 --- a/lustre/include/linux/obd.h +++ b/lustre/include/linux/obd.h @@ -76,7 +76,8 @@ struct lov_stripe_md { /* Public members. */ __u64 lsm_object_id; /* lov object id */ __u64 lsm_object_gr; /* lov object id */ - __u64 lsm_maxbytes; + __u64 lsm_maxbytes; /* maximum possible file size */ + unsigned long lsm_xfersize; /* optimal transfer size */ /* LOV-private members start here -- only for use in lov/. */ __u32 lsm_magic; @@ -174,6 +175,7 @@ struct filter_obd { struct list_head fo_export_list; int fo_subdir_count; + obd_size fo_tot_dirty; /* protected by obd_osfs_lock */ obd_size fo_tot_granted; /* all values in bytes */ obd_size fo_tot_pending; @@ -248,6 +250,7 @@ struct client_obd { struct mdc_rpc_lock *cl_rpc_lock; struct mdc_rpc_lock *cl_setattr_lock; + struct osc_creator cl_oscc; }; /* Like a client, with some hangers-on. Keep mc_client_obd first so that we @@ -614,7 +617,7 @@ struct obd_ops { int (*o_commitrw)(int cmd, struct obd_export *exp, struct obdo *oa, int objcount, struct obd_ioobj *obj, int niocount, struct niobuf_local *local, - struct obd_trans_info *oti); + struct obd_trans_info *oti, int rc); int (*o_enqueue)(struct obd_export *, struct lov_stripe_md *, __u32 type, ldlm_policy_data_t *, __u32 mode, int *flags, void *bl_cb, void *cp_cb, void *gl_cb, @@ -638,7 +641,7 @@ struct obd_ops { /* llog related obd_methods */ int (*o_llog_init)(struct obd_device *obd, struct obd_device *disk_obd, - int count, struct llog_logid *logid); + int count, struct llog_catid *logid); int (*o_llog_finish)(struct obd_device *obd, int count); /* metadata-only methods */ @@ -646,7 +649,8 @@ struct obd_ops { struct obd_client_handle *, int flag); int (*o_unpin)(struct obd_export *, struct obd_client_handle *, int); - int (*o_invalidate_import)(struct obd_device *, struct obd_import *); + int (*o_import_event)(struct obd_device *, struct obd_import *, + enum obd_import_event); int (*o_notify)(struct obd_device *obd, struct obd_device *watched, int active); diff --git a/lustre/include/linux/obd_class.h b/lustre/include/linux/obd_class.h index 90a521b..6c97a05 100644 --- a/lustre/include/linux/obd_class.h +++ b/lustre/include/linux/obd_class.h @@ -828,16 +828,15 @@ static inline int obd_preprw(int cmd, struct obd_export *exp, struct obdo *oa, static inline int obd_commitrw(int cmd, struct obd_export *exp, struct obdo *oa, int objcount, struct obd_ioobj *obj, int niocount, struct niobuf_local *local, - struct obd_trans_info *oti) + struct obd_trans_info *oti, int rc) { - int rc; ENTRY; OBD_CHECK_OP(exp->exp_obd, commitrw, -EOPNOTSUPP); OBD_COUNTER_INCREMENT(exp->exp_obd, commitrw); rc = OBP(exp->exp_obd, commitrw)(cmd, exp, oa, objcount, obj, niocount, - local, oti); + local, oti, rc); RETURN(rc); } @@ -970,12 +969,14 @@ static inline int obd_unpin(struct obd_export *exp, return(rc); } -static inline void obd_invalidate_import(struct obd_device *obd, - struct obd_import *imp) + +static inline void obd_import_event(struct obd_device *obd, + struct obd_import *imp, + enum obd_import_event event) { - if (obd->obd_set_up && OBP(obd, invalidate_import)) { - OBD_COUNTER_INCREMENT(obd, invalidate_import); - OBP(obd, invalidate_import)(obd, imp); + if (obd->obd_set_up && OBP(obd, import_event)) { + OBD_COUNTER_INCREMENT(obd, import_event); + OBP(obd, import_event)(obd, imp, event); } } diff --git a/lustre/include/linux/obd_support.h b/lustre/include/linux/obd_support.h index 7b232ea..41fb301 100644 --- a/lustre/include/linux/obd_support.h +++ b/lustre/include/linux/obd_support.h @@ -122,6 +122,7 @@ extern unsigned int obd_sync_filter; #define OBD_FAIL_PTLRPC 0x500 #define OBD_FAIL_PTLRPC_ACK 0x501 +#define OBD_FAIL_PTLRPC_RQBD 0x502 #define OBD_FAIL_OBD_PING_NET 0x600 #define OBD_FAIL_OBD_LOG_CANCEL_NET 0x601 diff --git a/lustre/kernel_patches/patches/ext3-delete_thread-2.4.20-hp.patch b/lustre/kernel_patches/patches/ext3-delete_thread-2.4.20-hp.patch index f91b8ff..d722b68 100644 --- a/lustre/kernel_patches/patches/ext3-delete_thread-2.4.20-hp.patch +++ b/lustre/kernel_patches/patches/ext3-delete_thread-2.4.20-hp.patch @@ -5,10 +5,10 @@ include/linux/ext3_fs_sb.h | 10 + 5 files changed, 365 insertions(+) -Index: linux-2.4.20-hp4-pnnl13/fs/ext3/super.c +Index: linux/fs/ext3/super.c =================================================================== ---- linux-2.4.20-hp4-pnnl13.orig/fs/ext3/super.c 2004-01-12 19:22:32.000000000 +0300 -+++ linux-2.4.20-hp4-pnnl13/fs/ext3/super.c 2004-01-13 17:04:38.000000000 +0300 +--- linux.orig/fs/ext3/super.c Mon Feb 2 20:57:35 2004 ++++ linux/fs/ext3/super.c Mon Feb 2 20:58:05 2004 @@ -400,6 +400,221 @@ } } @@ -298,10 +298,10 @@ Index: linux-2.4.20-hp4-pnnl13/fs/ext3/super.c if (sbi->s_mount_opt & EXT3_MOUNT_ABORT) ext3_abort(sb, __FUNCTION__, "Abort forced by user"); -Index: linux-2.4.20-hp4-pnnl13/fs/ext3/inode.c +Index: linux/fs/ext3/inode.c =================================================================== ---- linux-2.4.20-hp4-pnnl13.orig/fs/ext3/inode.c 2004-01-12 19:22:32.000000000 +0300 -+++ linux-2.4.20-hp4-pnnl13/fs/ext3/inode.c 2004-01-13 17:01:40.000000000 +0300 +--- linux.orig/fs/ext3/inode.c Mon Feb 2 20:57:35 2004 ++++ linux/fs/ext3/inode.c Mon Feb 2 20:58:05 2004 @@ -2500,6 +2500,118 @@ return err; } @@ -421,10 +421,10 @@ Index: linux-2.4.20-hp4-pnnl13/fs/ext3/inode.c /* * On success, We end up with an outstanding reference count against * iloc->bh. This _must_ be cleaned up later. -Index: linux-2.4.20-hp4-pnnl13/fs/ext3/file.c +Index: linux/fs/ext3/file.c =================================================================== ---- linux-2.4.20-hp4-pnnl13.orig/fs/ext3/file.c 2004-01-12 19:22:32.000000000 +0300 -+++ linux-2.4.20-hp4-pnnl13/fs/ext3/file.c 2004-01-13 17:01:40.000000000 +0300 +--- linux.orig/fs/ext3/file.c Mon Feb 2 20:57:34 2004 ++++ linux/fs/ext3/file.c Mon Feb 2 20:58:05 2004 @@ -125,7 +125,11 @@ }; @@ -437,23 +437,10 @@ Index: linux-2.4.20-hp4-pnnl13/fs/ext3/file.c setattr: ext3_setattr, /* BKL held */ setxattr: ext3_setxattr, /* BKL held */ getxattr: ext3_getxattr, /* BKL held */ -Index: linux-2.4.20-hp4-pnnl13/fs/buffer.c +Index: linux/include/linux/ext3_fs.h =================================================================== ---- linux-2.4.20-hp4-pnnl13.orig/fs/buffer.c 2003-09-13 15:19:26.000000000 +0400 -+++ linux-2.4.20-hp4-pnnl13/fs/buffer.c 2004-01-13 17:01:40.000000000 +0300 -@@ -376,6 +376,8 @@ - if (sb->s_op && sb->s_op->sync_fs) - sb->s_op->sync_fs(sb); - unlock_super(sb); -+ if (sb->s_op && sb->s_op->sync_fs) -+ sb->s_op->sync_fs(sb); - unlock_kernel(); - - return sync_buffers(dev, 1); -Index: linux-2.4.20-hp4-pnnl13/include/linux/ext3_fs.h -=================================================================== ---- linux-2.4.20-hp4-pnnl13.orig/include/linux/ext3_fs.h 2004-01-12 19:22:32.000000000 +0300 -+++ linux-2.4.20-hp4-pnnl13/include/linux/ext3_fs.h 2004-01-13 17:01:40.000000000 +0300 +--- linux.orig/include/linux/ext3_fs.h Mon Feb 2 20:57:35 2004 ++++ linux/include/linux/ext3_fs.h Mon Feb 2 20:58:05 2004 @@ -193,6 +193,7 @@ */ #define EXT3_STATE_JDATA 0x00000001 /* journaled data exists */ @@ -480,10 +467,10 @@ Index: linux-2.4.20-hp4-pnnl13/include/linux/ext3_fs.h /* ioctl.c */ extern int ext3_ioctl (struct inode *, struct file *, unsigned int, -Index: linux-2.4.20-hp4-pnnl13/include/linux/ext3_fs_sb.h +Index: linux/include/linux/ext3_fs_sb.h =================================================================== ---- linux-2.4.20-hp4-pnnl13.orig/include/linux/ext3_fs_sb.h 2004-01-12 19:22:32.000000000 +0300 -+++ linux-2.4.20-hp4-pnnl13/include/linux/ext3_fs_sb.h 2004-01-13 17:01:40.000000000 +0300 +--- linux.orig/include/linux/ext3_fs_sb.h Mon Feb 2 20:57:35 2004 ++++ linux/include/linux/ext3_fs_sb.h Mon Feb 2 20:58:05 2004 @@ -29,6 +29,8 @@ #define EXT3_MAX_GROUP_LOADED 8 diff --git a/lustre/kernel_patches/patches/invalidate_show-2.4.20-hp.patch b/lustre/kernel_patches/patches/invalidate_show-2.4.20-hp.patch new file mode 100644 index 0000000..fad6233 --- /dev/null +++ b/lustre/kernel_patches/patches/invalidate_show-2.4.20-hp.patch @@ -0,0 +1,123 @@ + + + + fs/inode.c | 21 ++++++++++++++------- + fs/smbfs/inode.c | 2 +- + fs/super.c | 4 ++-- + include/linux/fs.h | 2 +- + 4 files changed, 18 insertions(+), 11 deletions(-) + +Index: linux/fs/inode.c +=================================================================== +--- linux.orig/fs/inode.c Mon Feb 2 21:24:21 2004 ++++ linux/fs/inode.c Mon Feb 2 21:27:53 2004 +@@ -632,7 +632,8 @@ + /* + * Invalidate all inodes for a device. + */ +-static int invalidate_list(struct list_head *head, struct super_block * sb, struct list_head * dispose) ++static int invalidate_list(struct list_head *head, struct super_block * sb, ++ struct list_head * dispose, int show) + { + struct list_head *next; + int busy = 0, count = 0; +@@ -657,6 +658,11 @@ + count++; + continue; + } ++ if (show) ++ printk(KERN_ERR ++ "inode busy: dev %s:%lu (%p) mode %o count %u\n", ++ kdevname(sb->s_dev), inode->i_ino, inode, ++ inode->i_mode, atomic_read(&inode->i_count)); + busy = 1; + } + /* only unused inodes may be cached with i_count zero */ +@@ -675,23 +681,24 @@ + /** + * invalidate_inodes - discard the inodes on a device + * @sb: superblock ++ * @show: whether we should display any busy inodes found + * + * Discard all of the inodes for a given superblock. If the discard + * fails because there are busy inodes then a non zero value is returned. + * If the discard is successful all the inodes have been discarded. + */ + +-int invalidate_inodes(struct super_block * sb) ++int invalidate_inodes(struct super_block * sb, int show) + { + int busy; + LIST_HEAD(throw_away); + + spin_lock(&inode_lock); +- busy = invalidate_list(&inode_in_use, sb, &throw_away); +- busy |= invalidate_list(&inode_unused, sb, &throw_away); +- busy |= invalidate_list(&inode_unused_pagecache, sb, &throw_away); +- busy |= invalidate_list(&sb->s_dirty, sb, &throw_away); +- busy |= invalidate_list(&sb->s_locked_inodes, sb, &throw_away); ++ busy = invalidate_list(&inode_in_use, sb, &throw_away, show); ++ busy |= invalidate_list(&inode_unused, sb, &throw_away, show); ++ busy |= invalidate_list(&inode_unused_pagecache, sb, &throw_away, show); ++ busy |= invalidate_list(&sb->s_dirty, sb, &throw_away, show); ++ busy |= invalidate_list(&sb->s_locked_inodes, sb, &throw_away, show); + spin_unlock(&inode_lock); + + dispose_list(&throw_away); +@@ -717,7 +724,7 @@ + * hold). + */ + shrink_dcache_sb(sb); +- res = invalidate_inodes(sb); ++ res = invalidate_inodes(sb, 0); + drop_super(sb); + } + invalidate_buffers(dev); +Index: linux/fs/super.c +=================================================================== +--- linux.orig/fs/super.c Mon Feb 2 21:24:21 2004 ++++ linux/fs/super.c Mon Feb 2 21:26:08 2004 +@@ -844,7 +844,7 @@ + lock_super(sb); + lock_kernel(); + sb->s_flags &= ~MS_ACTIVE; +- invalidate_inodes(sb); /* bad name - it should be evict_inodes() */ ++ invalidate_inodes(sb, 0); /* bad name - it should be evict_inodes() */ + if (sop) { + if (sop->write_super && sb->s_dirt) + sop->write_super(sb); +@@ -853,7 +853,7 @@ + } + + /* Forget any remaining inodes */ +- if (invalidate_inodes(sb)) { ++ if (invalidate_inodes(sb, 1)) { + printk(KERN_ERR "VFS: Busy inodes after unmount. " + "Self-destruct in 5 seconds. Have a nice day...\n"); + } +Index: linux/include/linux/fs.h +=================================================================== +--- linux.orig/include/linux/fs.h Mon Feb 2 21:24:23 2004 ++++ linux/include/linux/fs.h Mon Feb 2 21:26:08 2004 +@@ -1257,7 +1257,7 @@ + extern void set_buffer_flushtime(struct buffer_head *); + extern void balance_dirty(void); + extern int check_disk_change(kdev_t); +-extern int invalidate_inodes(struct super_block *); ++extern int invalidate_inodes(struct super_block *, int); + extern int invalidate_device(kdev_t, int); + extern void invalidate_inode_pages(struct inode *); + extern void invalidate_inode_pages2(struct address_space *); +Index: linux/fs/smbfs/inode.c +=================================================================== +--- linux.orig/fs/smbfs/inode.c Thu Nov 28 18:53:15 2002 ++++ linux/fs/smbfs/inode.c Mon Feb 2 21:26:08 2004 +@@ -167,7 +167,7 @@ + { + VERBOSE("\n"); + shrink_dcache_sb(SB_of(server)); +- invalidate_inodes(SB_of(server)); ++ invalidate_inodes(SB_of(server), 0); + } + + /* diff --git a/lustre/kernel_patches/series/hp-pnnl-2.4.20 b/lustre/kernel_patches/series/hp-pnnl-2.4.20 index e3c5a62..6cfe667 100644 --- a/lustre/kernel_patches/series/hp-pnnl-2.4.20 +++ b/lustre/kernel_patches/series/hp-pnnl-2.4.20 @@ -3,7 +3,7 @@ dev_read_only_hp_2.4.20.patch exports_2.4.20-rh-hp.patch lustre_version.patch vfs_intent-2.4.20-hp.patch -invalidate_show.patch +invalidate_show-2.4.20-hp.patch export-truncate.patch iod-stock-24-exports_hp.patch ext-2.4-patch-1.patch @@ -25,6 +25,8 @@ ext3-map_inode_page.patch ext3-error-export.patch iopen-2.4.20.patch tcp-zero-copy.patch +jbd-dont-account-blocks-twice.patch +jbd-commit-tricks.patch add_page_private.patch socket-exports-vanilla.patch removepage-2.4.20.patch @@ -32,6 +34,7 @@ jbd-ctx_switch.patch jbd-flushtime.patch jbd-get_write_access.patch nfs_export_kernel-2.4.20-hp.patch +ext3-raw-lookup.patch ext3-ea-in-inode-2.4.20.patch listman-2.4.20.patch ext3-trusted_ea-2.4.20.patch diff --git a/lustre/ldlm/ldlm_extent.c b/lustre/ldlm/ldlm_extent.c index 32fb89d..c2c1e25 100644 --- a/lustre/ldlm/ldlm_extent.c +++ b/lustre/ldlm/ldlm_extent.c @@ -36,67 +36,101 @@ * - 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 */ + */ static void ldlm_extent_internal_policy(struct list_head *queue, struct ldlm_lock *req, struct ldlm_extent *new_ex) { struct list_head *tmp; ldlm_mode_t req_mode = req->l_req_mode; - __u64 req_start = req->l_policy_data.l_extent.start; - __u64 req_end = req->l_policy_data.l_extent.end; + __u64 req_start = req->l_req_extent.start; + __u64 req_end = req->l_req_extent.end; ENTRY; - if (new_ex->start == req_start && new_ex->end == req_end) { - EXIT; - return; - } + lockmode_verify(req_mode); list_for_each(tmp, queue) { struct ldlm_lock *lock; + struct ldlm_extent *l_extent; + lock = list_entry(tmp, struct ldlm_lock, l_res_link); + l_extent = &lock->l_policy_data.l_extent; - if (req == lock) { + if (new_ex->start == req_start && new_ex->end == req_end) { EXIT; return; } - /* if lock doesn't overlap new_ex, skip it. */ - if (lock->l_policy_data.l_extent.end < new_ex->start || - lock->l_policy_data.l_extent.start > new_ex->end) + /* Don't conflict with ourselves */ + if (req == lock) + continue; + + /* If lock doesn't overlap new_ex, skip it. */ + if (l_extent->end < new_ex->start || + l_extent->start > new_ex->end) continue; /* Locks are compatible, overlap doesn't matter */ if (lockmode_compat(lock->l_req_mode, req_mode)) continue; - if (lock->l_policy_data.l_extent.start < req_start) { - if (lock->l_policy_data.l_extent.end == ~0) { + /* Locks conflicting in requested extents and we can't satisfy + * both locks, so ignore it. Either we will ping-pong this + * extent (we would regardless of what extent we granted) or + * lock is unused and it shouldn't limit our extent growth. */ + if (lock->l_req_extent.end >= req_start && + lock->l_req_extent.start <= req_end) + continue; + + /* We grow extents downwards only as far as they don't overlap + * with already-granted locks, on the assumtion that clients + * will be writing beyond the initial requested end and would + * then need to enqueue a new lock beyond the previous request. + * We don't grow downwards if there are lots of lockers. */ + if (l_extent->start < req_start) { + if (atomic_read(&req->l_resource->lr_refcount) > 20) new_ex->start = req_start; - new_ex->end = req_end; - EXIT; - return; - } - new_ex->start = min(lock->l_policy_data.l_extent.end+1, - req_start); + else + new_ex->start = min(l_extent->end+1, req_start); } - if (lock->l_policy_data.l_extent.end > req_end) { - if (lock->l_policy_data.l_extent.start == 0) { - new_ex->start = req_start; - new_ex->end = req_end; - EXIT; - return; - } - new_ex->end = MAX(lock->l_policy_data.l_extent.start-1, - req_end); + /* If we need to cancel this lock anyways because our request + * overlaps the granted lock, we grow up to its requested + * extent start instead of limiting this extent, assuming that + * clients are writing forwards and the lock had over grown + * its extent downwards before we enqueued our request. */ + if (l_extent->end > req_end) { + if (l_extent->start <= req_end) + new_ex->end = max(lock->l_req_extent.start - 1, + req_end); + else + new_ex->end = max(l_extent->start - 1, req_end); } } EXIT; } -/* Determine if the lock is compatible with all locks on the queue. */ +/* In order to determine the largest possible extent we can grant, we need + * to scan all of the queues. */ +static void ldlm_extent_policy(struct ldlm_resource *res, + struct ldlm_lock *lock, int *flags) +{ + struct ldlm_extent new_ex = { .start = 0, .end = ~0}; + + ldlm_extent_internal_policy(&res->lr_granted, lock, &new_ex); + ldlm_extent_internal_policy(&res->lr_waiting, lock, &new_ex); + + if (new_ex.start != lock->l_policy_data.l_extent.start || + new_ex.end != lock->l_policy_data.l_extent.end) { + *flags |= LDLM_FL_LOCK_CHANGED; + lock->l_policy_data.l_extent.start = new_ex.start; + lock->l_policy_data.l_extent.end = new_ex.end; + } +} + +/* Determine if the lock is compatible with all locks on the queue. + * We stop walking the queue if we hit ourselves so we don't take + * conflicting locks enqueued after us into accound, or we'd wait forever. */ static int ldlm_extent_compat_queue(struct list_head *queue, struct ldlm_lock *req, int send_cbs) @@ -104,11 +138,13 @@ ldlm_extent_compat_queue(struct list_head *queue, struct ldlm_lock *req, struct list_head *tmp; struct ldlm_lock *lock; ldlm_mode_t req_mode = req->l_req_mode; - __u64 req_start = req->l_policy_data.l_extent.start; - __u64 req_end = req->l_policy_data.l_extent.end; + __u64 req_start = req->l_req_extent.start; + __u64 req_end = req->l_req_extent.end; int compat = 1; ENTRY; + lockmode_verify(req_mode); + list_for_each(tmp, queue) { lock = list_entry(tmp, struct ldlm_lock, l_res_link); @@ -148,7 +184,6 @@ int ldlm_process_extent_lock(struct ldlm_lock *lock, int *flags, int first_enq, ldlm_error_t *err) { struct ldlm_resource *res = lock->l_resource; - struct ldlm_extent new_ex = {0, ~0}; struct list_head rpc_list = LIST_HEAD_INIT(rpc_list); int rc; ENTRY; @@ -165,22 +200,12 @@ int ldlm_process_extent_lock(struct ldlm_lock *lock, int *flags, int first_enq, RETURN(LDLM_ITER_STOP); ldlm_resource_unlink_lock(lock); + + ldlm_extent_policy(res, lock, flags); ldlm_grant_lock(lock, NULL, 0, 1); RETURN(LDLM_ITER_CONTINUE); } - /* In order to determine the largest possible extent we can - * grant, we need to scan all of the queues. */ - ldlm_extent_internal_policy(&res->lr_granted, lock, &new_ex); - ldlm_extent_internal_policy(&res->lr_waiting, lock, &new_ex); - - if (new_ex.start != lock->l_policy_data.l_extent.start || - new_ex.end != lock->l_policy_data.l_extent.end) { - *flags |= LDLM_FL_LOCK_CHANGED; - lock->l_policy_data.l_extent.start = new_ex.start; - lock->l_policy_data.l_extent.end = new_ex.end; - } - restart: LASSERT(res->lr_tmp == NULL); res->lr_tmp = &rpc_list; @@ -204,6 +229,7 @@ int ldlm_process_extent_lock(struct ldlm_lock *lock, int *flags, int first_enq, GOTO(restart, -ERESTART); *flags |= LDLM_FL_BLOCK_GRANTED; } else { + ldlm_extent_policy(res, lock, flags); ldlm_resource_unlink_lock(lock); ldlm_grant_lock(lock, NULL, 0, 0); } diff --git a/lustre/ldlm/ldlm_flock.c b/lustre/ldlm/ldlm_flock.c index 181c72e..148be59 100644 --- a/lustre/ldlm/ldlm_flock.c +++ b/lustre/ldlm/ldlm_flock.c @@ -150,6 +150,8 @@ ldlm_process_flock_lock(struct ldlm_lock *req, int *flags, int first_enq, } } } else { + lockmode_verify(mode); + /* This loop determines if there are existing locks * that conflict with the new lock request. */ list_for_each(tmp, &res->lr_granted) { @@ -164,7 +166,7 @@ ldlm_process_flock_lock(struct ldlm_lock *req, int *flags, int first_enq, /* locks are compatible, overlap doesn't matter */ if (lockmode_compat(lock->l_granted_mode, mode)) continue; - + if (!ldlm_flocks_overlap(lock, req)) continue; diff --git a/lustre/ldlm/ldlm_internal.h b/lustre/ldlm/ldlm_internal.h index 4186f5c..4111cbe 100644 --- a/lustre/ldlm/ldlm_internal.h +++ b/lustre/ldlm/ldlm_internal.h @@ -19,6 +19,10 @@ void ldlm_add_ast_work_item(struct ldlm_lock *lock, struct ldlm_lock *new, int ldlm_reprocess_queue(struct ldlm_resource *res, struct list_head *queue); int ldlm_run_ast_work(struct ldlm_namespace *, struct list_head *rpc_list); +/* ldlm_lockd.c */ +int ldlm_bl_to_thread(struct ldlm_namespace *ns, struct ldlm_lock_desc *ld, + struct ldlm_lock *lock); + /* ldlm_plain.c */ int ldlm_process_plain_lock(struct ldlm_lock *lock, int *flags, int first_enq, ldlm_error_t *err); diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index 2787619..bcaed00 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -255,6 +255,7 @@ int client_connect_import(struct lustre_handle *dlm_handle, GOTO(out_ldlm, rc); } + ptlrpc_pinger_add_import(imp); EXIT; if (rc) { @@ -312,7 +313,7 @@ int client_disconnect_export(struct obd_export *exp, int failover) /* Yeah, obd_no_recov also (mainly) means "forced shutdown". */ if (obd->obd_no_recov) - ptlrpc_set_import_active(imp, 0); + ptlrpc_invalidate_import(imp); else rc = ptlrpc_disconnect_import(imp); diff --git a/lustre/ldlm/ldlm_lock.c b/lustre/ldlm/ldlm_lock.c index bb0c0c1..0e7f0b0 100644 --- a/lustre/ldlm/ldlm_lock.c +++ b/lustre/ldlm/ldlm_lock.c @@ -430,9 +430,9 @@ void ldlm_lock_addref_internal(struct ldlm_lock *lock, __u32 mode) { l_lock(&lock->l_resource->lr_namespace->ns_lock); ldlm_lock_remove_from_lru(lock); - if (mode == LCK_NL || mode == LCK_CR || mode == LCK_PR) + if (mode & (LCK_NL | LCK_CR | LCK_PR)) lock->l_readers++; - else + if (mode & (LCK_EX | LCK_CW | LCK_PW)) lock->l_writers++; lock->l_last_used = jiffies; l_unlock(&lock->l_resource->lr_namespace->ns_lock); @@ -448,10 +448,11 @@ void ldlm_lock_decref_internal(struct ldlm_lock *lock, __u32 mode) LDLM_DEBUG(lock, "ldlm_lock_decref(%s)", ldlm_lockname[mode]); ns = lock->l_resource->lr_namespace; l_lock(&ns->ns_lock); - if (mode == LCK_NL || mode == LCK_CR || mode == LCK_PR) { + if (mode & (LCK_NL | LCK_CR | LCK_PR)) { LASSERT(lock->l_readers > 0); lock->l_readers--; - } else { + } + if (mode & (LCK_EX | LCK_CW | LCK_PW)) { LASSERT(lock->l_writers > 0); lock->l_writers--; } @@ -473,13 +474,11 @@ void ldlm_lock_decref_internal(struct ldlm_lock *lock, __u32 mode) "warning\n"); LDLM_DEBUG(lock, "final decref done on cbpending lock"); - l_unlock(&ns->ns_lock); - l_check_no_ns_lock(ns); - /* FIXME: need a real 'desc' here */ - if (lock->l_blocking_ast != NULL) - lock->l_blocking_ast(lock, NULL, lock->l_ast_data, - LDLM_CB_BLOCKING); + LDLM_LOCK_GET(lock); /* dropped by bl thread */ + ldlm_lock_remove_from_lru(lock); + ldlm_bl_to_thread(ns, NULL, lock); + l_unlock(&ns->ns_lock); } else if (ns->ns_client == LDLM_NAMESPACE_CLIENT && !lock->l_readers && !lock->l_writers) { /* If this is a client-side namespace and this was the last @@ -577,7 +576,7 @@ static struct ldlm_lock *search_queue(struct list_head *queue, ldlm_mode_t mode, lock->l_readers == 0 && lock->l_writers == 0) continue; - if (lock->l_req_mode != mode) + if (!(lock->l_req_mode & mode)) continue; if (lock->l_resource->lr_type == LDLM_EXTENT && @@ -593,7 +592,10 @@ static struct ldlm_lock *search_queue(struct list_head *queue, ldlm_mode_t mode, !(lock->l_flags & LDLM_FL_LOCAL)) continue; - ldlm_lock_addref_internal(lock, mode); + if (flags & LDLM_FL_TEST_LOCK) + LDLM_LOCK_GET(lock); + else + ldlm_lock_addref_internal(lock, mode); return lock; } @@ -622,6 +624,8 @@ void ldlm_lock_allow_match(struct ldlm_lock *lock) * If 'flags' contains LDLM_FL_CBPENDING, then locks that have been marked * to be canceled can still be matched as long as they still have reader * or writer refernces + * If 'flags' contains LDLM_FL_TEST_LOCK, then don't actually reference a lock, + * just tell us if we would have matched. * * Returns 1 if it finds an already-existing lock that is compatible; in this * case, lockh is filled in with a addref()ed lock @@ -672,25 +676,40 @@ int ldlm_lock_match(struct ldlm_namespace *ns, int flags, l_unlock(&ns->ns_lock); if (lock) { - struct l_wait_info lwi; ldlm_lock2handle(lock, lockh); - if (lock->l_completion_ast) - lock->l_completion_ast(lock, LDLM_FL_WAIT_NOREPROC, - NULL); + if (!(lock->l_flags & LDLM_FL_CAN_MATCH)) { + struct l_wait_info lwi; + if (lock->l_completion_ast) + lock->l_completion_ast(lock, + LDLM_FL_WAIT_NOREPROC, + NULL); - lwi = LWI_TIMEOUT_INTR(obd_timeout * HZ, NULL, NULL, NULL); + lwi = LWI_TIMEOUT_INTR(obd_timeout*HZ, NULL,NULL,NULL); - /* XXX FIXME see comment about CAN_MATCH in lustre_dlm.h */ - l_wait_event(lock->l_waitq, - (lock->l_flags & LDLM_FL_CAN_MATCH), &lwi); + /* XXX FIXME see comment on CAN_MATCH in lustre_dlm.h */ + l_wait_event(lock->l_waitq, + (lock->l_flags & LDLM_FL_CAN_MATCH), &lwi); + } } if (rc) - LDLM_DEBUG(lock, "matched"); - else - LDLM_DEBUG_NOLOCK("not matched"); + LDLM_DEBUG(lock, "matched ("LPU64" "LPU64")", + type == LDLM_PLAIN ? res_id->name[2] : + policy->l_extent.start, + type == LDLM_PLAIN ? res_id->name[3] : + policy->l_extent.end); + else if (!(flags & LDLM_FL_TEST_LOCK)) /* less verbose for test-only */ + LDLM_DEBUG_NOLOCK("not matched ns %p type %u mode %u res " + LPU64"/"LPU64" ("LPU64" "LPU64")", ns, + type, mode, res_id->name[0], res_id->name[1], + type == LDLM_PLAIN ? res_id->name[2] : + policy->l_extent.start, + type == LDLM_PLAIN ? res_id->name[3] : + policy->l_extent.end); if (old_lock) LDLM_LOCK_PUT(old_lock); + if (flags & LDLM_FL_TEST_LOCK && rc) + LDLM_LOCK_PUT(lock); return rc; } @@ -1041,7 +1060,7 @@ void ldlm_cancel_locks_for_export(struct obd_export *exp) struct ldlm_resource *res; l_lock(&ns->ns_lock); - while(!list_empty(&exp->exp_ldlm_data.led_held_locks)) { + while(!list_empty(&exp->exp_ldlm_data.led_held_locks)) { lock = list_entry(exp->exp_ldlm_data.led_held_locks.next, struct ldlm_lock, l_export_chain); res = ldlm_resource_getref(lock->l_resource); @@ -1148,9 +1167,11 @@ void ldlm_lock_dump(int level, struct ldlm_lock *lock, int pos) "write: %d\n", (int)lock->l_req_mode, (int)lock->l_granted_mode, atomic_read(&lock->l_refc), lock->l_readers, lock->l_writers); if (lock->l_resource->lr_type == LDLM_EXTENT) - CDEBUG(level, " Extent: "LPU64" -> "LPU64"\n", + CDEBUG(level, " Extent: "LPU64" -> "LPU64 + " (req "LPU64"-"LPU64")\n", lock->l_policy_data.l_extent.start, - lock->l_policy_data.l_extent.end); + lock->l_policy_data.l_extent.end, + lock->l_req_extent.start, lock->l_req_extent.end); else if (lock->l_resource->lr_type == LDLM_FLOCK) CDEBUG(level, " Pid: %d Extent: "LPU64" -> "LPU64"\n", lock->l_policy_data.l_flock.pid, diff --git a/lustre/ldlm/ldlm_lockd.c b/lustre/ldlm/ldlm_lockd.c index c28bbe2..5765d8c 100644 --- a/lustre/ldlm/ldlm_lockd.c +++ b/lustre/ldlm/ldlm_lockd.c @@ -51,7 +51,7 @@ static int ldlm_refcount = 0; /* LDLM state */ -static struct ldlm_state *ldlm ; +static struct ldlm_state *ldlm_state; inline unsigned long round_timeout(unsigned long timeout) { @@ -498,9 +498,12 @@ int ldlm_server_completion_ast(struct ldlm_lock *lock, int flags, void *data) if (rc == -ETIMEDOUT || rc == -EINTR || rc == -ENOTCONN) { ldlm_del_waiting_lock(lock); ldlm_failed_ast(lock, rc, "completion"); + } else if (rc == -EINVAL) { + LDLM_DEBUG(lock, "lost the race -- client no longer has this " + "lock"); } else if (rc) { LDLM_ERROR(lock, "client sent rc %d rq_status %d from " - "completion AST\n", rc, req->rq_status); + "completion AST", rc, req->rq_status); ldlm_lock_cancel(lock); /* Server-side AST functions are called from ldlm_reprocess_all, * which needs to be told to please restart its reprocessing. */ @@ -541,10 +544,12 @@ int ldlm_server_glimpse_ast(struct ldlm_lock *lock, void *data) if (rc == -ETIMEDOUT || rc == -EINTR || rc == -ENOTCONN) { ldlm_del_waiting_lock(lock); ldlm_failed_ast(lock, rc, "glimpse"); + } else if (rc == -EINVAL) { + LDLM_DEBUG(lock, "lost the race -- client no longer has this " + "lock"); } else if (rc) { LDLM_ERROR(lock, "client sent rc %d rq_status %d from " - "completion AST\n", rc, req->rq_status); - ldlm_lock_cancel(lock); + "glimpse AST", rc, req->rq_status); } else { rc = res->lr_namespace->ns_lvbo->lvbo_update(res, req->rq_repmsg, 0); @@ -561,9 +566,9 @@ int ldlm_handle_enqueue(struct ptlrpc_request *req, struct obd_device *obddev = req->rq_export->exp_obd; struct ldlm_reply *dlm_rep; struct ldlm_request *dlm_req; - int rc, size[2] = {sizeof(*dlm_rep)}; + int rc = 0, size[2] = {sizeof(*dlm_rep)}; __u32 flags; - ldlm_error_t err; + ldlm_error_t err = ELDLM_OK; struct ldlm_lock *lock = NULL; void *cookie = NULL; ENTRY; @@ -574,7 +579,7 @@ int ldlm_handle_enqueue(struct ptlrpc_request *req, lustre_swab_ldlm_request); if (dlm_req == NULL) { CERROR ("Can't unpack dlm_req\n"); - RETURN (-EFAULT); + GOTO(out, rc = -EFAULT); } flags = dlm_req->lock_flags; @@ -587,7 +592,7 @@ int ldlm_handle_enqueue(struct ptlrpc_request *req, blocking_callback, completion_callback, glimpse_callback, NULL, 0); if (!lock) - GOTO(out, err = -ENOMEM); + GOTO(out, rc = -ENOMEM); do_gettimeofday(&lock->l_enqueued_time); memcpy(&lock->l_remote_handle, &dlm_req->lock_handle1, @@ -614,12 +619,15 @@ int ldlm_handle_enqueue(struct ptlrpc_request *req, rc = lustre_pack_reply(req, buffers, size, NULL); if (rc) - RETURN(rc); + GOTO(out, rc); } if (dlm_req->lock_desc.l_resource.lr_type != LDLM_PLAIN) memcpy(&lock->l_policy_data, &dlm_req->lock_desc.l_policy_data, sizeof(ldlm_policy_data_t)); + if (dlm_req->lock_desc.l_resource.lr_type == LDLM_EXTENT) + memcpy(&lock->l_req_extent, &lock->l_policy_data.l_extent, + sizeof(lock->l_req_extent)); err = ldlm_lock_enqueue(obddev->obd_namespace, &lock, cookie, &flags); if (err) @@ -643,26 +651,34 @@ int ldlm_handle_enqueue(struct ptlrpc_request *req, EXIT; out: - if (lock != NULL && lock->l_resource->lr_lvb_len > 0) { - void *lvb = lustre_msg_buf(req->rq_repmsg, 1, - lock->l_resource->lr_lvb_len); - memcpy(lvb, lock->l_resource->lr_lvb_data, - lock->l_resource->lr_lvb_len); - } req->rq_status = err; + if (req->rq_reply_state == NULL) { + err = lustre_pack_reply(req, 0, NULL, NULL); + if (rc == 0) + rc = err; + } /* The LOCK_CHANGED code in ldlm_lock_enqueue depends on this * ldlm_reprocess_all. If this moves, revisit that code. -phil */ if (lock) { LDLM_DEBUG(lock, "server-side enqueue handler, sending reply" - "(err=%d)", err); + "(err=%d, rc=%d)", err, rc); + + if (lock->l_resource->lr_lvb_len > 0) { + void *lvb = lustre_msg_buf(req->rq_repmsg, 1, + lock->l_resource->lr_lvb_len); + memcpy(lvb, lock->l_resource->lr_lvb_data, + lock->l_resource->lr_lvb_len); + } + if (!err && dlm_req->lock_desc.l_resource.lr_type != LDLM_FLOCK) ldlm_reprocess_all(lock->l_resource); LDLM_LOCK_PUT(lock); } - LDLM_DEBUG_NOLOCK("server-side enqueue handler END (lock %p)", lock); + LDLM_DEBUG_NOLOCK("server-side enqueue handler END (lock %p, rc %d)", + lock, rc); - return 0; + return rc; } int ldlm_handle_convert(struct ptlrpc_request *req) @@ -754,7 +770,7 @@ int ldlm_handle_cancel(struct ptlrpc_request *req) (res, NULL, 0); //(res, req->rq_reqmsg, 1); } - + ldlm_lock_cancel(lock); if (ldlm_del_waiting_lock(lock)) CDEBUG(D_DLMTRACE, "cancelled waiting lock %p\n", lock); @@ -902,17 +918,19 @@ static void ldlm_handle_gl_callback(struct ptlrpc_request *req, static int ldlm_callback_reply(struct ptlrpc_request *req, int rc) { req->rq_status = rc; - rc = lustre_pack_reply(req, 0, NULL, NULL); - if (rc) - return rc; + if (req->rq_reply_state == NULL) { + rc = lustre_pack_reply(req, 0, NULL, NULL); + if (rc) + return rc; + } return ptlrpc_reply(req); } #ifdef __KERNEL__ -static int ldlm_bl_to_thread(struct ldlm_state *ldlm, struct ldlm_namespace *ns, - struct ldlm_lock_desc *ld, struct ldlm_lock *lock) +int ldlm_bl_to_thread(struct ldlm_namespace *ns, struct ldlm_lock_desc *ld, + struct ldlm_lock *lock) { - struct ldlm_bl_pool *blp = ldlm->ldlm_bl_pool; + struct ldlm_bl_pool *blp = ldlm_state->ldlm_bl_pool; struct ldlm_bl_work_item *blwi; ENTRY; @@ -921,7 +939,8 @@ static int ldlm_bl_to_thread(struct ldlm_state *ldlm, struct ldlm_namespace *ns, RETURN(-ENOMEM); blwi->blwi_ns = ns; - blwi->blwi_ld = *ld; + if (ld != NULL) + blwi->blwi_ld = *ld; blwi->blwi_lock = lock; spin_lock(&blp->blp_lock); @@ -969,58 +988,48 @@ static int ldlm_callback_handler(struct ptlrpc_request *req) RETURN(0); } - if (req->rq_reqmsg->opc == LDLM_BL_CALLBACK) { + LASSERT(req->rq_export != NULL); + LASSERT(req->rq_export->exp_obd != NULL); + + switch(req->rq_reqmsg->opc) { + case LDLM_BL_CALLBACK: OBD_FAIL_RETURN(OBD_FAIL_LDLM_BL_CALLBACK, 0); - } else if (req->rq_reqmsg->opc == LDLM_CP_CALLBACK) { + break; + case LDLM_CP_CALLBACK: OBD_FAIL_RETURN(OBD_FAIL_LDLM_CP_CALLBACK, 0); - } else if (req->rq_reqmsg->opc == LDLM_GL_CALLBACK) { + break; + case LDLM_GL_CALLBACK: OBD_FAIL_RETURN(OBD_FAIL_LDLM_GL_CALLBACK, 0); - } else if (req->rq_reqmsg->opc == OBD_LOG_CANCEL) { + break; + case OBD_LOG_CANCEL: OBD_FAIL_RETURN(OBD_FAIL_OBD_LOG_CANCEL_NET, 0); - } else if (req->rq_reqmsg->opc == LLOG_ORIGIN_HANDLE_CREATE) { - OBD_FAIL_RETURN(OBD_FAIL_OBD_LOGD_NET, 0); - } else if (req->rq_reqmsg->opc == LLOG_ORIGIN_HANDLE_NEXT_BLOCK) { - OBD_FAIL_RETURN(OBD_FAIL_OBD_LOGD_NET, 0); - } else if (req->rq_reqmsg->opc == LLOG_ORIGIN_HANDLE_READ_HEADER) { - OBD_FAIL_RETURN(OBD_FAIL_OBD_LOGD_NET, 0); - } else if (req->rq_reqmsg->opc == LLOG_ORIGIN_HANDLE_CLOSE) { - OBD_FAIL_RETURN(OBD_FAIL_OBD_LOGD_NET, 0); - } else { - ldlm_callback_reply(req, -EPROTO); - RETURN(0); - } - - LASSERT(req->rq_export != NULL); - LASSERT(req->rq_export->exp_obd != NULL); - - /* FIXME - how to send reply */ - if (req->rq_reqmsg->opc == OBD_LOG_CANCEL) { - int rc = llog_origin_handle_cancel(req); + rc = llog_origin_handle_cancel(req); ldlm_callback_reply(req, rc); RETURN(0); - } - if (req->rq_reqmsg->opc == LLOG_ORIGIN_HANDLE_CREATE) { - int rc = llog_origin_handle_create(req); - req->rq_status = rc; - ptlrpc_reply(req); + case LLOG_ORIGIN_HANDLE_CREATE: + OBD_FAIL_RETURN(OBD_FAIL_OBD_LOGD_NET, 0); + rc = llog_origin_handle_create(req); + ldlm_callback_reply(req, rc); RETURN(0); - } - if (req->rq_reqmsg->opc == LLOG_ORIGIN_HANDLE_NEXT_BLOCK) { - int rc = llog_origin_handle_next_block(req); - req->rq_status = rc; - ptlrpc_reply(req); + case LLOG_ORIGIN_HANDLE_NEXT_BLOCK: + OBD_FAIL_RETURN(OBD_FAIL_OBD_LOGD_NET, 0); + rc = llog_origin_handle_next_block(req); + ldlm_callback_reply(req, rc); RETURN(0); - } - if (req->rq_reqmsg->opc == LLOG_ORIGIN_HANDLE_READ_HEADER) { - int rc = llog_origin_handle_read_header(req); - req->rq_status = rc; - ptlrpc_reply(req); + case LLOG_ORIGIN_HANDLE_READ_HEADER: + OBD_FAIL_RETURN(OBD_FAIL_OBD_LOGD_NET, 0); + rc = llog_origin_handle_read_header(req); + ldlm_callback_reply(req, rc); RETURN(0); - } - if (req->rq_reqmsg->opc == LLOG_ORIGIN_HANDLE_CLOSE) { - int rc = llog_origin_handle_close(req); + case LLOG_ORIGIN_HANDLE_CLOSE: + OBD_FAIL_RETURN(OBD_FAIL_OBD_LOGD_NET, 0); + rc = llog_origin_handle_close(req); ldlm_callback_reply(req, rc); RETURN(0); + default: + CERROR("unknown opcode %u\n", req->rq_reqmsg->opc); + ldlm_callback_reply(req, -EPROTO); + RETURN(0); } ns = req->rq_export->exp_obd->obd_namespace; @@ -1053,14 +1062,12 @@ static int ldlm_callback_handler(struct ptlrpc_request *req) * cancelling right now, because it's unused, or have an intent result * in the reply, so we might have to push the responsibility for sending * the reply down into the AST handlers, alas. */ - if (req->rq_reqmsg->opc == LDLM_CP_CALLBACK) - ldlm_callback_reply(req, 0); switch (req->rq_reqmsg->opc) { case LDLM_BL_CALLBACK: CDEBUG(D_INODE, "blocking ast\n"); #ifdef __KERNEL__ - rc = ldlm_bl_to_thread(ldlm, ns, &dlm_req->lock_desc, lock); + rc = ldlm_bl_to_thread(ns, &dlm_req->lock_desc, lock); ldlm_callback_reply(req, rc); #else rc = 0; @@ -1070,6 +1077,7 @@ static int ldlm_callback_handler(struct ptlrpc_request *req) break; case LDLM_CP_CALLBACK: CDEBUG(D_INODE, "completion ast\n"); + ldlm_callback_reply(req, 0); ldlm_handle_cp_callback(req, ns, dlm_req, lock); break; case LDLM_GL_CALLBACK: @@ -1235,11 +1243,11 @@ static int ldlm_setup(void) #endif ENTRY; - if (ldlm != NULL) + if (ldlm_state != NULL) RETURN(-EALREADY); - OBD_ALLOC(ldlm, sizeof(*ldlm)); - if (ldlm == NULL) + OBD_ALLOC(ldlm_state, sizeof(*ldlm_state)); + if (ldlm_state == NULL) RETURN(-ENOMEM); #ifdef __KERNEL__ @@ -1248,25 +1256,25 @@ static int ldlm_setup(void) GOTO(out_free, rc); #endif - ldlm->ldlm_cb_service = + ldlm_state->ldlm_cb_service = ptlrpc_init_svc(LDLM_NBUFS, LDLM_BUFSIZE, LDLM_MAXREQSIZE, LDLM_CB_REQUEST_PORTAL, LDLM_CB_REPLY_PORTAL, ldlm_callback_handler, "ldlm_cbd", ldlm_svc_proc_dir); - if (!ldlm->ldlm_cb_service) { + if (!ldlm_state->ldlm_cb_service) { CERROR("failed to start service\n"); GOTO(out_proc, rc = -ENOMEM); } - ldlm->ldlm_cancel_service = - ptlrpc_init_svc(LDLM_NBUFS, LDLM_BUFSIZE, LDLM_MAXREQSIZE, + ldlm_state->ldlm_cancel_service = + ptlrpc_init_svc(LDLM_NBUFS, LDLM_BUFSIZE, LDLM_MAXREQSIZE, LDLM_CANCEL_REQUEST_PORTAL, LDLM_CANCEL_REPLY_PORTAL, ldlm_cancel_handler, "ldlm_canceld", ldlm_svc_proc_dir); - if (!ldlm->ldlm_cancel_service) { + if (!ldlm_state->ldlm_cancel_service) { CERROR("failed to start service\n"); GOTO(out_proc, rc = -ENOMEM); } @@ -1274,7 +1282,7 @@ static int ldlm_setup(void) OBD_ALLOC(blp, sizeof(*blp)); if (blp == NULL) GOTO(out_proc, rc = -ENOMEM); - ldlm->ldlm_bl_pool = blp; + ldlm_state->ldlm_bl_pool = blp; atomic_set(&blp->blp_num_threads, 0); init_waitqueue_head(&blp->blp_waitq); @@ -1298,14 +1306,14 @@ static int ldlm_setup(void) wait_for_completion(&blp->blp_comp); } - rc = ptlrpc_start_n_threads(NULL, ldlm->ldlm_cancel_service, + rc = ptlrpc_start_n_threads(NULL, ldlm_state->ldlm_cancel_service, LDLM_NUM_THREADS, "ldlm_cn"); if (rc) { LBUG(); GOTO(out_thread, rc); } - rc = ptlrpc_start_n_threads(NULL, ldlm->ldlm_cb_service, + rc = ptlrpc_start_n_threads(NULL, ldlm_state->ldlm_cb_service, LDLM_NUM_THREADS, "ldlm_cb"); if (rc) { LBUG(); @@ -1337,8 +1345,8 @@ static int ldlm_setup(void) #ifdef __KERNEL__ out_thread: - ptlrpc_unregister_service(ldlm->ldlm_cancel_service); - ptlrpc_unregister_service(ldlm->ldlm_cb_service); + ptlrpc_unregister_service(ldlm_state->ldlm_cancel_service); + ptlrpc_unregister_service(ldlm_state->ldlm_cb_service); #endif out_proc: @@ -1346,15 +1354,15 @@ static int ldlm_setup(void) ldlm_proc_cleanup(); out_free: #endif - OBD_FREE(ldlm, sizeof(*ldlm)); - ldlm = NULL; + OBD_FREE(ldlm_state, sizeof(*ldlm_state)); + ldlm_state = NULL; return rc; } static int ldlm_cleanup(int force) { #ifdef __KERNEL__ - struct ldlm_bl_pool *blp = ldlm->ldlm_bl_pool; + struct ldlm_bl_pool *blp = ldlm_state->ldlm_bl_pool; #endif ENTRY; @@ -1379,10 +1387,10 @@ static int ldlm_cleanup(int force) } OBD_FREE(blp, sizeof(*blp)); - ptlrpc_stop_all_threads(ldlm->ldlm_cb_service); - ptlrpc_unregister_service(ldlm->ldlm_cb_service); - ptlrpc_stop_all_threads(ldlm->ldlm_cancel_service); - ptlrpc_unregister_service(ldlm->ldlm_cancel_service); + ptlrpc_stop_all_threads(ldlm_state->ldlm_cb_service); + ptlrpc_unregister_service(ldlm_state->ldlm_cb_service); + ptlrpc_stop_all_threads(ldlm_state->ldlm_cancel_service); + ptlrpc_unregister_service(ldlm_state->ldlm_cancel_service); ldlm_proc_cleanup(); expired_lock_thread.elt_state = ELT_TERMINATE; @@ -1392,8 +1400,8 @@ static int ldlm_cleanup(int force) #endif - OBD_FREE(ldlm, sizeof(*ldlm)); - ldlm = NULL; + OBD_FREE(ldlm_state, sizeof(*ldlm_state)); + ldlm_state = NULL; RETURN(0); } @@ -1494,6 +1502,8 @@ EXPORT_SYMBOL(ldlm_regression_stop); EXPORT_SYMBOL(ldlm_namespace_new); EXPORT_SYMBOL(ldlm_namespace_cleanup); EXPORT_SYMBOL(ldlm_namespace_free); +EXPORT_SYMBOL(ldlm_namespace_dump); +EXPORT_SYMBOL(ldlm_dump_all_namespaces); EXPORT_SYMBOL(ldlm_resource_get); EXPORT_SYMBOL(ldlm_resource_putref); diff --git a/lustre/ldlm/ldlm_plain.c b/lustre/ldlm/ldlm_plain.c index 9b2af34..9a693e3 100644 --- a/lustre/ldlm/ldlm_plain.c +++ b/lustre/ldlm/ldlm_plain.c @@ -43,6 +43,8 @@ ldlm_plain_compat_queue(struct list_head *queue, struct ldlm_lock *req, int compat = 1; ENTRY; + lockmode_verify(req_mode); + list_for_each(tmp, queue) { lock = list_entry(tmp, struct ldlm_lock, l_res_link); diff --git a/lustre/ldlm/ldlm_request.c b/lustre/ldlm/ldlm_request.c index f6045f8..01e4562 100644 --- a/lustre/ldlm/ldlm_request.c +++ b/lustre/ldlm/ldlm_request.c @@ -168,6 +168,9 @@ static int ldlm_cli_enqueue_local(struct ldlm_namespace *ns, lock->l_lvb_swabber = lvb_swabber; if (policy != NULL) memcpy(&lock->l_policy_data, policy, sizeof(*policy)); + if (type == LDLM_EXTENT) + memcpy(&lock->l_req_extent, &policy->l_extent, + sizeof(policy->l_extent)); err = ldlm_lock_enqueue(ns, &lock, policy, flags); if (err != ELDLM_OK) @@ -255,6 +258,9 @@ int ldlm_cli_enqueue(struct obd_export *exp, lock->l_lvb_swabber = lvb_swabber; if (policy != NULL) memcpy(&lock->l_policy_data, policy, sizeof(*policy)); + if (type == LDLM_EXTENT) + memcpy(&lock->l_req_extent, &policy->l_extent, + sizeof(policy->l_extent)); LDLM_DEBUG(lock, "client-side enqueue START"); } @@ -374,7 +380,9 @@ int ldlm_cli_enqueue(struct obd_export *exp, LDLM_DEBUG(lock, "enqueue reply includes blocking AST"); } - if (lvb_len) { + /* If the lock has already been granted by a completion AST, don't + * clobber the LVB with an older one. */ + if (lvb_len && (lock->l_req_mode != lock->l_granted_mode)) { void *tmplvb; tmplvb = lustre_swab_repbuf(req, 1, lvb_len, lvb_swabber); if (tmplvb == NULL) @@ -581,9 +589,8 @@ int ldlm_cli_cancel(struct lustre_handle *lockh) int ldlm_cancel_lru(struct ldlm_namespace *ns) { - struct list_head *tmp, *next, list = LIST_HEAD_INIT(list); + struct list_head *tmp, *next; int count, rc = 0; - struct ldlm_ast_work *w; ENTRY; l_lock(&ns->ns_lock); @@ -607,33 +614,14 @@ int ldlm_cancel_lru(struct ldlm_namespace *ns) * won't see this flag and call l_blocking_ast */ lock->l_flags |= LDLM_FL_CBPENDING; - OBD_ALLOC(w, sizeof(*w)); - LASSERT(w); - - w->w_lock = LDLM_LOCK_GET(lock); - list_add(&w->w_list, &list); + LDLM_LOCK_GET(lock); /* dropped by bl thread */ ldlm_lock_remove_from_lru(lock); + ldlm_bl_to_thread(ns, NULL, lock); if (--count == 0) break; } l_unlock(&ns->ns_lock); - - list_for_each_safe(tmp, next, &list) { - struct lustre_handle lockh; - int rc; - w = list_entry(tmp, struct ldlm_ast_work, w_list); - - ldlm_lock2handle(w->w_lock, &lockh); - rc = ldlm_cli_cancel(&lockh); - if (rc != ELDLM_OK) - CDEBUG(D_INFO, "ldlm_cli_cancel: %d\n", rc); - - list_del(&w->w_list); - LDLM_LOCK_PUT(w->w_lock); - OBD_FREE(w, sizeof(*w)); - } - RETURN(rc); } @@ -913,7 +901,8 @@ static int replay_one_lock(struct obd_import *imp, struct ldlm_lock *lock) struct ptlrpc_request *req; struct ldlm_request *body; struct ldlm_reply *reply; - int size; + int buffers = 1; + int size[2]; int flags; /* @@ -939,8 +928,8 @@ static int replay_one_lock(struct obd_import *imp, struct ldlm_lock *lock) else flags = LDLM_FL_REPLAY; - size = sizeof(*body); - req = ptlrpc_prep_req(imp, LDLM_ENQUEUE, 1, &size, NULL); + size[0] = sizeof(*body); + req = ptlrpc_prep_req(imp, LDLM_ENQUEUE, 1, size, NULL); if (!req) RETURN(-ENOMEM); @@ -952,8 +941,12 @@ static int replay_one_lock(struct obd_import *imp, struct ldlm_lock *lock) body->lock_flags = flags; ldlm_lock2handle(lock, &body->lock_handle1); - size = sizeof(*reply); - req->rq_replen = lustre_msg_size(1, &size); + size[0] = sizeof(*reply); + if (lock->l_lvb_len != 0) { + buffers = 2; + size[1] = lock->l_lvb_len; + } + req->rq_replen = lustre_msg_size(buffers, size); LDLM_DEBUG(lock, "replaying lock:"); diff --git a/lustre/ldlm/ldlm_resource.c b/lustre/ldlm/ldlm_resource.c index 52cebf1..80545d0 100644 --- a/lustre/ldlm/ldlm_resource.c +++ b/lustre/ldlm/ldlm_resource.c @@ -495,7 +495,6 @@ ldlm_resource_get(struct ldlm_namespace *ns, struct ldlm_resource *parent, { struct list_head *bucket, *tmp; struct ldlm_resource *res = NULL; - int rc; ENTRY; LASSERT(ns != NULL); @@ -523,12 +522,10 @@ ldlm_resource_get(struct ldlm_namespace *ns, struct ldlm_resource *parent, l_unlock(&ns->ns_lock); if (create && ns->ns_lvbo && ns->ns_lvbo->lvbo_init) { - rc = ns->ns_lvbo->lvbo_init(res); - if (rc) { - CERROR("lvbo_init failure %d\n", rc); - LASSERT(ldlm_resource_putref(res) == 1); - res = NULL; - } + int rc = ns->ns_lvbo->lvbo_init(res); + if (rc) + CERROR("lvbo_init failed for resource "LPU64": rc %d\n", + name.name[0], rc); } RETURN(res); diff --git a/lustre/liblustre/rw.c b/lustre/liblustre/rw.c index d36389b..6fe7431 100644 --- a/lustre/liblustre/rw.c +++ b/lustre/liblustre/rw.c @@ -313,17 +313,18 @@ int llu_extent_lock(struct ll_file_data *fd, struct inode *inode, size_lock.end = OBD_OBJECT_EOF; /* XXX I bet we should be checking the lock ignore flags.. */ + /* FIXME use LDLM_FL_TEST_LOCK instead */ flags = LDLM_FL_CBPENDING | LDLM_FL_BLOCK_GRANTED; matched = obd_match(exp, lsm, LDLM_EXTENT, &size_lock, sizeof(size_lock), LCK_PR, &flags, inode, &match_lockh); - /* hey, alright, we hold a size lock that covers the size we + /* hey, alright, we hold a size lock that covers the size we * just found, its not going to change for a while.. */ if (matched == 1) { set_bit(LLI_F_HAVE_OST_SIZE_LOCK, &lli->lli_flags); obd_cancel(exp, lsm, LCK_PR, &match_lockh); - } + } RETURN(0); } diff --git a/lustre/liblustre/super.c b/lustre/liblustre/super.c index 392e22a..8321956 100644 --- a/lustre/liblustre/super.c +++ b/lustre/liblustre/super.c @@ -355,6 +355,7 @@ static int llu_have_md_lock(struct inode *inode) CDEBUG(D_INFO, "trying to match res "LPU64"\n", res_id.name[0]); + /* FIXME use LDLM_FL_TEST_LOCK instead */ flags = LDLM_FL_BLOCK_GRANTED | LDLM_FL_CBPENDING; if (ldlm_lock_match(obddev->obd_namespace, flags, &res_id, LDLM_PLAIN, NULL, LCK_PR, &lockh)) { diff --git a/lustre/llite/dir.c b/lustre/llite/dir.c index 7733155..3f945a7 100644 --- a/lustre/llite/dir.c +++ b/lustre/llite/dir.c @@ -59,62 +59,20 @@ typedef struct ext2_dir_entry_2 ext2_dirent; static int ll_dir_readpage(struct file *file, struct page *page) { struct inode *inode = page->mapping->host; - struct ll_sb_info *sbi = ll_i2sbi(inode); struct ll_fid mdc_fid; __u64 offset; - int rc = 0; struct ptlrpc_request *request; - struct lustre_handle lockh; struct mds_body *body; - struct lookup_intent it = { .it_op = IT_READDIR }; - struct mdc_op_data data; - struct obd_device *obddev = class_exp2obd(sbi->ll_mdc_exp); - struct ldlm_res_id res_id = - { .name = {inode->i_ino, (__u64)inode->i_generation} }; + int rc = 0; ENTRY; CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p)\n", inode->i_ino, inode->i_generation, inode); - if ((inode->i_size + PAGE_CACHE_SIZE - 1) >> PAGE_SHIFT <= page->index){ - /* XXX why do we need this exactly, and why do we think that - * an all-zero directory page is useful? - */ - CERROR("memsetting dir page %lu to zero (size %lld)\n", - page->index, inode->i_size); - memset(kmap(page), 0, PAGE_CACHE_SIZE); - kunmap(page); - GOTO(readpage_out, rc); - } - - rc = ldlm_lock_match(obddev->obd_namespace, LDLM_FL_BLOCK_GRANTED, - &res_id, LDLM_PLAIN, NULL, LCK_PR, &lockh); - if (!rc) { - ll_prepare_mdc_op_data(&data, inode, NULL, NULL, 0, 0); - - rc = mdc_enqueue(sbi->ll_mdc_exp, LDLM_PLAIN, &it, LCK_PR, - &data, &lockh, NULL, 0, - ldlm_completion_ast, ll_mdc_blocking_ast, - inode); - request = (struct ptlrpc_request *)it.d.lustre.it_data; - if (request) - ptlrpc_req_finished(request); - if (rc < 0) { - CERROR("lock enqueue: err: %d\n", rc); - unlock_page(page); - RETURN(rc); - } - } - ldlm_lock_dump_handle(D_OTHER, &lockh); - - if (PageUptodate(page)) { - CERROR("Explain this please?\n"); - GOTO(readpage_out, rc); - } mdc_pack_fid(&mdc_fid, inode->i_ino, inode->i_generation, S_IFDIR); offset = page->index << PAGE_SHIFT; - rc = mdc_readpage(sbi->ll_mdc_exp, &mdc_fid, + rc = mdc_readpage(ll_i2sbi(inode)->ll_mdc_exp, &mdc_fid, offset, page, &request); if (!rc) { body = lustre_msg_buf(request->rq_repmsg, 0, sizeof (*body)); @@ -122,16 +80,12 @@ static int ll_dir_readpage(struct file *file, struct page *page) LASSERT_REPSWABBED (request, 0); /* swabbed by mdc_readpage() */ inode->i_size = body->size; + SetPageUptodate(page); } ptlrpc_req_finished(request); - EXIT; - - readpage_out: - if (!rc) - SetPageUptodate(page); unlock_page(page); - ldlm_lock_decref(&lockh, LCK_PR); + EXIT; return rc; } @@ -252,9 +206,39 @@ fail: static struct page *ll_get_dir_page(struct inode *dir, unsigned long n) { + struct ldlm_res_id res_id = + { .name = { dir->i_ino, (__u64)dir->i_generation} }; + struct lustre_handle lockh; + struct obd_device *obddev = class_exp2obd(ll_i2sbi(dir)->ll_mdc_exp); struct address_space *mapping = dir->i_mapping; - struct page *page = read_cache_page(mapping, n, - (filler_t*)mapping->a_ops->readpage, NULL); + struct page *page; + int rc; + + rc = ldlm_lock_match(obddev->obd_namespace, LDLM_FL_BLOCK_GRANTED, + &res_id, LDLM_PLAIN, NULL, LCK_PR, &lockh); + if (!rc) { + struct lookup_intent it = { .it_op = IT_READDIR }; + struct ptlrpc_request *request; + struct mdc_op_data data; + + ll_prepare_mdc_op_data(&data, dir, NULL, NULL, 0, 0); + + rc = mdc_enqueue(ll_i2sbi(dir)->ll_mdc_exp, LDLM_PLAIN, &it, + LCK_PR, &data, &lockh, NULL, 0, + ldlm_completion_ast, ll_mdc_blocking_ast, dir); + + request = (struct ptlrpc_request *)it.d.lustre.it_data; + if (request) + ptlrpc_req_finished(request); + if (rc < 0) { + CERROR("lock enqueue: rc: %d\n", rc); + return ERR_PTR(rc); + } + } + ldlm_lock_dump_handle(D_OTHER, &lockh); + + page = read_cache_page(mapping, n, + (filler_t*)mapping->a_ops->readpage, NULL); if (!IS_ERR(page)) { wait_on_page(page); (void)kmap(page); @@ -265,14 +249,17 @@ static struct page *ll_get_dir_page(struct inode *dir, unsigned long n) if (PageError(page)) goto fail; } + +out_unlock: + ldlm_lock_decref(&lockh, LCK_PR); return page; fail: ext2_put_page(page); - return ERR_PTR(-EIO); + page = ERR_PTR(-EIO); + goto out_unlock; } - /* * p is at least 6 bytes before the end of page */ @@ -305,8 +292,8 @@ static unsigned char ext2_filetype_table[EXT2_FT_MAX] = { int ll_readdir(struct file * filp, void * dirent, filldir_t filldir) { - loff_t pos = filp->f_pos; struct inode *inode = filp->f_dentry->d_inode; + loff_t pos = filp->f_pos; // XXX struct super_block *sb = inode->i_sb; unsigned offset = pos & ~PAGE_CACHE_MASK; unsigned long n = pos >> PAGE_CACHE_SHIFT; @@ -314,12 +301,14 @@ int ll_readdir(struct file * filp, void * dirent, filldir_t filldir) unsigned chunk_mask = ~(ext2_chunk_size(inode)-1); unsigned char *types = NULL; int need_revalidate = (filp->f_version != inode->i_version); + int rc = 0; ENTRY; - CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p)\n", inode->i_ino, - inode->i_generation, inode); + CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p) pos %llu/%llu\n", + inode->i_ino, inode->i_generation, inode, pos, inode->i_size); + if (pos > inode->i_size - EXT2_DIR_REC_LEN(1)) - GOTO(done, 0); + RETURN(0); types = ext2_filetype_table; @@ -328,15 +317,21 @@ int ll_readdir(struct file * filp, void * dirent, filldir_t filldir) ext2_dirent *de; struct page *page; - CDEBUG(D_EXT2, "reading %lu of dir %lu page %lu, size %llu\n", - PAGE_CACHE_SIZE, inode->i_ino, n, inode->i_size); + CDEBUG(D_EXT2,"read %lu of dir %lu/%u page %lu/%lu size %llu\n", + PAGE_CACHE_SIZE, inode->i_ino, inode->i_generation, + n, npages, inode->i_size); page = ll_get_dir_page(inode, n); /* size might have been updated by mdc_readpage */ npages = dir_pages(inode); - if (IS_ERR(page)) + if (IS_ERR(page)) { + rc = PTR_ERR(page); + CERROR("error reading dir %lu/%u page %lu: rc %d\n", + inode->i_ino, inode->i_generation, n, rc); continue; + } + kaddr = page_address(page); if (need_revalidate) { offset = ext2_validate_entry(kaddr, offset, chunk_mask); @@ -349,6 +344,7 @@ int ll_readdir(struct file * filp, void * dirent, filldir_t filldir) int over; unsigned char d_type = DT_UNKNOWN; + rc = 0; /* no error if we return something */ if (types && de->file_type < EXT2_FT_MAX) d_type = types[de->file_type]; @@ -358,7 +354,7 @@ int ll_readdir(struct file * filp, void * dirent, filldir_t filldir) le32_to_cpu(de->inode), d_type); if (over) { ext2_put_page(page); - GOTO(done,0); + GOTO(done, rc); } } } @@ -369,7 +365,7 @@ done: filp->f_pos = (n << PAGE_CACHE_SHIFT) | offset; filp->f_version = inode->i_version; update_atime(inode); - RETURN(0); + RETURN(rc); } static int ll_dir_ioctl(struct inode *inode, struct file *file, diff --git a/lustre/llite/file.c b/lustre/llite/file.c index bac31cb..2cbc22e 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -318,64 +318,68 @@ static int ll_lock_to_stripe_offset(struct inode *inode, struct ldlm_lock *lock) * * No one can dirty the extent until we've finished our work and they can * enqueue another lock. The DLM protects us from ll_file_read/write here, - * but other kernel actors could have pages locked. */ + * but other kernel actors could have pages locked. + * + * Called with the DLM lock held. */ void ll_pgcache_remove_extent(struct inode *inode, struct lov_stripe_md *lsm, struct ldlm_lock *lock, __u32 stripe) { - struct ldlm_extent *extent = &lock->l_policy_data.l_extent; + ldlm_policy_data_t tmpex; unsigned long start, end, count, skip, i, j; struct page *page; - int rc, discard = lock->l_flags & LDLM_FL_DISCARD_DATA; + int rc, rc2, discard = lock->l_flags & LDLM_FL_DISCARD_DATA; + struct lustre_handle lockh; ENTRY; - CDEBUG(D_INODE, "obdo %lu inode %p ["LPU64"->"LPU64"] size: %llu\n", - inode->i_ino, inode, extent->start, extent->end, inode->i_size); + memcpy(&tmpex, &lock->l_policy_data, sizeof(tmpex)); + CDEBUG(D_INODE|D_PAGE, "inode %lu(%p) ["LPU64"->"LPU64"] size: %llu\n", + inode->i_ino, inode, tmpex.l_extent.start, tmpex.l_extent.end, + inode->i_size); /* our locks are page granular thanks to osc_enqueue, we invalidate the * whole page. */ - LASSERT((extent->start & ~PAGE_CACHE_MASK) == 0); - LASSERT(((extent->end+1) & ~PAGE_CACHE_MASK) == 0); + LASSERT((tmpex.l_extent.start & ~PAGE_CACHE_MASK) == 0); + LASSERT(((tmpex.l_extent.end + 1) & ~PAGE_CACHE_MASK) == 0); - start = extent->start >> PAGE_CACHE_SHIFT; count = ~0; skip = 0; - end = (extent->end >> PAGE_CACHE_SHIFT) + 1; - if ((end << PAGE_CACHE_SHIFT) < extent->end) - end = ~0; + start = tmpex.l_extent.start >> PAGE_CACHE_SHIFT; + end = tmpex.l_extent.end >> PAGE_CACHE_SHIFT; if (lsm->lsm_stripe_count > 1) { count = lsm->lsm_stripe_size >> PAGE_CACHE_SHIFT; skip = (lsm->lsm_stripe_count - 1) * count; - start += (start/count * skip) + (stripe * count); + start += start/count * skip + stripe * count; if (end != ~0) - end += (end/count * skip) + (stripe * count); - } + end += end/count * skip + stripe * count; + } + if (end < tmpex.l_extent.end >> PAGE_CACHE_SHIFT) + end = ~0; i = (inode->i_size + PAGE_CACHE_SIZE-1) >> PAGE_CACHE_SHIFT; if (i < end) end = i; - CDEBUG(D_INODE, "walking page indices start: %lu j: %lu count: %lu " - "skip: %lu end: %lu%s\n", start, start % count, count, skip, end, - discard ? " (DISCARDING)" : ""); + CDEBUG(D_INODE|D_PAGE, "walking page indices start: %lu j: %lu " + "count: %lu skip: %lu end: %lu%s\n", start, start % count, + count, skip, end, discard ? " (DISCARDING)" : ""); /* this is the simplistic implementation of page eviction at * cancelation. It is careful to get races with other page * lockers handled correctly. fixes from bug 20 will make it * more efficient by associating locks with pages and with * batching writeback under the lock explicitly. */ - for (i = start, j = start % count ; ; j++, i++) { - if (j == count) { - i += skip; - j = 0; - } - if (i >= end) - break; + for (i = start, j = start % count ; i <= end; + j++, i++, tmpex.l_extent.start += PAGE_CACHE_SIZE) { + LASSERTF(tmpex.l_extent.start< lock->l_policy_data.l_extent.end, + LPU64" >= "LPU64" start %lu i %lu end %lu\n", + tmpex.l_extent.start, lock->l_policy_data.l_extent.end, + start, i, end); ll_pgcache_lock(inode->i_mapping); if (list_empty(&inode->i_mapping->dirty_pages) && list_empty(&inode->i_mapping->clean_pages) && list_empty(&inode->i_mapping->locked_pages)) { - CDEBUG(D_INODE, "nothing left\n"); + CDEBUG(D_INODE|D_PAGE, "nothing left\n"); ll_pgcache_unlock(inode->i_mapping); break; } @@ -385,14 +389,14 @@ void ll_pgcache_remove_extent(struct inode *inode, struct lov_stripe_md *lsm, page = find_get_page(inode->i_mapping, i); if (page == NULL) - continue; - LL_CDEBUG_PAGE(page, "locking page\n"); + goto next_index; + LL_CDEBUG_PAGE(D_PAGE, page, "locking page\n"); lock_page(page); /* page->mapping to check with racing against teardown */ if (page->mapping && PageDirty(page) && !discard) { ClearPageDirty(page); - LL_CDEBUG_PAGE(page, "found dirty\n"); + LL_CDEBUG_PAGE(D_PAGE, page, "found dirty\n"); ll_pgcache_lock(inode->i_mapping); list_del(&page->list); list_add(&page->list, &inode->i_mapping->locked_pages); @@ -407,13 +411,26 @@ void ll_pgcache_remove_extent(struct inode *inode, struct lov_stripe_md *lsm, lock_page(page); } - /* checking again to account for writeback's lock_page() */ - if (page->mapping != NULL) { - LL_CDEBUG_PAGE(page, "truncating\n"); + tmpex.l_extent.end = tmpex.l_extent.start + PAGE_CACHE_SIZE - 1; + /* check to see if another DLM lock covers this page */ + rc2 = ldlm_lock_match(lock->l_resource->lr_namespace, + LDLM_FL_BLOCK_GRANTED|LDLM_FL_CBPENDING | + LDLM_FL_TEST_LOCK, + &lock->l_resource->lr_name, LDLM_EXTENT, + &tmpex, LCK_PR | LCK_PW, &lockh); + if (rc2 == 0 && page->mapping != NULL) { + // checking again to account for writeback's lock_page() + LL_CDEBUG_PAGE(D_PAGE, page, "truncating\n"); ll_truncate_complete_page(page); } unlock_page(page); page_cache_release(page); + + next_index: + if (j == count) { + i += skip; + j = 0; + } } EXIT; } @@ -439,12 +456,17 @@ static int ll_extent_lock_callback(struct ldlm_lock *lock, CERROR("ldlm_cli_cancel failed: %d\n", rc); break; case LDLM_CB_CANCELING: { - struct inode *inode = ll_inode_from_lock(lock); + struct inode *inode; struct ll_inode_info *lli; struct lov_stripe_md *lsm; __u32 stripe; __u64 kms; + /* This lock wasn't granted, don't try to evict pages */ + if (lock->l_req_mode != lock->l_granted_mode) + RETURN(0); + + inode = ll_inode_from_lock(lock); if (inode == NULL) RETURN(0); lli = ll_i2info(inode); @@ -569,7 +591,7 @@ static int ll_glimpse_callback(struct ldlm_lock *lock, void *reqp) LBUG(); } - LDLM_DEBUG(lock, "i_size: %Lu -> stripe number %d -> size %Lu", + LDLM_DEBUG(lock, "i_size: %llu -> stripe number %u -> size "LPU64, inode->i_size, data.stripe_number, data.size); rc = lustre_pack_reply(req, 1, &size, NULL); @@ -607,8 +629,10 @@ int ll_glimpse_size(struct inode *inode, struct ost_lvb *lvb) LCK_PR, &flags, ll_extent_lock_callback, ldlm_completion_ast, ll_glimpse_callback, inode, sizeof(*lvb), lustre_swab_ost_lvb, &lockh); - if (rc > 0) + if (rc > 0) { + CERROR("obd_enqueue returned rc %d, returning -EIO\n", rc); RETURN(-EIO); + } lvb->lvb_size = lov_merge_size(lli->lli_smd, 0); //inode->i_mtime = lov_merge_mtime(lli->lli_smd, inode->i_mtime); @@ -720,8 +744,8 @@ static ssize_t ll_file_read(struct file *filp, char *buf, size_t count, inode->i_size = kms; } - CDEBUG(D_INFO, "Reading inode %lu, "LPSZ" bytes, offset %Ld, i_size " - LPU64"\n", inode->i_ino, count, *ppos, inode->i_size); + CDEBUG(D_INFO, "Read ino %lu, "LPSZ" bytes, offset %lld, i_size %llu\n", + inode->i_ino, count, *ppos, inode->i_size); /* turn off the kernel's read-ahead */ #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) @@ -1224,6 +1248,7 @@ static int ll_have_md_lock(struct dentry *de) CDEBUG(D_INFO, "trying to match res "LPU64"\n", res_id.name[0]); + /* FIXME use LDLM_FL_TEST_LOCK instead */ flags = LDLM_FL_BLOCK_GRANTED | LDLM_FL_CBPENDING; if (ldlm_lock_match(obddev->obd_namespace, flags, &res_id, LDLM_PLAIN, NULL, LCK_PR, &lockh)) { diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index c0ca902..80cac34 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -110,14 +110,14 @@ struct ll_async_page { struct page *llap_page; struct list_head llap_pending_write; /* only trust these if the page lock is providing exclusion */ - int llap_write_queued:1, + int llap_write_queued:1, llap_defer_uptodate:1; struct list_head llap_proc_item; }; -#define LL_CDEBUG_PAGE(page, STR) \ - CDEBUG(D_PAGE, "page %p map %p ind %lu priv %0lx: " STR, \ - page, page->mapping, page->index, page->private) +#define LL_CDEBUG_PAGE(mask, page, fmt, arg...) \ + CDEBUG(mask, "page %p map %p ind %lu priv %0lx: " fmt, \ + page, page->mapping, page->index, page->private, ## arg) /* llite/lproc_llite.c */ int lprocfs_register_mountpoint(struct proc_dir_entry *parent, @@ -249,6 +249,8 @@ int ll_close_thread_start(struct ll_close_queue **lcq_ret); #define LL_SBI_NOLCK 0x1 #define LL_SBI_READAHEAD 0x2 +#define LL_MAX_BLKSIZE (4UL * 1024 * 1024) + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)) #define ll_s2sbi(sb) ((struct ll_sb_info *)((sb)->s_fs_info)) void __d_rehash(struct dentry * entry, int lock); diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index 36b0250..c17ad63 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -192,6 +192,8 @@ int lustre_common_fill_super(struct super_block *sb, char *mdc, char *osc) GOTO(out_root, err); } + /* bug 2805 - set VM readahead to zero */ + vm_max_readahead = vm_min_readahead = 0; sb->s_root = d_alloc_root(root); RETURN(err); @@ -385,6 +387,9 @@ int lustre_process_log(struct lustre_mount_data *lmd, char * profile, int err; ENTRY; + if (lmd_bad_magic(lmd)) + RETURN(-EINVAL); + generate_random_uuid(uuid); class_uuid_unparse(uuid, &mdc_uuid); @@ -510,10 +515,9 @@ int lustre_fill_super(struct super_block *sb, void *data, int silent) ENTRY; CDEBUG(D_VFSTRACE, "VFS Op: sb %p\n", sb); - if (lmd == NULL) { - CERROR("lustre_mount_data is NULL: check that /sbin/mount.lustre exists?\n"); + if (lmd_bad_magic(lmd)) RETURN(-EINVAL); - } + sbi = lustre_init_sbi(sb); if (!sbi) RETURN(-ENOMEM); @@ -1051,6 +1055,9 @@ void ll_update_inode(struct inode *inode, struct mds_body *body, LBUG(); } } + /* bug 2844 - limit i_blksize for broken user-space apps */ + LASSERTF(lsm->lsm_xfersize != 0, "%lu\n", lsm->lsm_xfersize); + inode->i_blksize = min(lsm->lsm_xfersize, LL_MAX_BLKSIZE); if (lli->lli_smd != lsm) obd_free_memmd(ll_i2obdexp(inode), &lsm); } diff --git a/lustre/llite/lproc_llite.c b/lustre/llite/lproc_llite.c index 58c9ed9..162f568 100644 --- a/lustre/llite/lproc_llite.c +++ b/lustre/llite/lproc_llite.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "llite_internal.h" @@ -562,16 +563,16 @@ static int llite_dump_pgcache_seq_open(struct inode *inode, struct file *file) struct ll_sb_info *sbi = dp->data; int rc; - llap = kmalloc(sizeof(*llap), GFP_KERNEL); + OBD_ALLOC_GFP(llap, sizeof(*llap), GFP_KERNEL); if (llap == NULL) return -ENOMEM; llap->llap_page = NULL; llap->llap_cookie = sbi; llap->llap_magic = 0; - + rc = seq_open(file, &llite_dump_pgcache_seq_sops); if (rc) { - kfree(llap); + OBD_FREE(llap, sizeof(*llap)); return rc; } seq = file->private_data; @@ -584,7 +585,7 @@ static int llite_dump_pgcache_seq_open(struct inode *inode, struct file *file) return 0; } -static int llite_dump_pgcache_seq_release(struct inode *inode, +static int llite_dump_pgcache_seq_release(struct inode *inode, struct file *file) { struct seq_file *seq = file->private_data; @@ -595,7 +596,7 @@ static int llite_dump_pgcache_seq_release(struct inode *inode, if (!list_empty(&llap->llap_proc_item)) list_del_init(&llap->llap_proc_item); spin_unlock(&sbi->ll_pglist_lock); - kfree(llap); + OBD_FREE(llap, sizeof(*llap)); return seq_release(inode, file); } @@ -603,7 +604,7 @@ static int llite_dump_pgcache_seq_release(struct inode *inode, struct file_operations llite_dump_pgcache_fops = { .open = llite_dump_pgcache_seq_open, .read = seq_read, - .release = llite_dump_pgcache_seq_release, + .release = llite_dump_pgcache_seq_release, }; #endif /* LPROCFS */ diff --git a/lustre/llite/rw.c b/lustre/llite/rw.c index c9ee1db..4d6df97 100644 --- a/lustre/llite/rw.c +++ b/lustre/llite/rw.c @@ -250,7 +250,7 @@ static int ll_ap_make_ready(void *data, int cmd) if (TryLockPage(page)) RETURN(-EAGAIN); - LL_CDEBUG_PAGE(page, "made ready\n"); + LL_CDEBUG_PAGE(D_PAGE, page, "made ready\n"); page_cache_get(page); /* if we left PageDirty we might get another writepage call @@ -439,7 +439,7 @@ free_oig: oig_release(oig); GOTO(out, rc); } - LL_CDEBUG_PAGE(page, "write queued\n"); + LL_CDEBUG_PAGE(D_PAGE, page, "write queued\n"); //llap_write_pending(inode, llap); } else { lprocfs_counter_incr(ll_i2sbi(inode)->ll_stats, @@ -483,7 +483,7 @@ void ll_removepage(struct page *page) return; } - LL_CDEBUG_PAGE(page, "being evicted\n"); + LL_CDEBUG_PAGE(D_PAGE, page, "being evicted\n"); exp = ll_i2obdexp(inode); if (exp == NULL) { @@ -530,18 +530,14 @@ static int ll_page_matches(struct page *page) page_extent.l_extent.start = (__u64)page->index << PAGE_CACHE_SHIFT; page_extent.l_extent.end = page_extent.l_extent.start + PAGE_CACHE_SIZE - 1; - flags = LDLM_FL_CBPENDING | LDLM_FL_BLOCK_GRANTED; + flags = LDLM_FL_CBPENDING | LDLM_FL_BLOCK_GRANTED | LDLM_FL_TEST_LOCK; matches = obd_match(ll_i2sbi(inode)->ll_osc_exp, ll_i2info(inode)->lli_smd, LDLM_EXTENT, - &page_extent, LCK_PR, &flags, inode, &match_lockh); - if (matches < 0) { - LL_CDEBUG_PAGE(page, "lock match failed\n"); - RETURN(matches); - } - if (matches) { - obd_cancel(ll_i2sbi(inode)->ll_osc_exp, - ll_i2info(inode)->lli_smd, LCK_PR, &match_lockh); - } + &page_extent, LCK_PR | LCK_PW, &flags, inode, + &match_lockh); + if (matches < 0) + LL_CDEBUG_PAGE(D_ERROR, page, "lock match failed: rc %d\n", + matches); RETURN(matches); } @@ -558,14 +554,15 @@ static int ll_issue_page_read(struct obd_export *exp, NULL, oig, llap->llap_cookie, OBD_BRW_READ, 0, PAGE_SIZE, 0, ASYNC_COUNT_STABLE); if (rc) { - LL_CDEBUG_PAGE(page, "read queueing failed\n"); + LL_CDEBUG_PAGE(D_ERROR, page, "read queue failed: rc %d\n", rc); page_cache_release(page); } RETURN(rc); } #define LL_RA_MIN(inode) ((unsigned long)PTL_MD_MAX_PAGES / 2) -#define LL_RA_MAX(inode) (inode->i_blksize * 3) +#define LL_RA_MAX(inode) ((ll_i2info(inode)->lli_smd->lsm_xfersize * 3) >> \ + PAGE_CACHE_SHIFT) static void ll_readahead(struct ll_readahead_state *ras, struct obd_export *exp, struct address_space *mapping, @@ -624,10 +621,10 @@ static void ll_readahead(struct ll_readahead_state *ras, rc = ll_issue_page_read(exp, llap, oig, 1); if (rc == 0) - LL_CDEBUG_PAGE(page, "started read-ahead\n"); + LL_CDEBUG_PAGE(D_PAGE, page, "started read-ahead\n"); if (rc) { next_page: - LL_CDEBUG_PAGE(page, "skipping read-ahead\n"); + LL_CDEBUG_PAGE(D_PAGE, page, "skipping read-ahead\n"); unlock_page(page); } @@ -767,7 +764,7 @@ int ll_readpage(struct file *filp, struct page *page) ll_readahead(&fd->fd_ras, exp, page->mapping, oig); obd_trigger_group_io(exp, ll_i2info(inode)->lli_smd, NULL, oig); - LL_CDEBUG_PAGE(page, "marking uptodate from defer\n"); + LL_CDEBUG_PAGE(D_PAGE, page, "marking uptodate from defer\n"); SetPageUptodate(page); unlock_page(page); GOTO(out_oig, rc = 0); @@ -781,11 +778,20 @@ int ll_readpage(struct file *filp, struct page *page) if (rc == 0) { static unsigned long next_print; - CDEBUG(D_INODE, "didn't match a lock\n"); + CDEBUG(D_INODE, "ino %lu page %lu (%llu) didn't match a lock\n", + inode->i_ino, page->index, + (long long)page->index << PAGE_CACHE_SHIFT); if (time_after(jiffies, next_print)) { + CERROR("ino %lu page %lu (%llu) not covered by " + "a lock (mmap?). check debug logs.\n", + inode->i_ino, page->index, + (long long)page->index << PAGE_CACHE_SHIFT); + ldlm_dump_all_namespaces(); + if (next_print == 0) { + CERROR("%s\n", portals_debug_dumpstack()); + portals_debug_dumplog(); + } next_print = jiffies + 30 * HZ; - CERROR("not covered by a lock (mmap?). check debug " - "logs.\n"); } } @@ -793,7 +799,7 @@ int ll_readpage(struct file *filp, struct page *page) if (rc) GOTO(out, rc); - LL_CDEBUG_PAGE(page, "queued readpage\n"); + LL_CDEBUG_PAGE(D_PAGE, page, "queued readpage\n"); if ((ll_i2sbi(inode)->ll_flags & LL_SBI_READAHEAD)) ll_readahead(&fd->fd_ras, exp, page->mapping, oig); @@ -834,7 +840,7 @@ int ll_sync_page(struct page *page) if (IS_ERR(llap)) RETURN(PTR_ERR(llap)); - LL_CDEBUG_PAGE(page, "setting ready|urgent\n"); + LL_CDEBUG_PAGE(D_PAGE, page, "setting ready|urgent\n"); rc = obd_set_async_flags(exp, ll_i2info(page->mapping->host)->lli_smd, NULL, llap->llap_cookie, diff --git a/lustre/llite/rw24.c b/lustre/llite/rw24.c index 23be231..c645abd 100644 --- a/lustre/llite/rw24.c +++ b/lustre/llite/rw24.c @@ -71,11 +71,11 @@ void ll_ap_completion_24(void *data, int cmd, int rc) } else { llap->llap_write_queued = 0; } - } else { + } else { SetPageError(page); } - LL_CDEBUG_PAGE(page, "io complete, unlocking\n"); + LL_CDEBUG_PAGE(D_PAGE, page, "io complete, unlocking\n"); unlock_page(page); @@ -108,7 +108,7 @@ static int ll_writepage_24(struct page *page) page_cache_get(page); if (llap->llap_write_queued) { - LL_CDEBUG_PAGE(page, "marking urgent\n"); + LL_CDEBUG_PAGE(D_PAGE, page, "marking urgent\n"); rc = obd_set_async_flags(exp, ll_i2info(inode)->lli_smd, NULL, llap->llap_cookie, ASYNC_READY | ASYNC_URGENT); @@ -118,7 +118,7 @@ static int ll_writepage_24(struct page *page) llap->llap_cookie, OBD_BRW_WRITE, 0, 0, 0, ASYNC_READY | ASYNC_URGENT); if (rc == 0) - LL_CDEBUG_PAGE(page, "mmap write queued\n"); + LL_CDEBUG_PAGE(D_PAGE, page, "mmap write queued\n"); else llap->llap_write_queued = 0; } diff --git a/lustre/llite/rw26.c b/lustre/llite/rw26.c index 21e884f..640cf05 100644 --- a/lustre/llite/rw26.c +++ b/lustre/llite/rw26.c @@ -73,11 +73,11 @@ void ll_ap_completion_26(void *data, int cmd, int rc) } else { llap->llap_write_queued = 0; } - } else { + } else { SetPageError(page); } - LL_CDEBUG_PAGE(page, "io complete, unlocking\n"); + LL_CDEBUG_PAGE(D_PAGE, page, "io complete, unlocking\n"); unlock_page(page); @@ -110,7 +110,7 @@ static int ll_writepage_26(struct page *page, struct writeback_control *wbc) page_cache_get(page); if (llap->llap_write_queued) { - LL_CDEBUG_PAGE(page, "marking urgent\n"); + LL_CDEBUG_PAGE(D_PAGE, page, "marking urgent\n"); rc = obd_set_async_flags(exp, ll_i2info(inode)->lli_smd, NULL, llap->llap_cookie, ASYNC_READY | ASYNC_URGENT); @@ -120,7 +120,7 @@ static int ll_writepage_26(struct page *page, struct writeback_control *wbc) llap->llap_cookie, OBD_BRW_WRITE, 0, 0, 0, ASYNC_READY | ASYNC_URGENT); if (rc == 0) - LL_CDEBUG_PAGE(page, "mmap write queued\n"); + LL_CDEBUG_PAGE(D_PAGE, page, "mmap write queued\n"); else llap->llap_write_queued = 0; } diff --git a/lustre/lov/lov_internal.h b/lustre/lov/lov_internal.h index a565f51..aa04e4e 100644 --- a/lustre/lov/lov_internal.h +++ b/lustre/lov/lov_internal.h @@ -31,7 +31,7 @@ void lov_free_memmd(struct lov_stripe_md **lsmp); /* lov_log.c */ int lov_llog_init(struct obd_device *obd, struct obd_device *tgt, - int count, struct llog_logid *logid); + int count, struct llog_catid *logid); int lov_llog_finish(struct obd_device *obd, int count); /* lov_pack.c */ @@ -41,7 +41,7 @@ int lov_unpackmd(struct obd_export *exp, struct lov_stripe_md **lsmp, struct lov_mds_md *lmm, int lmm_bytes); int lov_setstripe(struct obd_export *exp, struct lov_stripe_md **lsmp, struct lov_user_md *lump); -int lov_setea(struct obd_export *exp, struct lov_stripe_md **lsmp, +int lov_setea(struct obd_export *exp, struct lov_stripe_md **lsmp, struct lov_user_md *lump); int lov_getstripe(struct obd_export *exp, struct lov_stripe_md *lsm, struct lov_user_md *lump); diff --git a/lustre/lov/lov_log.c b/lustre/lov/lov_log.c index 59dc29e..7809366 100644 --- a/lustre/lov/lov_log.c +++ b/lustre/lov/lov_log.c @@ -92,7 +92,8 @@ static int lov_llog_origin_add(struct llog_ctxt *ctxt, static int lov_llog_origin_connect(struct llog_ctxt *ctxt, int count, struct llog_logid *logid, - struct llog_gen *gen) + struct llog_gen *gen, + struct obd_uuid *uuid) { struct obd_device *obd = ctxt->loc_obd; struct lov_obd *lov = &obd->u.lov; @@ -103,7 +104,11 @@ static int lov_llog_origin_connect(struct llog_ctxt *ctxt, int count, for (i = 0; i < lov->desc.ld_tgt_count; i++) { struct obd_device *child = lov->tgts[i].ltd_exp->exp_obd; struct llog_ctxt *cctxt = llog_get_context(child, ctxt->loc_idx); - rc = llog_connect(cctxt, 1, logid, gen); + + if (uuid && !obd_uuid_equals(uuid, &lov->tgts[i].uuid)) + continue; + + rc = llog_connect(cctxt, 1, logid, gen, uuid); if (rc) { CERROR("error osc_llog_connect %d\n", i); break; @@ -156,18 +161,18 @@ static struct llog_operations lov_size_repl_logops = { int lov_llog_init(struct obd_device *obd, struct obd_device *tgt, - int count, struct llog_logid *logid) + int count, struct llog_catid *logid) { struct lov_obd *lov = &obd->u.lov; int i, rc = 0; ENTRY; - + rc = llog_setup(obd, LLOG_UNLINK_ORIG_CTXT, tgt, 0, NULL, &lov_unlink_orig_logops); if (rc) RETURN(rc); - rc = llog_setup(obd, LLOG_SIZE_REPL_CTXT, tgt, 0, NULL, + rc = llog_setup(obd, LLOG_SIZE_REPL_CTXT, tgt, 0, NULL, &lov_size_repl_logops); if (rc) RETURN(rc); diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index 7d657f2..92d862f 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -2201,8 +2201,11 @@ static int lov_match(struct obd_export *exp, struct lov_stripe_md *lsm, break; } if (rc == 1) { - if (lsm->lsm_stripe_count > 1) + if (lsm->lsm_stripe_count > 1) { + if (*flags & LDLM_FL_TEST_LOCK) + lov_llh_destroy(lov_lockh); lov_llh_put(lov_lockh); + } RETURN(1); } @@ -2640,7 +2643,10 @@ static int lov_set_info(struct obd_export *exp, obd_count keylen, for (i = 0; i < lov->desc.ld_tgt_count; i++) { int er; - if (!lov->tgts[i].active) + if (val && !obd_uuid_equals(val, &lov->tgts[i].uuid)) + continue; + + if (!val && !lov->tgts[i].active) continue; er = obd_set_info(lov->tgts[i].ltd_exp, keylen, key, vallen, diff --git a/lustre/lov/lov_pack.c b/lustre/lov/lov_pack.c index 6a4ac6b..1b40327 100644 --- a/lustre/lov/lov_pack.c +++ b/lustre/lov/lov_pack.c @@ -295,6 +295,7 @@ int lov_alloc_memmd(struct lov_stripe_md **lsmp, int stripe_count, int pattern) (*lsmp)->lsm_magic = LOV_MAGIC; (*lsmp)->lsm_stripe_count = stripe_count; (*lsmp)->lsm_maxbytes = LUSTRE_STRIPE_MAXBYTES * stripe_count; + (*lsmp)->lsm_xfersize = PTL_MTU * stripe_count; (*lsmp)->lsm_pattern = pattern; (*lsmp)->lsm_oinfo[0].loi_ost_idx = ~0; @@ -319,6 +320,7 @@ int lov_unpackmd_v0(struct lov_obd *lov, struct lov_stripe_md *lsm, lsm->lsm_object_id = le64_to_cpu(lmm->lmm_object_id); /* lsm->lsm_object_gr = 0; implicit */ lsm->lsm_stripe_size = le32_to_cpu(lmm->lmm_stripe_size); + lsm->lsm_xfersize = lsm->lsm_stripe_size * lsm->lsm_stripe_count; lsm->lsm_pattern = LOV_PATTERN_RAID0; ost_offset = le32_to_cpu(lmm->lmm_stripe_offset); ost_count = le16_to_cpu(lmm->lmm_ost_count); @@ -356,6 +358,7 @@ int lov_unpackmd_v1(struct lov_obd *lov, struct lov_stripe_md *lsm, lsm->lsm_object_gr = le64_to_cpu(lmm->lmm_object_gr); lsm->lsm_stripe_size = le32_to_cpu(lmm->lmm_stripe_size); lsm->lsm_pattern = le32_to_cpu(lmm->lmm_pattern); + lsm->lsm_xfersize = lsm->lsm_stripe_size * lsm->lsm_stripe_count; for (i = 0, loi = lsm->lsm_oinfo; i < lsm->lsm_stripe_count; i++) { /* XXX LOV STACKING call down to osc_unpackmd() */ @@ -496,6 +499,7 @@ int lov_setstripe(struct obd_export *exp, struct lov_stripe_md **lsmp, (*lsmp)->lsm_oinfo[0].loi_ost_idx = lum.lmm_stripe_offset; (*lsmp)->lsm_stripe_size = lum.lmm_stripe_size; + (*lsmp)->lsm_xfersize = lum.lmm_stripe_size * stripe_count; RETURN(0); } diff --git a/lustre/lvfs/lvfs_common.c b/lustre/lvfs/lvfs_common.c index 6d18d0d..c1a6640 100644 --- a/lustre/lvfs/lvfs_common.c +++ b/lustre/lvfs/lvfs_common.c @@ -27,8 +27,8 @@ #include -struct dentry *lvfs_fid2dentry(struct obd_run_ctxt *ctxt, __u64 id, __u32 gen, __u64 gr, - void *data) +struct dentry *lvfs_fid2dentry(struct obd_run_ctxt *ctxt, __u64 id, + __u32 gen, __u64 gr, void *data) { return ctxt->cb_ops.l_fid2dentry(id, gen, gr, data); } diff --git a/lustre/lvfs/lvfs_linux.c b/lustre/lvfs/lvfs_linux.c index 7e34fce..7f381d3 100644 --- a/lustre/lvfs/lvfs_linux.c +++ b/lustre/lvfs/lvfs_linux.c @@ -179,7 +179,7 @@ void pop_ctxt(struct obd_run_ctxt *saved, struct obd_run_ctxt *new_ctx, EXPORT_SYMBOL(pop_ctxt); /* utility to make a file */ -struct dentry *simple_mknod(struct dentry *dir, char *name, int mode) +struct dentry *simple_mknod(struct dentry *dir, char *name, int mode, int fix) { struct dentry *dchild; int err = 0; @@ -198,7 +198,7 @@ struct dentry *simple_mknod(struct dentry *dir, char *name, int mode) GOTO(out_err, err = -EEXIST); /* Fixup file permissions if necessary */ - if ((old_mode & S_IALLUGO) != (mode & S_IALLUGO)) { + if (fix && (old_mode & S_IALLUGO) != (mode & S_IALLUGO)) { CWARN("fixing permissions on %s from %o to %o\n", name, old_mode, mode); dchild->d_inode->i_mode = (mode & S_IALLUGO) | @@ -224,7 +224,7 @@ out_up: EXPORT_SYMBOL(simple_mknod); /* utility to make a directory */ -struct dentry *simple_mkdir(struct dentry *dir, char *name, int mode) +struct dentry *simple_mkdir(struct dentry *dir, char *name, int mode, int fix) { struct dentry *dchild; int err = 0; @@ -242,7 +242,7 @@ struct dentry *simple_mkdir(struct dentry *dir, char *name, int mode) GOTO(out_err, err = -ENOTDIR); /* Fixup directory permissions if necessary */ - if ((old_mode & S_IALLUGO) != (mode & S_IALLUGO)) { + if (fix && (old_mode & S_IALLUGO) != (mode & S_IALLUGO)) { CWARN("fixing permissions on %s from %o to %o\n", name, old_mode, mode); dchild->d_inode->i_mode = (mode & S_IALLUGO) | diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index 51de280..c692def 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -405,13 +405,23 @@ static int mdc_close_interpret(struct ptlrpc_request *req, void *data, int rc) { union ptlrpc_async_args *aa = data; struct mdc_rpc_lock *rpc_lock = aa->pointer_arg[0]; - - mdc_put_rpc_lock(rpc_lock, NULL); + struct obd_device *obd = aa->pointer_arg[1]; + + if (rpc_lock == NULL) { + CERROR("called with NULL rpc_lock\n"); + } else { + mdc_put_rpc_lock(rpc_lock, NULL); + LASSERTF(req->rq_async_args.pointer_arg[0] == + obd->u.cli.cl_rpc_lock, "%p != %p\n", + req->rq_async_args.pointer_arg[0], + obd->u.cli.cl_rpc_lock); + aa->pointer_arg[0] = NULL; + } wake_up(&req->rq_reply_waitq); RETURN(rc); } -/* We can't use ptlrpc_check_reply, because we don't want to wake up for +/* We can't use ptlrpc_check_reply, because we don't want to wake up for * anything but a reply or an error. */ static int mdc_close_check_reply(struct ptlrpc_request *req) { @@ -443,7 +453,6 @@ int mdc_close(struct obd_export *exp, struct obdo *obdo, struct ptlrpc_request *req; struct mdc_open_data *mod; struct l_wait_info lwi; - struct mdc_rpc_lock *rpc_lock = obd->u.cli.cl_rpc_lock; ENTRY; req = ptlrpc_prep_req(class_exp2cliimp(exp), MDS_CLOSE, 1, &reqsize, @@ -478,9 +487,10 @@ int mdc_close(struct obd_export *exp, struct obdo *obdo, /* We hand a ref to the rpcd here, so we need another one of our own. */ ptlrpc_request_addref(req); - mdc_get_rpc_lock(rpc_lock, NULL); + mdc_get_rpc_lock(obd->u.cli.cl_rpc_lock, NULL); req->rq_interpret_reply = mdc_close_interpret; - req->rq_async_args.pointer_arg[0] = rpc_lock; + req->rq_async_args.pointer_arg[0] = obd->u.cli.cl_rpc_lock; + req->rq_async_args.pointer_arg[1] = obd; ptlrpcd_add_req(req); lwi = LWI_TIMEOUT_INTR(MAX(req->rq_timeout * HZ, 1), go_back_to_sleep, NULL, NULL); @@ -498,6 +508,11 @@ int mdc_close(struct obd_export *exp, struct obdo *obdo, "close succeeded. Please tell CFS.\n"); } } + if (req->rq_async_args.pointer_arg[0] != NULL) { + CERROR("returned without dropping rpc_lock: rc %d\n", rc); + mdc_close_interpret(req, &req->rq_async_args, rc); + portals_debug_dumplog(); + } EXIT; out: @@ -812,6 +827,39 @@ static int mdc_detach(struct obd_device *dev) return lprocfs_obd_detach(dev); } +static int mdc_import_event(struct obd_device *obd, + struct obd_import *imp, + enum obd_import_event event) +{ + int rc = 0; + + LASSERT(imp->imp_obd == obd); + + switch (event) { + case IMP_EVENT_DISCON: { + break; + } + case IMP_EVENT_INVALIDATE: { + struct ldlm_namespace *ns = obd->obd_namespace; + + ldlm_namespace_cleanup(ns, LDLM_FL_LOCAL_ONLY); + + if (obd->obd_observer) + rc = obd_notify(obd->obd_observer, obd, 0); + break; + } + case IMP_EVENT_ACTIVE: { + if (obd->obd_observer) + rc = obd_notify(obd->obd_observer, obd, 1); + break; + } + default: + CERROR("Unknown import event %d\n", event); + LBUG(); + } + RETURN(rc); +} + static int mdc_setup(struct obd_device *obd, obd_count len, void *buf) { struct client_obd *cli = &obd->u.cli; @@ -906,7 +954,7 @@ static int mdc_cleanup(struct obd_device *obd, int flags) static int mdc_llog_init(struct obd_device *obd, struct obd_device *tgt, - int count, struct llog_logid *logid) + int count, struct llog_catid *logid) { struct llog_ctxt *ctxt; int rc; @@ -916,7 +964,7 @@ static int mdc_llog_init(struct obd_device *obd, struct obd_device *tgt, &llog_client_ops); if (rc == 0) { ctxt = llog_get_context(obd, LLOG_CONFIG_REPL_CTXT); - ctxt->loc_imp = obd->u.cli.cl_import; + ctxt->loc_imp = obd->u.cli.cl_import; } RETURN(rc); @@ -945,6 +993,7 @@ struct obd_ops mdc_obd_ops = { o_statfs: mdc_statfs, o_pin: mdc_pin, o_unpin: mdc_unpin, + o_import_event: mdc_import_event, o_llog_init: mdc_llog_init, o_llog_finish: mdc_llog_finish, }; diff --git a/lustre/mds/handler.c b/lustre/mds/handler.c index fe28761..5a50482 100644 --- a/lustre/mds/handler.c +++ b/lustre/mds/handler.c @@ -355,34 +355,39 @@ static int mds_destroy_export(struct obd_export *export) RETURN(rc); } -static int mds_disconnect(struct obd_export *export, int flags) +static int mds_disconnect(struct obd_export *exp, int flags) { unsigned long irqflags; int rc; ENTRY; - ldlm_cancel_locks_for_export(export); + LASSERT(exp); + class_export_get(exp); + + spin_lock_irqsave(&exp->exp_lock, irqflags); + exp->exp_flags = flags; + spin_unlock_irqrestore(&exp->exp_lock, irqflags); + + /* Disconnect early so that clients can't keep using export */ + rc = class_disconnect(exp, flags); + ldlm_cancel_locks_for_export(exp); /* complete all outstanding replies */ - spin_lock_irqsave (&export->exp_lock, irqflags); - while (!list_empty (&export->exp_outstanding_replies)) { + spin_lock_irqsave(&exp->exp_lock, irqflags); + while (!list_empty(&exp->exp_outstanding_replies)) { struct ptlrpc_reply_state *rs = - list_entry (export->exp_outstanding_replies.next, - struct ptlrpc_reply_state, rs_exp_list); + list_entry(exp->exp_outstanding_replies.next, + struct ptlrpc_reply_state, rs_exp_list); struct ptlrpc_service *svc = rs->rs_srv_ni->sni_service; - spin_lock (&svc->srv_lock); - list_del_init (&rs->rs_exp_list); - ptlrpc_schedule_difficult_reply (rs); - spin_unlock (&svc->srv_lock); + spin_lock(&svc->srv_lock); + list_del_init(&rs->rs_exp_list); + ptlrpc_schedule_difficult_reply(rs); + spin_unlock(&svc->srv_lock); } - spin_unlock_irqrestore (&export->exp_lock, irqflags); + spin_unlock_irqrestore(&exp->exp_lock, irqflags); - spin_lock_irqsave(&export->exp_lock, irqflags); - export->exp_flags = flags; - spin_unlock_irqrestore(&export->exp_lock, irqflags); - - rc = class_disconnect(export, flags); + class_export_put(exp); RETURN(rc); } @@ -1480,7 +1485,8 @@ static int mds_postrecov(struct obd_device *obd) LASSERT(llog_get_context(obd, LLOG_UNLINK_ORIG_CTXT) != NULL); rc = llog_connect(llog_get_context(obd, LLOG_UNLINK_ORIG_CTXT), - obd->u.mds.mds_lov_desc.ld_tgt_count, NULL, NULL); + obd->u.mds.mds_lov_desc.ld_tgt_count, + NULL, NULL, NULL); if (rc != 0) { CERROR("faild at llog_origin_connect: %d\n", rc); } diff --git a/lustre/mds/mds_fs.c b/lustre/mds/mds_fs.c index 1dfc246..d3e235a 100644 --- a/lustre/mds/mds_fs.c +++ b/lustre/mds/mds_fs.c @@ -388,7 +388,7 @@ int mds_fs_setup(struct obd_device *obd, struct vfsmount *mnt) /* setup the directory tree */ push_ctxt(&saved, &obd->obd_ctxt, NULL); - dentry = simple_mkdir(current->fs->pwd, "ROOT", 0755); + dentry = simple_mkdir(current->fs->pwd, "ROOT", 0755, 0); if (IS_ERR(dentry)) { rc = PTR_ERR(dentry); CERROR("cannot create ROOT directory: rc = %d\n", rc); @@ -410,7 +410,7 @@ int mds_fs_setup(struct obd_device *obd, struct vfsmount *mnt) } mds->mds_fid_de = dentry; - dentry = simple_mkdir(current->fs->pwd, "PENDING", 0777); + dentry = simple_mkdir(current->fs->pwd, "PENDING", 0777, 1); if (IS_ERR(dentry)) { rc = PTR_ERR(dentry); CERROR("cannot create PENDING directory: rc = %d\n", rc); @@ -418,7 +418,7 @@ int mds_fs_setup(struct obd_device *obd, struct vfsmount *mnt) } mds->mds_pending_dir = dentry; - dentry = simple_mkdir(current->fs->pwd, "LOGS", 0777); + dentry = simple_mkdir(current->fs->pwd, "LOGS", 0777, 1); if (IS_ERR(dentry)) { rc = PTR_ERR(dentry); CERROR("cannot create LOGS directory: rc = %d\n", rc); @@ -426,7 +426,7 @@ int mds_fs_setup(struct obd_device *obd, struct vfsmount *mnt) } mds->mds_logs_dir = dentry; - dentry = simple_mkdir(current->fs->pwd, "OBJECTS", 0777); + dentry = simple_mkdir(current->fs->pwd, "OBJECTS", 0777, 1); if (IS_ERR(dentry)) { rc = PTR_ERR(dentry); CERROR("cannot create OBJECTS directory: rc = %d\n", rc); diff --git a/lustre/mds/mds_internal.h b/lustre/mds/mds_internal.h index a6bba27..d8eb150 100644 --- a/lustre/mds/mds_internal.h +++ b/lustre/mds/mds_internal.h @@ -51,11 +51,11 @@ int mds_cleanup_orphans(struct obd_device *obd); /* mds/mds_log.c */ -int mds_log_op_unlink(struct obd_device *obd, struct inode *inode, +int mds_log_op_unlink(struct obd_device *obd, struct inode *inode, struct lov_mds_md *lmm, int lmm_size, struct llog_cookie *logcookies, int cookies_size); -int mds_llog_init(struct obd_device *obd, struct obd_device *tgt, int count, - struct llog_logid *logid); +int mds_llog_init(struct obd_device *obd, struct obd_device *tgt, int count, + struct llog_catid *logid); int mds_llog_finish(struct obd_device *obd, int count); /* mds/mds_lov.c */ diff --git a/lustre/mds/mds_log.c b/lustre/mds/mds_log.c index c4d5690..b8ce8b5 100644 --- a/lustre/mds/mds_log.c +++ b/lustre/mds/mds_log.c @@ -54,7 +54,8 @@ static int mds_llog_origin_add(struct llog_ctxt *ctxt, static int mds_llog_origin_connect(struct llog_ctxt *ctxt, int count, struct llog_logid *logid, - struct llog_gen *gen) + struct llog_gen *gen, + struct obd_uuid *uuid) { struct obd_device *obd = ctxt->loc_obd; struct obd_device *lov_obd = obd->u.mds.mds_osc_obd; @@ -63,7 +64,7 @@ static int mds_llog_origin_connect(struct llog_ctxt *ctxt, int count, ENTRY; lctxt = llog_get_context(lov_obd, ctxt->loc_idx); - rc = llog_connect(lctxt, count, logid, gen); + rc = llog_connect(lctxt, count, logid, gen, uuid); RETURN(rc); } @@ -118,7 +119,7 @@ static struct llog_operations mds_size_repl_logops = { }; int mds_llog_init(struct obd_device *obd, struct obd_device *tgt, - int count, struct llog_logid *logid) + int count, struct llog_catid *logid) { struct obd_device *lov_obd = obd->u.mds.mds_osc_obd; int rc; diff --git a/lustre/mds/mds_lov.c b/lustre/mds/mds_lov.c index 97deb7d..0e9d2f0 100644 --- a/lustre/mds/mds_lov.c +++ b/lustre/mds/mds_lov.c @@ -280,7 +280,7 @@ int mds_lov_connect(struct obd_device *obd, char * lov_name) if (!obd->obd_recovering) { rc = llog_connect(llog_get_context(obd, LLOG_UNLINK_ORIG_CTXT), obd->u.mds.mds_lov_desc.ld_tgt_count, NULL, - NULL); + NULL, NULL); if (rc != 0) CERROR("faild at llog_origin_connect: %d\n", rc); @@ -497,6 +497,7 @@ int mds_notify(struct obd_device *obd, struct obd_device *watched, int active) { struct obd_uuid *uuid; int rc = 0; + ENTRY; if (!active) RETURN(0); @@ -512,6 +513,21 @@ int mds_notify(struct obd_device *obd, struct obd_device *watched, int active) CWARN("MDS %s: in recovery, not resetting orphans on %s\n", obd->obd_name, uuid->uuid); } else { + LASSERT(llog_get_context(obd, LLOG_UNLINK_ORIG_CTXT) != NULL); + + rc = obd_set_info(obd->u.mds.mds_osc_exp, strlen("mds_conn"), "mds_conn", + 0, uuid); + if (rc != 0) + RETURN(rc); + + rc = llog_connect(llog_get_context(obd, LLOG_UNLINK_ORIG_CTXT), + obd->u.mds.mds_lov_desc.ld_tgt_count, + NULL, NULL, uuid); + if (rc != 0) { + CERROR("faild at llog_origin_connect: %d\n", rc); + RETURN(rc); + } + CWARN("MDS %s: %s now active, resetting orphans\n", obd->obd_name, uuid->uuid); rc = mds_lov_clearorphans(&obd->u.mds, uuid); diff --git a/lustre/obdclass/class_obd.c b/lustre/obdclass/class_obd.c index fdbfb91..5e2c305 100644 --- a/lustre/obdclass/class_obd.c +++ b/lustre/obdclass/class_obd.c @@ -85,7 +85,7 @@ int proc_version; /* The following are visible and mutable through /proc/sys/lustre/. */ unsigned int obd_fail_loc; unsigned int obd_timeout = 100; -char obd_lustre_upcall[128] = "/usr/lib/lustre/lustre_upcall"; +char obd_lustre_upcall[128] = "DEFAULT"; /* or NONE or /full/path/to/upcall */ unsigned int obd_sync_filter; /* = 0, don't sync by default */ #ifdef __KERNEL__ diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c index 9ee9c4d..5088abb 100644 --- a/lustre/obdclass/genops.c +++ b/lustre/obdclass/genops.c @@ -393,7 +393,6 @@ struct obd_import *class_conn2cliimp(struct lustre_handle *conn) return obd->u.cli.cl_import; } - /* Export management functions */ static void export_handle_addref(void *export) { @@ -588,8 +587,7 @@ int class_disconnect(struct obd_export *export, int flags) if (export == NULL) { fixme(); - CDEBUG(D_IOCTL, "disconnect: attempting to free " - "null export %p\n", export); + CDEBUG(D_IOCTL, "attempting to free NULL export %p\n", export); RETURN(-EINVAL); } diff --git a/lustre/obdclass/llog.c b/lustre/obdclass/llog.c index e4146dc..0ad595f 100644 --- a/lustre/obdclass/llog.c +++ b/lustre/obdclass/llog.c @@ -66,9 +66,9 @@ void llog_free_handle(struct llog_handle *loghandle) if (!loghandle->lgh_hdr) goto out; - if (le32_to_cpu(loghandle->lgh_hdr->llh_flags) & LLOG_F_IS_PLAIN) + if (loghandle->lgh_hdr->llh_flags & LLOG_F_IS_PLAIN) list_del_init(&loghandle->u.phd.phd_entry); - if (le32_to_cpu(loghandle->lgh_hdr->llh_flags) & LLOG_F_IS_CAT) + if (loghandle->lgh_hdr->llh_flags & LLOG_F_IS_CAT) LASSERT(list_empty(&loghandle->u.chd.chd_head)); OBD_FREE(loghandle->lgh_hdr, LLOG_CHUNK_SIZE); @@ -97,10 +97,10 @@ int llog_cancel_rec(struct llog_handle *loghandle, int index) RETURN(-EINVAL); } - llh->llh_count = cpu_to_le32(le32_to_cpu(llh->llh_count) - 1); + llh->llh_count--; - if ((le32_to_cpu(llh->llh_flags) & LLOG_F_ZAP_WHEN_EMPTY) && - (le32_to_cpu(llh->llh_count) == 1) && + if ((llh->llh_flags & LLOG_F_ZAP_WHEN_EMPTY) && + (llh->llh_count == 1) && (loghandle->lgh_last_idx == (LLOG_BITMAP_BYTES * 8) - 1)) { rc = llog_destroy(loghandle); if (rc) @@ -131,10 +131,10 @@ int llog_init_handle(struct llog_handle *handle, int flags, RETURN(-ENOMEM); handle->lgh_hdr = llh; /* first assign flags to use llog_client_ops */ - llh->llh_flags = cpu_to_le32(flags); + llh->llh_flags = flags; rc = llog_read_header(handle); if (rc == 0) { - flags = le32_to_cpu(llh->llh_flags); + flags = llh->llh_flags; if (uuid) LASSERT(obd_uuid_equals(uuid, &llh->llh_tgtuuid)); GOTO(out, rc); @@ -146,21 +146,20 @@ int llog_init_handle(struct llog_handle *handle, int flags, rc = 0; handle->lgh_last_idx = 0; /* header is record with index 0 */ - llh->llh_count = cpu_to_le32(1); /* for the header record */ - llh->llh_hdr.lrh_type = cpu_to_le32(LLOG_HDR_MAGIC); - llh->llh_hdr.lrh_len = llh->llh_tail.lrt_len = - cpu_to_le32(LLOG_CHUNK_SIZE); + llh->llh_count = 1; /* for the header record */ + llh->llh_hdr.lrh_type = LLOG_HDR_MAGIC; + llh->llh_hdr.lrh_len = llh->llh_tail.lrt_len = LLOG_CHUNK_SIZE; llh->llh_hdr.lrh_index = llh->llh_tail.lrt_index = 0; - llh->llh_timestamp = cpu_to_le64(LTIME_S(CURRENT_TIME)); + llh->llh_timestamp = LTIME_S(CURRENT_TIME); if (uuid) memcpy(&llh->llh_tgtuuid, uuid, sizeof(llh->llh_tgtuuid)); - llh->llh_bitmap_offset = cpu_to_le32(offsetof(typeof(*llh),llh_bitmap)); + llh->llh_bitmap_offset = offsetof(typeof(*llh),llh_bitmap); ext2_set_bit(0, llh->llh_bitmap); out: if (flags & LLOG_F_IS_CAT) { INIT_LIST_HEAD(&handle->u.chd.chd_head); - llh->llh_size = cpu_to_le32(sizeof(struct llog_logid_rec)); + llh->llh_size = sizeof(struct llog_logid_rec); } else if (flags & LLOG_F_IS_PLAIN) INIT_LIST_HEAD(&handle->u.phd.phd_entry); @@ -235,11 +234,12 @@ int llog_process(struct llog_handle *loghandle, llog_cb_t cb, GOTO(out, rc); rec = buf; - idx = le32_to_cpu(rec->lrh_index); + idx = rec->lrh_index; if (idx < index) CDEBUG(D_HA, "index %u : idx %u\n", index, idx); while (idx < index) { - rec = ((void *)rec + le32_to_cpu(rec->lrh_len)); + rec = (struct llog_rec_hdr *) + ((char *)rec + rec->lrh_len); idx ++; } @@ -266,7 +266,8 @@ int llog_process(struct llog_handle *loghandle, llog_cb_t cb, ++index; if (index > last_index) GOTO(out, rc = 0); - rec = ((void *)rec + le32_to_cpu(rec->lrh_len)); + rec = (struct llog_rec_hdr *) + ((char *)rec + rec->lrh_len); } } diff --git a/lustre/obdclass/llog_cat.c b/lustre/obdclass/llog_cat.c index b0e82fe..d4fa370 100644 --- a/lustre/obdclass/llog_cat.c +++ b/lustre/obdclass/llog_cat.c @@ -51,7 +51,7 @@ static struct llog_handle *llog_cat_new_log(struct llog_handle *cathandle) { struct llog_handle *loghandle; struct llog_log_hdr *llh; - struct llog_logid_rec rec; + struct llog_logid_rec rec = { { 0 }, }; int rc, index, bitmap_size; ENTRY; @@ -61,7 +61,7 @@ static struct llog_handle *llog_cat_new_log(struct llog_handle *cathandle) index = (cathandle->lgh_last_idx + 1) % bitmap_size; /* maximum number of available slots in catlog is bitmap_size - 2 */ - if (llh->llh_cat_idx == cpu_to_le32(index)) { + if (llh->llh_cat_idx == index) { CERROR("no free catalog slots for log...\n"); RETURN(ERR_PTR(-ENOSPC)); } else { @@ -73,8 +73,8 @@ static struct llog_handle *llog_cat_new_log(struct llog_handle *cathandle) LBUG(); /* should never happen */ } cathandle->lgh_last_idx = index; - llh->llh_count = cpu_to_le32(le32_to_cpu(llh->llh_count) + 1); - llh->llh_tail.lrt_index = cpu_to_le32(index); + llh->llh_count++; + llh->llh_tail.lrt_index = index; } rc = llog_create(cathandle->lgh_ctxt, &loghandle, NULL, NULL); @@ -91,12 +91,12 @@ static struct llog_handle *llog_cat_new_log(struct llog_handle *cathandle) LPX64"\n", loghandle->lgh_id.lgl_oid, loghandle->lgh_id.lgl_ogen, index, cathandle->lgh_id.lgl_oid); /* build the record for this log in the catalog */ - rec.lid_hdr.lrh_len = cpu_to_le32(sizeof(rec)); - rec.lid_hdr.lrh_index = cpu_to_le32(index); - rec.lid_hdr.lrh_type = cpu_to_le32(LLOG_LOGID_MAGIC); + rec.lid_hdr.lrh_len = sizeof(rec); + rec.lid_hdr.lrh_index = index; + rec.lid_hdr.lrh_type = LLOG_LOGID_MAGIC; rec.lid_id = loghandle->lgh_id; - rec.lid_tail.lrt_len = cpu_to_le32(sizeof(rec)); - rec.lid_tail.lrt_index = cpu_to_le32(index); + rec.lid_tail.lrt_len = sizeof(rec); + rec.lid_tail.lrt_index = index; /* update the catalog: header and record */ rc = llog_write_rec(cathandle, &rec.lid_hdr, @@ -105,7 +105,7 @@ static struct llog_handle *llog_cat_new_log(struct llog_handle *cathandle) GOTO(out_destroy, rc); } - loghandle->lgh_hdr->llh_cat_idx = cpu_to_le32(index); + loghandle->lgh_hdr->llh_cat_idx = index; cathandle->u.chd.chd_current_log = loghandle; LASSERT(list_empty(&loghandle->u.phd.phd_entry)); list_add_tail(&loghandle->u.phd.phd_entry, &cathandle->u.chd.chd_head); @@ -163,8 +163,8 @@ int llog_cat_id2handle(struct llog_handle *cathandle, struct llog_handle **res, if (!rc) { loghandle->u.phd.phd_cat_handle = cathandle; loghandle->u.phd.phd_cookie.lgc_lgl = cathandle->lgh_id; - loghandle->u.phd.phd_cookie.lgc_index = - le32_to_cpu(loghandle->lgh_hdr->llh_cat_idx); + loghandle->u.phd.phd_cookie.lgc_index = + loghandle->lgh_hdr->llh_cat_idx; } out: @@ -257,13 +257,21 @@ int llog_cat_add_rec(struct llog_handle *cathandle, struct llog_rec_hdr *rec, int rc; ENTRY; - LASSERT(le32_to_cpu(rec->lrh_len) <= LLOG_CHUNK_SIZE); + LASSERT(rec->lrh_len <= LLOG_CHUNK_SIZE); loghandle = llog_cat_current_log(cathandle, 1); if (IS_ERR(loghandle)) RETURN(PTR_ERR(loghandle)); /* loghandle is already locked by llog_cat_current_log() for us */ rc = llog_write_rec(loghandle, rec, reccookie, 1, buf, -1); up_write(&loghandle->lgh_lock); + if (rc == -ENOSPC) { + /* to create a new plain log */ + loghandle = llog_cat_current_log(cathandle, 1); + if (IS_ERR(loghandle)) + RETURN(PTR_ERR(loghandle)); + rc = llog_write_rec(loghandle, rec, reccookie, 1, buf, -1); + up_write(&loghandle->lgh_lock); + } RETURN(rc); } @@ -328,13 +336,13 @@ int llog_cat_process_cb(struct llog_handle *cat_llh, struct llog_rec_hdr *rec, struct llog_handle *llh; int rc; - if (le32_to_cpu(rec->lrh_type) != LLOG_LOGID_MAGIC) { + if (rec->lrh_type != LLOG_LOGID_MAGIC) { CERROR("invalid record in catalog\n"); RETURN(-EINVAL); } CWARN("processing log "LPX64":%x at index %u of catalog "LPX64"\n", lir->lid_id.lgl_oid, lir->lid_id.lgl_ogen, - le32_to_cpu(rec->lrh_index), cat_llh->lgh_id.lgl_oid); + rec->lrh_index, cat_llh->lgh_id.lgl_oid); rc = llog_cat_id2handle(cat_llh, &llh, &lir->lid_id); if (rc) { @@ -355,7 +363,7 @@ int llog_cat_process(struct llog_handle *cat_llh, llog_cb_t cb, void *data) int rc; ENTRY; - LASSERT(llh->llh_flags &cpu_to_le32(LLOG_F_IS_CAT)); + LASSERT(llh->llh_flags & LLOG_F_IS_CAT); d.lpd_data = data; d.lpd_cb = cb; @@ -363,7 +371,7 @@ int llog_cat_process(struct llog_handle *cat_llh, llog_cb_t cb, void *data) CWARN("catlog "LPX64" crosses index zero\n", cat_llh->lgh_id.lgl_oid); - cd.first_idx = le32_to_cpu(llh->llh_cat_idx); + cd.first_idx = llh->llh_cat_idx; cd.last_idx = 0; rc = llog_process(cat_llh, llog_cat_process_cb, &d, &cd); if (rc != 0) @@ -387,17 +395,17 @@ int llog_cat_set_first_idx(struct llog_handle *cathandle, int index) ENTRY; bitmap_size = sizeof(llh->llh_bitmap) * 8; - if (llh->llh_cat_idx == cpu_to_le32(index - 1)) { - idx = le32_to_cpu(llh->llh_cat_idx) + 1; - llh->llh_cat_idx = cpu_to_le32(idx); + if (llh->llh_cat_idx == (index - 1)) { + idx = llh->llh_cat_idx + 1; + llh->llh_cat_idx = idx; if (idx == cathandle->lgh_last_idx) goto out; for (i = (index + 1) % bitmap_size; i != cathandle->lgh_last_idx; i = (i + 1) % bitmap_size) { if (!ext2_test_bit(i, llh->llh_bitmap)) { - idx = le32_to_cpu(llh->llh_cat_idx) + 1; - llh->llh_cat_idx = cpu_to_le32(idx); + idx = llh->llh_cat_idx + 1; + llh->llh_cat_idx = idx; } else if (i == 0) { llh->llh_cat_idx = 0; } else { @@ -406,7 +414,7 @@ int llog_cat_set_first_idx(struct llog_handle *cathandle, int index) } out: CDEBUG(D_HA, "set catlog "LPX64" first idx %u\n", - cathandle->lgh_id.lgl_oid,le32_to_cpu(llh->llh_cat_idx)); + cathandle->lgh_id.lgl_oid, llh->llh_cat_idx); } RETURN(0); diff --git a/lustre/obdclass/llog_internal.h b/lustre/obdclass/llog_internal.h index 8674351..0066087 100644 --- a/lustre/obdclass/llog_internal.h +++ b/lustre/obdclass/llog_internal.h @@ -1,10 +1,8 @@ #ifndef __LLOG_INTERNAL_H__ #define __LLOG_INTERNAL_H__ -int llog_get_cat_list(struct obd_device *obd, struct obd_device *disk_obd, - char *name, int count, struct llog_logid *idarray); -int llog_put_cat_list(struct obd_device *obd, struct obd_device *disk_obd, - char *name, int count, struct llog_logid *); +int llog_put_cat_list(struct obd_device *obd, struct obd_device *disk_obd, + char *name, int count, struct llog_catid *idarray); int llog_cat_id2handle(struct llog_handle *cathandle, struct llog_handle **res, struct llog_logid *logid); #endif diff --git a/lustre/obdclass/llog_ioctl.c b/lustre/obdclass/llog_ioctl.c index 310f122..14d20f2 100644 --- a/lustre/obdclass/llog_ioctl.c +++ b/lustre/obdclass/llog_ioctl.c @@ -69,7 +69,7 @@ static int llog_check_cb(struct llog_handle *handle, struct llog_rec_hdr *rec, char *endp; int cur_index, rc = 0; - cur_index = le32_to_cpu(rec->lrh_index); + cur_index = rec->lrh_index; if (ioc_data && (ioc_data->ioc_inllen1)) { l = 0; @@ -90,15 +90,15 @@ static int llog_check_cb(struct llog_handle *handle, struct llog_rec_hdr *rec, if (to > 0 && cur_index > to) RETURN(-LLOG_EEMPTY); } - if (handle->lgh_hdr->llh_flags & cpu_to_le32(LLOG_F_IS_CAT)) { + if (handle->lgh_hdr->llh_flags & LLOG_F_IS_CAT) { struct llog_logid_rec *lir = (struct llog_logid_rec *)rec; struct llog_handle *log_handle; - if (rec->lrh_type != cpu_to_le32(LLOG_LOGID_MAGIC)) { + if (rec->lrh_type != LLOG_LOGID_MAGIC) { l = snprintf(out, remains, "[index]: %05d [type]: " "%02x [len]: %04d failed\n", - cur_index, le32_to_cpu(rec->lrh_type), - le32_to_cpu(rec->lrh_len)); + cur_index, rec->lrh_type, + rec->lrh_len); } if (handle->lgh_ctxt == NULL) RETURN(-EOPNOTSUPP); @@ -106,7 +106,7 @@ static int llog_check_cb(struct llog_handle *handle, struct llog_rec_hdr *rec, rc = llog_process(log_handle, llog_check_cb, NULL, NULL); llog_close(log_handle); } else { - switch (le32_to_cpu(rec->lrh_type)) { + switch (rec->lrh_type) { case OST_SZ_REC: case OST_RAID1_REC: case MDS_UNLINK_REC: @@ -115,8 +115,8 @@ static int llog_check_cb(struct llog_handle *handle, struct llog_rec_hdr *rec, case LLOG_HDR_MAGIC: { l = snprintf(out, remains, "[index]: %05d [type]: " "%02x [len]: %04d ok\n", - cur_index, le32_to_cpu(rec->lrh_type), - le32_to_cpu(rec->lrh_len)); + cur_index, rec->lrh_type, + rec->lrh_len); out += l; remains -= l; if (remains <= 0) { @@ -128,8 +128,8 @@ static int llog_check_cb(struct llog_handle *handle, struct llog_rec_hdr *rec, default: { l = snprintf(out, remains, "[index]: %05d [type]: " "%02x [len]: %04d failed\n", - cur_index, le32_to_cpu(rec->lrh_type), - le32_to_cpu(rec->lrh_len)); + cur_index, rec->lrh_type, + rec->lrh_len); out += l; remains -= l; if (remains <= 0) { @@ -168,15 +168,15 @@ static int llog_print_cb(struct llog_handle *handle, struct llog_rec_hdr *rec, ioc_data->ioc_inllen1 = 0; } - cur_index = le32_to_cpu(rec->lrh_index); + cur_index = rec->lrh_index; if (cur_index < from) RETURN(0); if (to > 0 && cur_index > to) RETURN(-LLOG_EEMPTY); - if (handle->lgh_hdr->llh_flags & cpu_to_le32(LLOG_F_IS_CAT)) { + if (handle->lgh_hdr->llh_flags & LLOG_F_IS_CAT) { struct llog_logid_rec *lir = (struct llog_logid_rec *)rec; - if (rec->lrh_type != cpu_to_le32(LLOG_LOGID_MAGIC)) { + if (rec->lrh_type != LLOG_LOGID_MAGIC) { CERROR("invalid record in catalog\n"); RETURN(-EINVAL); } @@ -188,8 +188,8 @@ static int llog_print_cb(struct llog_handle *handle, struct llog_rec_hdr *rec, } else { l = snprintf(out, remains, "[index]: %05d [type]: %02x [len]: %04d\n", - cur_index, le32_to_cpu(rec->lrh_type), - le32_to_cpu(rec->lrh_len)); + cur_index, rec->lrh_type, + rec->lrh_len); } out += l; remains -= l; @@ -235,7 +235,7 @@ static int llog_delete_cb(struct llog_handle *handle, struct llog_rec_hdr *rec, struct llog_logid_rec *lir = (struct llog_logid_rec*)rec; int rc; - if (rec->lrh_type != cpu_to_le32(LLOG_LOGID_MAGIC)) + if (rec->lrh_type != LLOG_LOGID_MAGIC) return (-EINVAL); rc = llog_remove_log(handle, &lir->lid_id); @@ -283,10 +283,10 @@ int llog_ioctl(struct llog_ctxt *ctxt, int cmd, struct obd_ioctl_data *data) "last index: %d\n", handle->lgh_id.lgl_oid, handle->lgh_id.lgl_ogr, handle->lgh_id.lgl_ogen, - le32_to_cpu(handle->lgh_hdr->llh_flags), - le32_to_cpu(handle->lgh_hdr->llh_flags) & + handle->lgh_hdr->llh_flags, + handle->lgh_hdr->llh_flags & LLOG_F_IS_CAT ? "cat" : "plain", - le32_to_cpu(handle->lgh_hdr->llh_count), + handle->lgh_hdr->llh_count, handle->lgh_last_idx); out += l; remains -= l; @@ -316,7 +316,7 @@ int llog_ioctl(struct llog_ctxt *ctxt, int cmd, struct obd_ioctl_data *data) struct llog_logid plain; char *endp; - if (!(handle->lgh_hdr->llh_flags & cpu_to_le32(LLOG_F_IS_CAT))) + if (!(handle->lgh_hdr->llh_flags & LLOG_F_IS_CAT)) GOTO(out_close, err = -EINVAL); err = str2logid(&plain, data->ioc_inlbuf2, data->ioc_inllen2); @@ -333,7 +333,7 @@ int llog_ioctl(struct llog_ctxt *ctxt, int cmd, struct obd_ioctl_data *data) case OBD_IOC_LLOG_REMOVE: { struct llog_logid plain; - if (!(handle->lgh_hdr->llh_flags & cpu_to_le32(LLOG_F_IS_CAT))) + if (!(handle->lgh_hdr->llh_flags & LLOG_F_IS_CAT)) GOTO(out_close, err = -EINVAL); if (data->ioc_inlbuf2) { @@ -353,7 +353,7 @@ int llog_ioctl(struct llog_ctxt *ctxt, int cmd, struct obd_ioctl_data *data) out_close: if (handle->lgh_hdr && - handle->lgh_hdr->llh_flags & cpu_to_le32(LLOG_F_IS_CAT)) + handle->lgh_hdr->llh_flags & LLOG_F_IS_CAT) llog_cat_put(handle); else llog_close(handle); @@ -366,8 +366,9 @@ int llog_catlog_list(struct obd_device *obd, int count, struct obd_ioctl_data *data) { int size, i; - struct llog_logid *idarray, *id; - char name[32] = "CATLIST"; + struct llog_catid *idarray; + struct llog_logid *id; + char name[32] = CATLIST; char *out; int l, remains, rc = 0; @@ -386,12 +387,11 @@ int llog_catlog_list(struct obd_device *obd, int count, out = data->ioc_bulk; remains = data->ioc_inllen1; - id = idarray; for (i = 0; i < count; i++) { + id = &idarray[i].lci_logid; l = snprintf(out, remains, "catalog log: #"LPX64"#"LPX64"#%08x\n", id->lgl_oid, id->lgl_ogr, id->lgl_ogen); - id++; out += l; remains -= l; if (remains <= 0) { diff --git a/lustre/obdclass/llog_lvfs.c b/lustre/obdclass/llog_lvfs.c index ec32b11..ad0b562 100644 --- a/lustre/obdclass/llog_lvfs.c +++ b/lustre/obdclass/llog_lvfs.c @@ -52,15 +52,15 @@ static int llog_lvfs_pad(struct obd_device *obd, struct l_file *file, int len, int index) { - struct llog_rec_hdr rec; + struct llog_rec_hdr rec = { 0 }; struct llog_rec_tail tail; int rc; ENTRY; LASSERT(len >= LLOG_MIN_REC_SIZE && (len & 0x7) == 0); - tail.lrt_len = rec.lrh_len = cpu_to_le32(len); - tail.lrt_index = rec.lrh_index = cpu_to_le32(index); + tail.lrt_len = rec.lrh_len = len; + tail.lrt_index = rec.lrh_index = index; rec.lrh_type = 0; rc = fsfilt_write_record(obd, file, &rec, sizeof(rec), &file->f_pos, 0); @@ -86,7 +86,7 @@ static int llog_lvfs_write_blob(struct obd_device *obd, struct l_file *file, int rc; struct llog_rec_tail end; loff_t saved_off = file->f_pos; - int buflen = le32_to_cpu(rec->lrh_len); + int buflen = rec->lrh_len; ENTRY; file->f_pos = off; @@ -101,7 +101,7 @@ static int llog_lvfs_write_blob(struct obd_device *obd, struct l_file *file, } /* the buf case */ - rec->lrh_len = cpu_to_le32(sizeof(*rec) + buflen + sizeof(end)); + rec->lrh_len = sizeof(*rec) + buflen + sizeof(end); rc = fsfilt_write_record(obd, file, rec, sizeof(*rec), &file->f_pos, 0); if (rc) { CERROR("error writing log hdr: rc %d\n", rc); @@ -165,7 +165,7 @@ static int llog_lvfs_read_header(struct llog_handle *handle) if (rc) CERROR("error reading log header\n"); - handle->lgh_last_idx = le32_to_cpu(handle->lgh_hdr->llh_tail.lrt_index); + handle->lgh_last_idx = handle->lgh_hdr->llh_tail.lrt_index; handle->lgh_file->f_pos = handle->lgh_file->f_dentry->d_inode->i_size; RETURN(rc); @@ -179,11 +179,10 @@ static int llog_lvfs_write_rec(struct llog_handle *loghandle, void *buf, int idx) { struct llog_log_hdr *llh; - int reclen = le32_to_cpu(rec->lrh_len), index, rc; + int reclen = rec->lrh_len, index, rc; struct llog_rec_tail *lrt; struct obd_device *obd; struct file *file; - loff_t offset; size_t left; ENTRY; @@ -193,8 +192,8 @@ static int llog_lvfs_write_rec(struct llog_handle *loghandle, /* record length should not bigger than LLOG_CHUNK_SIZE */ if (buf) - rc = (reclen > LLOG_CHUNK_SIZE - sizeof(struct llog_rec_hdr) - - sizeof(struct llog_rec_tail)) ? -E2BIG : 0; + rc = (reclen > LLOG_CHUNK_SIZE - sizeof(struct llog_rec_hdr) - + sizeof(struct llog_rec_tail)) ? -E2BIG : 0; else rc = (reclen > LLOG_CHUNK_SIZE) ? -E2BIG : 0; if (rc) @@ -217,7 +216,7 @@ static int llog_lvfs_write_rec(struct llog_handle *loghandle, if (rc || idx == 0) RETURN(rc); - saved_offset = sizeof(*llh) + (idx-1)*le32_to_cpu(rec->lrh_len); + saved_offset = sizeof(*llh) + (idx-1)*rec->lrh_len; rc = llog_lvfs_write_blob(obd, file, rec, buf, saved_offset); if (rc == 0 && reccookie) { reccookie->lgc_lgl = loghandle->lgh_id; @@ -236,23 +235,28 @@ static int llog_lvfs_write_rec(struct llog_handle *loghandle, */ left = LLOG_CHUNK_SIZE - (file->f_pos & (LLOG_CHUNK_SIZE - 1)); if (buf) - reclen = sizeof(*rec) + le32_to_cpu(rec->lrh_len) + + reclen = sizeof(*rec) + rec->lrh_len + sizeof(struct llog_rec_tail); /* NOTE: padding is a record, but no bit is set */ if (left != 0 && left != reclen && left < (reclen + LLOG_MIN_REC_SIZE)) { + int bitmap_size = sizeof(llh->llh_bitmap) * 8; loghandle->lgh_last_idx++; rc = llog_lvfs_pad(obd, file, left, loghandle->lgh_last_idx); if (rc) RETURN(rc); + /* if it's the last idx in log file, then return -ENOSPC */ + if (loghandle->lgh_last_idx == bitmap_size - 1) + RETURN(-ENOSPC); } loghandle->lgh_last_idx++; index = loghandle->lgh_last_idx; - rec->lrh_index = cpu_to_le32(index); + rec->lrh_index = index; if (buf == NULL) { - lrt = (void *)rec + le32_to_cpu(rec->lrh_len) - sizeof(*lrt); + lrt = (struct llog_rec_tail *) + ((char *)rec + rec->lrh_len - sizeof(*lrt)); lrt->lrt_len = rec->lrh_len; lrt->lrt_index = rec->lrh_index; } @@ -260,10 +264,9 @@ static int llog_lvfs_write_rec(struct llog_handle *loghandle, CERROR("argh, index %u already set in log bitmap?\n", index); LBUG(); /* should never happen */ } - llh->llh_count = cpu_to_le32(le32_to_cpu(llh->llh_count) + 1); - llh->llh_tail.lrt_index = cpu_to_le32(index); + llh->llh_count++; + llh->llh_tail.lrt_index = index; - offset = 0; rc = llog_lvfs_write_blob(obd, file, &llh->llh_hdr, NULL, 0); if (rc) RETURN(rc); @@ -273,21 +276,21 @@ static int llog_lvfs_write_rec(struct llog_handle *loghandle, RETURN(rc); CDEBUG(D_HA, "added record "LPX64": idx: %u, %u bytes\n", - loghandle->lgh_id.lgl_oid, index, le32_to_cpu(rec->lrh_len)); + loghandle->lgh_id.lgl_oid, index, rec->lrh_len); if (rc == 0 && reccookie) { reccookie->lgc_lgl = loghandle->lgh_id; reccookie->lgc_index = index; - if (le32_to_cpu(rec->lrh_type) == MDS_UNLINK_REC) + if (rec->lrh_type == MDS_UNLINK_REC) reccookie->lgc_subsys = LLOG_UNLINK_ORIG_CTXT; - else if (le32_to_cpu(rec->lrh_type) == OST_SZ_REC) + else if (rec->lrh_type == OST_SZ_REC) reccookie->lgc_subsys = LLOG_SIZE_ORIG_CTXT; - else if (le32_to_cpu(rec->lrh_type) == OST_RAID1_REC) + else if (rec->lrh_type == OST_RAID1_REC) reccookie->lgc_subsys = LLOG_RD1_ORIG_CTXT; else reccookie->lgc_subsys = -1; rc = 1; } - if (rc == 0 && le32_to_cpu(rec->lrh_type) == LLOG_GEN_REC) + if (rc == 0 && rec->lrh_type == LLOG_GEN_REC) rc = 1; RETURN(rc); @@ -362,7 +365,7 @@ static int llog_lvfs_next_block(struct llog_handle *loghandle, int *cur_idx, } tail = buf + rc - sizeof(struct llog_rec_tail); - *cur_idx = le32_to_cpu(tail->lrt_index); + *cur_idx = tail->lrt_index; /* this shouldn't happen */ if (tail->lrt_index == 0) { @@ -371,15 +374,15 @@ static int llog_lvfs_next_block(struct llog_handle *loghandle, int *cur_idx, loghandle->lgh_id.lgl_ogen, *cur_offset); RETURN(-EINVAL); } - if (le32_to_cpu(tail->lrt_index) < next_idx) + if (tail->lrt_index < next_idx) continue; /* sanity check that the start of the new buffer is no farther * than the record that we wanted. This shouldn't happen. */ rec = buf; - if (le32_to_cpu(rec->lrh_index) > next_idx) { + if (rec->lrh_index > next_idx) { CERROR("missed desired record? %u > %u\n", - le32_to_cpu(rec->lrh_index), next_idx); + rec->lrh_index, next_idx); RETURN(-ENOENT); } RETURN(0); @@ -554,7 +557,7 @@ static int llog_lvfs_destroy(struct llog_handle *handle) /* reads the catalog list */ int llog_get_cat_list(struct obd_device *obd, struct obd_device *disk_obd, - char *name, int count, struct llog_logid *idarray) + char *name, int count, struct llog_catid *idarray) { struct obd_run_ctxt saved; struct l_file *file; @@ -596,7 +599,7 @@ EXPORT_SYMBOL(llog_get_cat_list); /* writes the cat list */ int llog_put_cat_list(struct obd_device *obd, struct obd_device *disk_obd, - char *name, int count, struct llog_logid *idarray) + char *name, int count, struct llog_catid *idarray) { struct obd_run_ctxt saved; struct l_file *file; diff --git a/lustre/obdclass/llog_obd.c b/lustre/obdclass/llog_obd.c index d01441a..e9a9856 100644 --- a/lustre/obdclass/llog_obd.c +++ b/lustre/obdclass/llog_obd.c @@ -128,13 +128,13 @@ static int cat_cancel_cb(struct llog_handle *cathandle, int rc, index; ENTRY; - if (le32_to_cpu(rec->lrh_type) != LLOG_LOGID_MAGIC) { + if (rec->lrh_type != LLOG_LOGID_MAGIC) { CERROR("invalid record in catalog\n"); RETURN(-EINVAL); } CWARN("processing log "LPX64":%x at index %u of catalog "LPX64"\n", lir->lid_id.lgl_oid, lir->lid_id.lgl_ogen, - le32_to_cpu(rec->lrh_index), cathandle->lgh_id.lgl_oid); + rec->lrh_index, cathandle->lgh_id.lgl_oid); rc = llog_cat_id2handle(cathandle, &loghandle, &lir->lid_id); if (rc) { @@ -144,8 +144,8 @@ static int cat_cancel_cb(struct llog_handle *cathandle, } llh = loghandle->lgh_hdr; - if ((le32_to_cpu(llh->llh_flags) & LLOG_F_ZAP_WHEN_EMPTY) && - (le32_to_cpu(llh->llh_count) == 1)) { + if ((llh->llh_flags & LLOG_F_ZAP_WHEN_EMPTY) && + (llh->llh_count == 1)) { rc = llog_destroy(loghandle); if (rc) CERROR("failure destroying log in postsetup: %d\n", rc); @@ -160,7 +160,7 @@ static int cat_cancel_cb(struct llog_handle *cathandle, if (rc == 0) CWARN("cancel log "LPX64":%x at index %u of catalog " LPX64"\n", lir->lid_id.lgl_oid, - lir->lid_id.lgl_ogen, le32_to_cpu(rec->lrh_index), + lir->lid_id.lgl_ogen, rec->lrh_index, cathandle->lgh_id.lgl_oid); } @@ -233,9 +233,9 @@ int llog_obd_origin_cleanup(struct llog_ctxt *ctxt) &cathandle->u.chd.chd_head, u.phd.phd_entry) { llh = loghandle->lgh_hdr; - if ((le32_to_cpu(llh->llh_flags) & + if ((llh->llh_flags & LLOG_F_ZAP_WHEN_EMPTY) && - (le32_to_cpu(llh->llh_count) == 1)) { + (llh->llh_count == 1)) { rc = llog_destroy(loghandle); if (rc) CERROR("failure destroying log during " @@ -280,9 +280,9 @@ EXPORT_SYMBOL(llog_obd_origin_add); int llog_cat_initialize(struct obd_device *obd, int count) { - struct llog_logid *idarray; + struct llog_catid *idarray; int size = sizeof(*idarray) * count; - char name[32] = "CATLIST"; + char name[32] = CATLIST; int rc; ENTRY; @@ -290,8 +290,6 @@ int llog_cat_initialize(struct obd_device *obd, int count) if (!idarray) RETURN(-ENOMEM); - memset(idarray, 0, size); - rc = llog_get_cat_list(obd, obd, name, count, idarray); if (rc) { CERROR("rc: %d\n", rc); @@ -317,7 +315,7 @@ int llog_cat_initialize(struct obd_device *obd, int count) EXPORT_SYMBOL(llog_cat_initialize); int obd_llog_init(struct obd_device *obd, struct obd_device *disk_obd, - int count, struct llog_logid *logid) + int count, struct llog_catid *logid) { int rc; ENTRY; diff --git a/lustre/obdclass/llog_test.c b/lustre/obdclass/llog_test.c index 0607d12..f8e6de1 100644 --- a/lustre/obdclass/llog_test.c +++ b/lustre/obdclass/llog_test.c @@ -62,9 +62,9 @@ static int verify_handle(char *test, struct llog_handle *llh, int num_recs) RETURN(-ERANGE); } - if (le32_to_cpu(llh->lgh_hdr->llh_count) != num_recs) { + if (llh->lgh_hdr->llh_count != num_recs) { CERROR("%s: handle->count is %d, expected %d after write\n", - test, le32_to_cpu(llh->lgh_hdr->llh_count), num_recs); + test, llh->lgh_hdr->llh_count, num_recs); RETURN(-ERANGE); } @@ -168,8 +168,8 @@ static int llog_test_3(struct obd_device *obd, struct llog_handle *llh) int num_recs = 1; /* 1 for the header */ ENTRY; - lcr.lcr_hdr.lrh_len = lcr.lcr_tail.lrt_len = cpu_to_le32(sizeof(lcr)); - lcr.lcr_hdr.lrh_type = cpu_to_le32(OST_SZ_REC); + lcr.lcr_hdr.lrh_len = lcr.lcr_tail.lrt_len = sizeof(lcr); + lcr.lcr_hdr.lrh_type = OST_SZ_REC; CWARN("3a: write one create_rec\n"); rc = llog_write_rec(llh, &lcr.lcr_hdr, NULL, 0, NULL, -1); @@ -186,8 +186,8 @@ static int llog_test_3(struct obd_device *obd, struct llog_handle *llh) for (i = 0; i < 10; i++) { struct llog_rec_hdr hdr; char buf[8]; - hdr.lrh_len = cpu_to_le32(8); - hdr.lrh_type = cpu_to_le32(OBD_CFG_REC); + hdr.lrh_len = 8; + hdr.lrh_type = OBD_CFG_REC; memset(buf, 0, sizeof buf); rc = llog_write_rec(llh, &hdr, NULL, 0, buf, -1); if (rc) { @@ -237,9 +237,8 @@ static int llog_test_4(struct obd_device *obd) ENTRY; - lmr.lmr_hdr.lrh_len = lmr.lmr_tail.lrt_len = - cpu_to_le32(LLOG_MIN_REC_SIZE); - lmr.lmr_hdr.lrh_type = cpu_to_le32(0xf00f00); + lmr.lmr_hdr.lrh_len = lmr.lmr_tail.lrt_len = LLOG_MIN_REC_SIZE; + lmr.lmr_hdr.lrh_type = 0xf00f00; sprintf(name, "%x", llog_test_rand+1); CWARN("4a: create a catalog log with name: %s\n", name); @@ -294,8 +293,8 @@ static int llog_test_4(struct obd_device *obd) if (buf == NULL) GOTO(out, rc = -ENOMEM); for (i = 0; i < 5; i++) { - rec.lrh_len = cpu_to_le32(buflen); - rec.lrh_type = cpu_to_le32(OBD_CFG_REC); + rec.lrh_len = buflen; + rec.lrh_type = OBD_CFG_REC; rc = llog_cat_add_rec(cath, &rec, NULL, buf); if (rc) { CERROR("4e: write 5 records failed at #%d: %d\n", @@ -320,13 +319,13 @@ static int cat_print_cb(struct llog_handle *llh, struct llog_rec_hdr *rec, { struct llog_logid_rec *lir = (struct llog_logid_rec *)rec; - if (le32_to_cpu(rec->lrh_type) != LLOG_LOGID_MAGIC) { + if (rec->lrh_type != LLOG_LOGID_MAGIC) { CERROR("invalid record in catalog\n"); RETURN(-EINVAL); } CWARN("seeing record at index %d - "LPX64":%x in log "LPX64"\n", - le32_to_cpu(rec->lrh_index), lir->lid_id.lgl_oid, + rec->lrh_index, lir->lid_id.lgl_oid, lir->lid_id.lgl_ogen, llh->lgh_id.lgl_oid); RETURN(0); } @@ -334,13 +333,13 @@ static int cat_print_cb(struct llog_handle *llh, struct llog_rec_hdr *rec, static int plain_print_cb(struct llog_handle *llh, struct llog_rec_hdr *rec, void *data) { - if (!(le32_to_cpu(llh->lgh_hdr->llh_flags) & LLOG_F_IS_PLAIN)) { + if (!(llh->lgh_hdr->llh_flags & LLOG_F_IS_PLAIN)) { CERROR("log is not plain\n"); RETURN(-EINVAL); } CWARN("seeing record at index %d in log "LPX64"\n", - le32_to_cpu(rec->lrh_index), llh->lgh_id.lgl_oid); + rec->lrh_index, llh->lgh_id.lgl_oid); RETURN(0); } @@ -350,13 +349,13 @@ static int llog_cancel_rec_cb(struct llog_handle *llh, struct llog_rec_hdr *rec, struct llog_cookie cookie; static int i = 0; - if (!(le32_to_cpu(llh->lgh_hdr->llh_flags) & LLOG_F_IS_PLAIN)) { + if (!(llh->lgh_hdr->llh_flags & LLOG_F_IS_PLAIN)) { CERROR("log is not plain\n"); RETURN(-EINVAL); } cookie.lgc_lgl = llh->lgh_id; - cookie.lgc_index = le32_to_cpu(rec->lrh_index); + cookie.lgc_index = rec->lrh_index; llog_cat_cancel_records(llh->u.phd.phd_cat_handle, 1, &cookie); i++; @@ -378,9 +377,8 @@ static int llog_test_5(struct obd_device *obd) ENTRY; - lmr.lmr_hdr.lrh_len = lmr.lmr_tail.lrt_len = - cpu_to_le32(LLOG_MIN_REC_SIZE); - lmr.lmr_hdr.lrh_type = cpu_to_le32(0xf00f00); + lmr.lmr_hdr.lrh_len = lmr.lmr_tail.lrt_len = LLOG_MIN_REC_SIZE; + lmr.lmr_hdr.lrh_type = 0xf00f00; CWARN("5a: re-open catalog by id\n"); rc = llog_create(ctxt, &llh, &cat_logid, NULL); @@ -548,7 +546,7 @@ static int llog_run_tests(struct obd_device *obd) static int llog_test_llog_init(struct obd_device *obd, struct obd_device *tgt, - int count, struct llog_logid *logid) + int count, struct llog_catid *logid) { int rc; ENTRY; diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index 54a1d7b..119ca99 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -646,7 +646,7 @@ int lprocfs_alloc_obd_stats(struct obd_device *obd, unsigned num_private_stats) LPROCFS_OBD_OP_INIT(num_private_stats, stats, llog_finish); LPROCFS_OBD_OP_INIT(num_private_stats, stats, pin); LPROCFS_OBD_OP_INIT(num_private_stats, stats, unpin); - LPROCFS_OBD_OP_INIT(num_private_stats, stats, invalidate_import); + LPROCFS_OBD_OP_INIT(num_private_stats, stats, import_event); LPROCFS_OBD_OP_INIT(num_private_stats, stats, notify); for (i = num_private_stats; i < num_stats; i++) { diff --git a/lustre/obdclass/lustre_handles.c b/lustre/obdclass/lustre_handles.c index 2339f28..0a6acfe 100644 --- a/lustre/obdclass/lustre_handles.c +++ b/lustre/obdclass/lustre_handles.c @@ -144,8 +144,8 @@ static void cleanup_all_handles(void) struct portals_handle *h; h = list_entry(tmp, struct portals_handle, h_link); - CERROR("forcing cleanup for handle "LPX64"\n", - h->h_cookie); + CERROR("force clean handle "LPX64" addr %p addref %p\n", + h->h_cookie, h, h->h_addref); class_handle_unhash_nolock(h); } diff --git a/lustre/obdecho/echo.c b/lustre/obdecho/echo.c index 8ac9b5a..093f3ac 100644 --- a/lustre/obdecho/echo.c +++ b/lustre/obdecho/echo.c @@ -362,17 +362,20 @@ preprw_cleanup: int echo_commitrw(int cmd, struct obd_export *export, struct obdo *oa, int objcount, struct obd_ioobj *obj, int niocount, - struct niobuf_local *res, struct obd_trans_info *oti) + struct niobuf_local *res, struct obd_trans_info *oti, int rc) { struct obd_device *obd; struct niobuf_local *r = res; - int i, vrc = 0, rc = 0; + int i, vrc = 0; ENTRY; obd = export->exp_obd; if (obd == NULL) RETURN(-EINVAL); + if (rc) + GOTO(commitrw_cleanup, rc); + if ((cmd & OBD_BRW_RWMASK) == OBD_BRW_READ) { CDEBUG(D_PAGE, "reading %d obdos with %d IOs\n", objcount, niocount); diff --git a/lustre/obdecho/echo_client.c b/lustre/obdecho/echo_client.c index f5bcf79..136d357 100644 --- a/lustre/obdecho/echo_client.c +++ b/lustre/obdecho/echo_client.c @@ -905,7 +905,7 @@ static int echo_client_prep_commit(struct obd_export *exp, int rw, struct niobuf_remote *rnb; obd_off off; obd_size npages, tot_pages; - int i, ret = 0, err = 0; + int i, ret = 0; ENTRY; if (count <= 0 || (count & (PAGE_SIZE - 1)) != 0 || @@ -946,29 +946,27 @@ static int echo_client_prep_commit(struct obd_export *exp, int rw, struct page *page = lnb[i].page; /* read past eof? */ - if (page == NULL && lnb[i].rc == 0) + if (page == NULL && lnb[i].rc == 0) continue; if (oa->o_id == ECHO_PERSISTENT_OBJID) continue; - if (rw == OBD_BRW_WRITE) - echo_client_page_debug_setup(lsm, page, rw, - oa->o_id, - rnb[i].offset, + if (rw == OBD_BRW_WRITE) + echo_client_page_debug_setup(lsm, page, rw, + oa->o_id, + rnb[i].offset, rnb[i].len); else - echo_client_page_debug_check(lsm, page, - oa->o_id, - rnb[i].offset, + echo_client_page_debug_check(lsm, page, + oa->o_id, + rnb[i].offset, rnb[i].len); } - ret = obd_commitrw(rw, exp, oa, 1, &ioo, npages, lnb, oti); + ret = obd_commitrw(rw, exp, oa, 1, &ioo, npages, lnb, oti, ret); if (ret != 0) GOTO(out, ret); - if (err) - GOTO(out, ret = err); } out: @@ -979,7 +977,7 @@ out: RETURN(ret); } -int echo_client_brw_ioctl(int rw, struct obd_export *exp, +int echo_client_brw_ioctl(int rw, struct obd_export *exp, struct obd_ioctl_data *data) { struct obd_device *obd = class_exp2obd(exp); diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index d3785d4..0e8e458 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -570,7 +570,7 @@ static int filter_prep_groups(struct obd_device *obd) int i, rc = 0, cleanup_phase = 0; ENTRY; - O_dentry = simple_mkdir(current->fs->pwd, "O", 0700); + O_dentry = simple_mkdir(current->fs->pwd, "O", 0700, 1); CDEBUG(D_INODE, "got/created O: %p\n", O_dentry); if (IS_ERR(O_dentry)) { rc = PTR_ERR(O_dentry); @@ -645,7 +645,7 @@ static int filter_prep_groups(struct obd_device *obd) loff_t off = 0; sprintf(name, "%d", i); - dentry = simple_mkdir(O_dentry, name, 0700); + dentry = simple_mkdir(O_dentry, name, 0700, 1); CDEBUG(D_INODE, "got/created O/%s: %p\n", name, dentry); if (IS_ERR(dentry)) { rc = PTR_ERR(dentry); @@ -704,7 +704,7 @@ static int filter_prep_groups(struct obd_device *obd) char dir[20]; snprintf(dir, sizeof(dir), "d%u", i); - dentry = simple_mkdir(O_dentry, dir, 0700); + dentry = simple_mkdir(O_dentry, dir, 0700, 1); CDEBUG(D_INODE, "got/created O/0/%s: %p\n", dir,dentry); if (IS_ERR(dentry)) { rc = PTR_ERR(dentry); @@ -1411,6 +1411,93 @@ static int filter_precleanup(struct obd_device *obd, int flags) RETURN(rc); } +/* Do extra sanity checks for grant accounting. We do this at connect, + * disconnect, and statfs RPC time, so it shouldn't be too bad. We can + * always get rid of it or turn it off when we know accounting is good. */ +static void filter_grant_sanity_check(struct obd_device *obd, char *func) +{ + struct filter_export_data *fed; + struct obd_export *exp; + obd_size maxsize = obd->obd_osfs.os_blocks * obd->obd_osfs.os_bsize; + obd_size tot_dirty = 0, tot_pending = 0, tot_granted = 0; + obd_size fo_tot_dirty, fo_tot_pending, fo_tot_granted; + + if (list_empty(&obd->obd_exports)) + return; + + spin_lock(&obd->obd_osfs_lock); + spin_lock(&obd->obd_dev_lock); + list_for_each_entry(exp, &obd->obd_exports, exp_obd_chain) { + fed = &exp->exp_filter_data; + LASSERTF(fed->fed_grant + fed->fed_pending <= maxsize, + "cli %s/%p %lu+%lu > "LPU64"\n", + exp->exp_client_uuid.uuid, exp, + fed->fed_grant, fed->fed_pending, maxsize); + LASSERTF(fed->fed_dirty <= maxsize, "cli %s/%p %lu > "LPU64"\n", + exp->exp_client_uuid.uuid, exp,fed->fed_dirty,maxsize); + CDEBUG(D_CACHE,"%s: cli %s/%p dirty %lu pend %lu grant %lu\n", + obd->obd_name, exp->exp_client_uuid.uuid, exp, + fed->fed_dirty, fed->fed_pending, fed->fed_grant); + tot_granted += fed->fed_grant + fed->fed_pending; + tot_pending += fed->fed_pending; + tot_dirty += fed->fed_dirty; + } + fo_tot_granted = obd->u.filter.fo_tot_granted; + fo_tot_pending = obd->u.filter.fo_tot_pending; + fo_tot_dirty = obd->u.filter.fo_tot_dirty; + spin_unlock(&obd->obd_dev_lock); + spin_unlock(&obd->obd_osfs_lock); + + /* Do these assertions outside the spinlocks so we don't kill system */ + LASSERTF(tot_granted == fo_tot_granted, "%s "LPU64" != "LPU64"\n", + func, tot_granted, fo_tot_granted); + LASSERTF(tot_pending == fo_tot_pending, "%s "LPU64" != "LPU64"\n", + func, tot_pending, fo_tot_pending); + LASSERTF(tot_dirty == fo_tot_dirty, "%s "LPU64" != "LPU64"\n", + func, tot_dirty, fo_tot_dirty); + LASSERTF(tot_pending <= tot_granted, "%s "LPU64" > "LPU64"\n", + func, tot_pending, tot_granted); + LASSERTF(tot_granted <= maxsize, "%s "LPU64" > "LPU64"\n", + func, tot_granted, maxsize); + LASSERTF(tot_dirty <= maxsize, "%s "LPU64" > "LPU64"\n", + func, tot_dirty, maxsize); +} + +/* Remove this client from the grant accounting totals. This is done at + * disconnect time and also at export destroy time in case there was a race + * between removing the export and an incoming BRW updating the client grant. + * The client should do something similar when it invalidates its import. */ +static void filter_grant_discard(struct obd_export *exp) +{ + struct obd_device *obd = exp->exp_obd; + struct filter_obd *filter = &obd->u.filter; + struct filter_export_data *fed = &exp->exp_filter_data; + + spin_lock(&obd->obd_osfs_lock); + CDEBUG(D_CACHE, "%s: cli %s/%p dirty %lu pend %lu grant %lu\n", + obd->obd_name, exp->exp_client_uuid.uuid, exp, + fed->fed_dirty, fed->fed_pending, fed->fed_grant); + + LASSERTF(filter->fo_tot_granted >= fed->fed_grant, + "%s: tot_granted "LPU64" cli %s/%p fed_grant %lu\n", + obd->obd_name, filter->fo_tot_granted, + exp->exp_client_uuid.uuid, exp, fed->fed_grant); + filter->fo_tot_granted -= fed->fed_grant; + LASSERTF(exp->exp_obd->u.filter.fo_tot_pending >= fed->fed_pending, + "%s: tot_pending "LPU64" cli %s/%p fed_pending %lu\n", + obd->obd_name, filter->fo_tot_pending, + exp->exp_client_uuid.uuid, exp, fed->fed_pending); + LASSERTF(filter->fo_tot_dirty >= fed->fed_dirty, + "%s: tot_dirty "LPU64" cli %s/%p fed_dirty %lu\n", + obd->obd_name, filter->fo_tot_dirty, + exp->exp_client_uuid.uuid, exp, fed->fed_dirty); + filter->fo_tot_dirty -= fed->fed_dirty; + fed->fed_dirty = 0; + fed->fed_grant = 0; + + spin_unlock(&obd->obd_osfs_lock); +} + static int filter_destroy_export(struct obd_export *exp) { ENTRY; @@ -1424,62 +1511,46 @@ static int filter_destroy_export(struct obd_export *exp) if (exp->exp_obd->obd_replayable) filter_client_free(exp, exp->exp_flags); + + filter_grant_sanity_check(exp->exp_obd, __FUNCTION__); + RETURN(0); } /* also incredibly similar to mds_disconnect */ static int filter_disconnect(struct obd_export *exp, int flags) { - struct filter_obd *filter = &exp->exp_obd->u.filter; - struct filter_export_data *fed = &exp->exp_filter_data; + struct obd_device *obd = exp->exp_obd; unsigned long irqflags; struct llog_ctxt *ctxt; int rc; ENTRY; LASSERT(exp); - - /* This would imply RPCs still in flight or preprw/commitrw imbalance */ - if (fed->fed_pending) - CWARN("%s: cli %s has %lu pending at disconnect time\n", - exp->exp_obd->obd_name, exp->exp_client_uuid.uuid, - fed->fed_pending); - - /* Forget what this client had cached. This is also done on the - * client when it invalidates its import. Do this before unlinking - * from the export list so filter_grant_sanity_check totals are OK. */ - spin_lock(&exp->exp_obd->obd_osfs_lock); - LASSERTF(exp->exp_obd->u.filter.fo_tot_dirty >= fed->fed_dirty, - "%s: tot_dirty "LPU64" cli %s/%p fed_dirty %lu\n", - exp->exp_obd->obd_name, exp->exp_obd->u.filter.fo_tot_dirty, - exp->exp_client_uuid.uuid, exp, fed->fed_dirty); - exp->exp_obd->u.filter.fo_tot_dirty -= fed->fed_dirty; - LASSERTF(exp->exp_obd->u.filter.fo_tot_granted >= fed->fed_grant, - "%s: tot_granted "LPU64" cli %s/%p fed_grant %lu\n", - exp->exp_obd->obd_name, exp->exp_obd->u.filter.fo_tot_granted, - exp->exp_client_uuid.uuid, exp, fed->fed_grant); - exp->exp_obd->u.filter.fo_tot_granted -= fed->fed_grant; - LASSERTF(exp->exp_obd->u.filter.fo_tot_pending >= fed->fed_pending, - "%s: tot_pending "LPU64" cli %s/%p fed_pending %lu\n", - exp->exp_obd->obd_name, exp->exp_obd->u.filter.fo_tot_pending, - exp->exp_client_uuid.uuid, exp, fed->fed_pending); - fed->fed_dirty = 0; - fed->fed_grant = 0; - spin_unlock(&exp->exp_obd->obd_osfs_lock); - - ldlm_cancel_locks_for_export(exp); + class_export_get(exp); spin_lock_irqsave(&exp->exp_lock, irqflags); exp->exp_flags = flags; spin_unlock_irqrestore(&exp->exp_lock, irqflags); - fsfilt_sync(exp->exp_obd, filter->fo_sb); + filter_grant_discard(exp); + + /* Disconnect early so that clients can't keep using export */ + rc = class_disconnect(exp, flags); + + /* Do this twice in case a BRW arrived between the first call and + * the class_export_unlink() call (bug 2663) */ + filter_grant_discard(exp); + + ldlm_cancel_locks_for_export(exp); + + fsfilt_sync(obd, obd->u.filter.fo_sb); /* flush any remaining cancel messages out to the target */ - ctxt = llog_get_context(exp->exp_obd, LLOG_UNLINK_REPL_CTXT); + ctxt = llog_get_context(obd, LLOG_UNLINK_REPL_CTXT); llog_sync(ctxt, exp); - rc = class_disconnect(exp, flags); + class_export_put(exp); RETURN(rc); } @@ -2091,59 +2162,10 @@ static int filter_sync(struct obd_export *exp, struct obdo *oa, RETURN(rc); } -/* debugging to make sure that nothing bad happens, can be turned off soon. - * caller must hold osfs lock */ -static void filter_grant_total_exports(struct obd_device *obd, - obd_size *tot_dirty, - obd_size *tot_pending, - obd_size *tot_granted, - obd_size maxsize) -{ - struct filter_export_data *fed; - struct obd_export *exp_pos; - - spin_lock(&obd->obd_dev_lock); - list_for_each_entry(exp_pos, &obd->obd_exports, exp_obd_chain) { - fed = &exp_pos->exp_filter_data; - LASSERTF(fed->fed_dirty <= maxsize, "cli %s/%p %lu > "LPU64"\n", - exp_pos->exp_client_uuid.uuid, exp_pos, - fed->fed_dirty, maxsize); - LASSERTF(fed->fed_grant + fed->fed_pending <= maxsize, - "cli %s/%p %lu+%lu > "LPU64"\n", - exp_pos->exp_client_uuid.uuid, exp_pos, - fed->fed_grant, fed->fed_pending, maxsize); - *tot_dirty += fed->fed_dirty; - *tot_pending += fed->fed_pending; - *tot_granted += fed->fed_grant + fed->fed_pending; - } - spin_unlock(&obd->obd_dev_lock); -} - -static void filter_grant_sanity_check(obd_size tot_dirty, obd_size tot_pending, - obd_size tot_granted, - obd_size fo_tot_dirty, - obd_size fo_tot_pending, - obd_size fo_tot_granted, obd_size maxsize) -{ - LASSERTF(tot_dirty == fo_tot_dirty, LPU64" != "LPU64"\n", - tot_dirty, fo_tot_dirty); - LASSERTF(tot_pending == fo_tot_pending, LPU64" != "LPU64"\n", - tot_pending, fo_tot_pending); - LASSERTF(tot_granted == fo_tot_granted, LPU64" != "LPU64"\n", - tot_granted, fo_tot_granted); - LASSERTF(tot_dirty <= maxsize, LPU64" > "LPU64"\n", tot_dirty, maxsize); - LASSERTF(tot_pending <= tot_granted, LPU64" > "LPU64"\n", tot_pending, - tot_granted); - LASSERTF(tot_granted <= maxsize, LPU64" > "LPU64"\n", - tot_granted, maxsize); -} - static int filter_statfs(struct obd_device *obd, struct obd_statfs *osfs, unsigned long max_age) { struct filter_obd *filter = &obd->u.filter; - obd_size tot_cached = 0, tot_pending = 0, tot_granted = 0; - obd_size fo_tot_cached, fo_tot_pending, fo_tot_granted; int blockbits = filter->fo_sb->s_blocksize_bits; int rc; ENTRY; @@ -2154,26 +2176,19 @@ static int filter_statfs(struct obd_device *obd, struct obd_statfs *osfs, spin_lock(&obd->obd_osfs_lock); rc = fsfilt_statfs(obd, filter->fo_sb, max_age); memcpy(osfs, &obd->obd_osfs, sizeof(*osfs)); - filter_grant_total_exports(obd, &tot_cached, &tot_pending, &tot_granted, - osfs->os_blocks << blockbits); - fo_tot_cached = filter->fo_tot_dirty; - fo_tot_pending = filter->fo_tot_pending; - fo_tot_granted = filter->fo_tot_granted; spin_unlock(&obd->obd_osfs_lock); - /* Do check outside spinlock, to avoid wedging system on failure */ - filter_grant_sanity_check(tot_cached, tot_pending, tot_granted, - fo_tot_cached, fo_tot_pending, - fo_tot_granted, osfs->os_blocks << blockbits); - CDEBUG(D_SUPER | D_CACHE, "blocks cached "LPU64" granted "LPU64 - "pending "LPU64" free "LPU64" avail "LPU64"\n", - tot_cached >> blockbits, tot_granted >> blockbits, - tot_pending >> blockbits, osfs->os_bfree, osfs->os_bavail); + " pending "LPU64" free "LPU64" avail "LPU64"\n", + filter->fo_tot_dirty, filter->fo_tot_granted, + filter->fo_tot_pending, + osfs->os_bfree << blockbits, osfs->os_bavail << blockbits); + + filter_grant_sanity_check(obd, __FUNCTION__); osfs->os_bavail -= min(osfs->os_bavail, - (tot_cached +tot_pending +osfs->os_bsize -1) >> - blockbits); + (filter->fo_tot_dirty + filter->fo_tot_pending + + osfs->os_bsize -1) >> blockbits); RETURN(rc); } @@ -2312,7 +2327,7 @@ static struct llog_operations filter_size_orig_logops = { }; static int filter_llog_init(struct obd_device *obd, struct obd_device *tgt, - int count, struct llog_logid *logid) + int count, struct llog_catid *logid) { struct llog_ctxt *ctxt; int rc; diff --git a/lustre/obdfilter/filter_internal.h b/lustre/obdfilter/filter_internal.h index 93379d8..6203418 100644 --- a/lustre/obdfilter/filter_internal.h +++ b/lustre/obdfilter/filter_internal.h @@ -121,7 +121,7 @@ int filter_preprw(int cmd, struct obd_export *, struct obdo *, int objcount, struct niobuf_local *, struct obd_trans_info *); int filter_commitrw(int cmd, struct obd_export *, struct obdo *, int objcount, struct obd_ioobj *, int niocount, struct niobuf_local *, - struct obd_trans_info *); + struct obd_trans_info *, int rc); int filter_brw(int cmd, struct obd_export *, struct obdo *, struct lov_stripe_md *, obd_count oa_bufs, struct brw_page *, struct obd_trans_info *); @@ -130,7 +130,8 @@ void flip_into_page_cache(struct inode *inode, struct page *new_page); /* filter_io_*.c */ int filter_commitrw_write(struct obd_export *exp, struct obdo *oa, int objcount, struct obd_ioobj *obj, int niocount, - struct niobuf_local *res, struct obd_trans_info *oti); + struct niobuf_local *res, struct obd_trans_info *oti, + int rc); obd_size filter_grant_space_left(struct obd_export *exp); long filter_grant(struct obd_export *exp, obd_size current_grant, obd_size want, obd_size fs_space_left); diff --git a/lustre/obdfilter/filter_io.c b/lustre/obdfilter/filter_io.c index ad4298c..7e305f5 100644 --- a/lustre/obdfilter/filter_io.c +++ b/lustre/obdfilter/filter_io.c @@ -108,6 +108,8 @@ static void filter_grant_incoming(struct obd_export *exp, struct obdo *oa) struct obd_device *obd = exp->exp_obd; ENTRY; + LASSERT_SPIN_LOCKED(&obd->obd_osfs_lock); + if ((oa->o_valid & (OBD_MD_FLBLOCKS|OBD_MD_FLGRANT)) != (OBD_MD_FLBLOCKS|OBD_MD_FLGRANT)) { oa->o_valid &= ~OBD_MD_FLGRANT; @@ -122,8 +124,8 @@ static void filter_grant_incoming(struct obd_export *exp, struct obdo *oa) * leave this here in case there is a large error in accounting. */ CDEBUG(oa->o_grant > fed->fed_grant + FILTER_GRANT_CHUNK ? D_ERROR : D_CACHE, - "%s: cli %s reports granted: "LPU64" dropped: %u, local: %lu\n", - obd->obd_name, exp->exp_client_uuid.uuid, oa->o_grant, + "%s: cli %s/%p reports grant: "LPU64" dropped: %u, local: %lu\n", + obd->obd_name, exp->exp_client_uuid.uuid, exp, oa->o_grant, oa->o_dropped, fed->fed_grant); /* Update our accounting now so that statfs takes it into account. @@ -132,14 +134,14 @@ static void filter_grant_incoming(struct obd_export *exp, struct obdo *oa) * on fed_dirty however. */ obd->u.filter.fo_tot_dirty += oa->o_dirty - fed->fed_dirty; if (fed->fed_grant < oa->o_dropped) { - CERROR("%s: cli %s reports %u dropped > fed_grant %lu\n", - obd->obd_name, exp->exp_client_uuid.uuid, + CERROR("%s: cli %s/%p reports %u dropped > fed_grant %lu\n", + obd->obd_name, exp->exp_client_uuid.uuid, exp, oa->o_dropped, fed->fed_grant); oa->o_dropped = 0; } if (obd->u.filter.fo_tot_granted < oa->o_dropped) { - CERROR("%s: cli %s reports %u dropped > tot_granted "LPU64"\n", - obd->obd_name, exp->exp_client_uuid.uuid, + CERROR("%s: cli %s/%p reports %u dropped > tot_grant "LPU64"\n", + obd->obd_name, exp->exp_client_uuid.uuid, exp, oa->o_dropped, obd->u.filter.fo_tot_granted); oa->o_dropped = 0; } @@ -163,6 +165,8 @@ obd_size filter_grant_space_left(struct obd_export *exp) obd_size tot_granted = obd->u.filter.fo_tot_granted, avail, left = 0; int rc, statfs_done = 0; + LASSERT_SPIN_LOCKED(&obd->obd_osfs_lock); + if (time_before(obd->obd_osfs_age, jiffies - HZ)) { restat: rc = fsfilt_statfs(obd, obd->u.filter.fo_sb, jiffies + 1); @@ -191,10 +195,10 @@ restat: if (left < tot_granted - obd->u.filter.fo_tot_pending && time_after(jiffies, next)) { spin_unlock(&obd->obd_osfs_lock); - CERROR("%s: cli %s granted "LPU64" more than available " + CERROR("%s: cli %s/%p grant "LPU64" > available " LPU64" and pending "LPU64"\n", obd->obd_name, - exp->exp_client_uuid.uuid, tot_granted, left, - obd->u.filter.fo_tot_pending); + exp->exp_client_uuid.uuid, exp, tot_granted, + left, obd->u.filter.fo_tot_pending); if (next == 0) portals_debug_dumplog(); next = jiffies + 20 * HZ; @@ -203,11 +207,11 @@ restat: left = 0; } - CDEBUG(D_CACHE, "%s: cli %s free: "LPU64" avail: "LPU64" grant "LPU64 + CDEBUG(D_CACHE, "%s: cli %s/%p free: "LPU64" avail: "LPU64" grant "LPU64 " left: "LPU64" pending: "LPU64"\n", obd->obd_name, - exp->exp_client_uuid.uuid, obd->obd_osfs.os_bfree << blockbits, - avail << blockbits, tot_granted, left, - obd->u.filter.fo_tot_pending); + exp->exp_client_uuid.uuid, exp, + obd->obd_osfs.os_bfree << blockbits, avail << blockbits, + tot_granted, left, obd->u.filter.fo_tot_pending); return left; } @@ -224,6 +228,8 @@ long filter_grant(struct obd_export *exp, obd_size current_grant, int blockbits = obd->u.filter.fo_sb->s_blocksize_bits; __u64 grant = 0; + LASSERT_SPIN_LOCKED(&obd->obd_osfs_lock); + /* Grant some fraction of the client's requested grant space so that * they are not always waiting for write credits (not all of it to * avoid overgranting in face of multiple RPCs in flight). This @@ -246,12 +252,12 @@ long filter_grant(struct obd_export *exp, obd_size current_grant, } } - CDEBUG(D_CACHE,"%s: cli %s wants: "LPU64" granting: "LPU64"\n", - obd->obd_name, exp->exp_client_uuid.uuid, want, grant); + CDEBUG(D_CACHE,"%s: cli %s/%p wants: "LPU64" granting: "LPU64"\n", + obd->obd_name, exp->exp_client_uuid.uuid, exp, want, grant); CDEBUG(D_CACHE, - "%s: cli %s tot cached:"LPU64" granted:"LPU64 + "%s: cli %s/%p tot cached:"LPU64" granted:"LPU64 " num_exports: %d\n", obd->obd_name, exp->exp_client_uuid.uuid, - obd->u.filter.fo_tot_dirty, + exp, obd->u.filter.fo_tot_dirty, obd->u.filter.fo_tot_granted, obd->obd_num_exports); return grant; @@ -426,6 +432,8 @@ static int filter_grant_check(struct obd_export *exp, int objcount, unsigned long used = 0, ungranted = 0, using; int i, rc = -ENOSPC, obj, n = 0, mask = D_CACHE; + LASSERT_SPIN_LOCKED(&exp->exp_obd->obd_osfs_lock); + for (obj = 0; obj < objcount; obj++) { for (i = 0; i < fso[obj].fso_bufcnt; i++, n++) { int tmp, bytes; @@ -440,10 +448,10 @@ static int filter_grant_check(struct obd_export *exp, int objcount, if (rnb[n].flags & OBD_BRW_FROM_GRANT) { if (fed->fed_grant < used + bytes) { CDEBUG(D_CACHE, - "%s: cli %s claims %ld+%d GRANT," - " no such grant %lu, idx %d\n", + "%s: cli %s/%p claims %ld+%d " + "GRANT, real grant %lu idx %d\n", exp->exp_obd->obd_name, - exp->exp_client_uuid.uuid, + exp->exp_client_uuid.uuid, exp, used, bytes, fed->fed_grant, n); mask = D_ERROR; } else { @@ -472,9 +480,9 @@ static int filter_grant_check(struct obd_export *exp, int objcount, * ignore this error. */ lnb[n].rc = -ENOSPC; rnb[n].flags &= OBD_BRW_GRANTED; - CDEBUG(D_CACHE, "%s: cli %s idx %d no space for %d\n", + CDEBUG(D_CACHE,"%s: cli %s/%p idx %d no space for %d\n", exp->exp_obd->obd_name, - exp->exp_client_uuid.uuid, n, bytes); + exp->exp_client_uuid.uuid, exp, n, bytes); } } @@ -488,8 +496,8 @@ static int filter_grant_check(struct obd_export *exp, int objcount, exp->exp_obd->u.filter.fo_tot_pending += used; CDEBUG(mask, - "%s: cli %s used: %lu ungranted: %lu grant: %lu dirty: %lu\n", - exp->exp_obd->obd_name, exp->exp_client_uuid.uuid, used, + "%s: cli %s/%p used: %lu ungranted: %lu grant: %lu dirty: %lu\n", + exp->exp_obd->obd_name, exp->exp_client_uuid.uuid, exp, used, ungranted, fed->fed_grant, fed->fed_dirty); /* Rough calc in case we don't refresh cached statfs data */ @@ -501,8 +509,8 @@ static int filter_grant_check(struct obd_export *exp, int objcount, exp->exp_obd->obd_osfs.os_bavail = 0; if (fed->fed_dirty < used) { - CERROR("%s: cli %s claims used %lu > fed_dirty %lu\n", - exp->exp_obd->obd_name, exp->exp_client_uuid.uuid, + CERROR("%s: cli %s/%p claims used %lu > fed_dirty %lu\n", + exp->exp_obd->obd_name, exp->exp_client_uuid.uuid, exp, used, fed->fed_dirty); used = fed->fed_dirty; } @@ -668,7 +676,7 @@ int filter_preprw(int cmd, struct obd_export *exp, struct obdo *oa, static int filter_commitrw_read(struct obd_export *exp, struct obdo *oa, int objcount, struct obd_ioobj *obj, int niocount, struct niobuf_local *res, - struct obd_trans_info *oti) + struct obd_trans_info *oti, int rc) { struct obd_ioobj *o; struct niobuf_local *lnb; @@ -692,9 +700,10 @@ static int filter_commitrw_read(struct obd_export *exp, struct obdo *oa, page_cache_release(lnb->page); } } + if (res->dentry != NULL) f_dput(res->dentry); - RETURN(0); + RETURN(rc); } void flip_into_page_cache(struct inode *inode, struct page *new_page) @@ -769,14 +778,14 @@ void filter_grant_commit(struct obd_export *exp, int niocount, int filter_commitrw(int cmd, struct obd_export *exp, struct obdo *oa, int objcount, struct obd_ioobj *obj, int niocount, - struct niobuf_local *res, struct obd_trans_info *oti) + struct niobuf_local *res, struct obd_trans_info *oti,int rc) { if (cmd == OBD_BRW_WRITE) return filter_commitrw_write(exp, oa, objcount, obj, niocount, - res, oti); + res, oti, rc); if (cmd == OBD_BRW_READ) return filter_commitrw_read(exp, oa, objcount, obj, niocount, - res, oti); + res, oti, rc); LBUG(); return -EPROTO; } @@ -826,7 +835,7 @@ int filter_brw(int cmd, struct obd_export *exp, struct obdo *oa, kunmap(pga[i].pg); } - ret = filter_commitrw(cmd, exp, oa, 1, &ioo, oa_bufs, lnb, oti); + ret = filter_commitrw(cmd, exp, oa, 1, &ioo, oa_bufs, lnb, oti, ret); out: if (lnb) diff --git a/lustre/obdfilter/filter_io_24.c b/lustre/obdfilter/filter_io_24.c index 8c0ad36..6ab28db 100644 --- a/lustre/obdfilter/filter_io_24.c +++ b/lustre/obdfilter/filter_io_24.c @@ -225,7 +225,8 @@ static int filter_range_is_mapped(struct inode *inode, obd_size offset, int len) int filter_commitrw_write(struct obd_export *exp, struct obdo *oa, int objcount, struct obd_ioobj *obj, int niocount, - struct niobuf_local *res, struct obd_trans_info *oti) + struct niobuf_local *res, struct obd_trans_info *oti, + int rc) { struct obd_device *obd = exp->exp_obd; struct obd_run_ctxt saved; @@ -234,7 +235,7 @@ int filter_commitrw_write(struct obd_export *exp, struct obdo *oa, int objcount, struct iattr iattr = { 0 }; struct kiobuf *iobuf; struct inode *inode = NULL; - int rc = 0, i, n, cleanup_phase = 0, err; + int i, n, cleanup_phase = 0, err; unsigned long now = jiffies; /* DEBUGGING OST TIMEOUTS */ void *wait_handle; ENTRY; @@ -242,6 +243,9 @@ int filter_commitrw_write(struct obd_export *exp, struct obdo *oa, int objcount, LASSERT(objcount == 1); LASSERT(current->journal_info == NULL); + if (rc != 0) + GOTO(cleanup, rc); + rc = alloc_kiovec(1, &iobuf); if (rc) GOTO(cleanup, rc); diff --git a/lustre/obdfilter/filter_lvb.c b/lustre/obdfilter/filter_lvb.c index 254a3fb..852aeaf 100644 --- a/lustre/obdfilter/filter_lvb.c +++ b/lustre/obdfilter/filter_lvb.c @@ -82,7 +82,9 @@ static int filter_lvbo_init(struct ldlm_resource *res) f_dput(dentry); lvb->lvb_size = dentry->d_inode->i_size; - lvb->lvb_time = LTIME_S(dentry->d_inode->i_mtime); + lvb->lvb_mtime = LTIME_S(dentry->d_inode->i_mtime); + CDEBUG(D_DLMTRACE, "res: "LPU64" initial lvb size: "LPU64", mtime: " + LPU64"\n", res->lr_name.name[0], lvb->lvb_size, lvb->lvb_mtime); out: if (oa) @@ -141,11 +143,11 @@ static int filter_lvbo_update(struct ldlm_resource *res, struct lustre_msg *m, lvb->lvb_size, new->lvb_size); lvb->lvb_size = new->lvb_size; } - if (new->lvb_time > lvb->lvb_time) { - CDEBUG(D_DLMTRACE, "res: "LPU64" updating lvb time: " + if (new->lvb_mtime > lvb->lvb_mtime) { + CDEBUG(D_DLMTRACE, "res: "LPU64" updating lvb mtime: " LPU64" -> "LPU64"\n", res->lr_name.name[0], - lvb->lvb_time, new->lvb_time); - lvb->lvb_time = new->lvb_time; + lvb->lvb_mtime, new->lvb_mtime); + lvb->lvb_mtime = new->lvb_mtime; } GOTO(out, rc = 0); } @@ -169,9 +171,9 @@ static int filter_lvbo_update(struct ldlm_resource *res, struct lustre_msg *m, obdo_from_inode(oa, dentry->d_inode, FILTER_VALID_FLAGS); lvb->lvb_size = dentry->d_inode->i_size; - lvb->lvb_time = LTIME_S(dentry->d_inode->i_mtime); - CDEBUG(D_DLMTRACE, "res: "LPU64" initial lvb size: "LPU64", time: " - LPU64"\n", res->lr_name.name[0], lvb->lvb_size, lvb->lvb_time); + lvb->lvb_mtime = LTIME_S(dentry->d_inode->i_mtime); + CDEBUG(D_DLMTRACE, "res: "LPU64" disk lvb size: "LPU64", mtime: " + LPU64"\n", res->lr_name.name[0], lvb->lvb_size, lvb->lvb_mtime); f_dput(dentry); out: diff --git a/lustre/osc/lproc_osc.c b/lustre/osc/lproc_osc.c index 9216ec0..0492fc6 100644 --- a/lustre/osc/lproc_osc.c +++ b/lustre/osc/lproc_osc.c @@ -170,28 +170,21 @@ int osc_rd_create_low_wm(char *page, char **start, off_t off, int count, int *eof, void *data) { struct obd_device *obd = data; - struct obd_export *exp; - if (obd == NULL || list_empty(&obd->obd_exports)) + if (obd == NULL) return 0; - spin_lock(&obd->obd_dev_lock); - exp = list_entry(obd->obd_exports.next, struct obd_export, - exp_obd_chain); - spin_unlock(&obd->obd_dev_lock); - return snprintf(page, count, "%d\n", - exp->exp_osc_data.oed_oscc.oscc_kick_barrier); + obd->u.cli.cl_oscc.oscc_kick_barrier); } int osc_wr_create_low_wm(struct file *file, const char *buffer, unsigned long count, void *data) { struct obd_device *obd = data; - struct obd_export *exp; int val, rc; - if (obd == NULL || list_empty(&obd->obd_exports)) + if (obd == NULL) return 0; rc = lprocfs_write_helper(buffer, count, &val); @@ -202,9 +195,7 @@ int osc_wr_create_low_wm(struct file *file, const char *buffer, return -ERANGE; spin_lock(&obd->obd_dev_lock); - exp = list_entry(obd->obd_exports.next, struct obd_export, - exp_obd_chain); - exp->exp_osc_data.oed_oscc.oscc_kick_barrier = val; + obd->u.cli.cl_oscc.oscc_kick_barrier = val; spin_unlock(&obd->obd_dev_lock); return count; @@ -214,28 +205,21 @@ int osc_rd_create_count(char *page, char **start, off_t off, int count, int *eof, void *data) { struct obd_device *obd = data; - struct obd_export *exp; - if (obd == NULL || list_empty(&obd->obd_exports)) + if (obd == NULL) return 0; - spin_lock(&obd->obd_dev_lock); - exp = list_entry(obd->obd_exports.next, struct obd_export, - exp_obd_chain); - spin_unlock(&obd->obd_dev_lock); - return snprintf(page, count, "%d\n", - exp->exp_osc_data.oed_oscc.oscc_grow_count); + obd->u.cli.cl_oscc.oscc_grow_count); } int osc_wr_create_count(struct file *file, const char *buffer, unsigned long count, void *data) { struct obd_device *obd = data; - struct obd_export *exp; int val, rc; - if (obd == NULL || list_empty(&obd->obd_exports)) + if (obd == NULL) return 0; rc = lprocfs_write_helper(buffer, count, &val); @@ -245,11 +229,7 @@ int osc_wr_create_count(struct file *file, const char *buffer, if (val < 0) return -ERANGE; - spin_lock(&obd->obd_dev_lock); - exp = list_entry(obd->obd_exports.next, struct obd_export, - exp_obd_chain); - exp->exp_osc_data.oed_oscc.oscc_grow_count = val; - spin_unlock(&obd->obd_dev_lock); + obd->u.cli.cl_oscc.oscc_grow_count = val; return count; } @@ -258,36 +238,24 @@ int osc_rd_prealloc_next_id(char *page, char **start, off_t off, int count, int *eof, void *data) { struct obd_device *obd = data; - struct obd_export *exp; - if (obd == NULL || list_empty(&obd->obd_exports)) + if (obd == NULL) return 0; - spin_lock(&obd->obd_dev_lock); - exp = list_entry(obd->obd_exports.next, struct obd_export, - exp_obd_chain); - spin_unlock(&obd->obd_dev_lock); - return snprintf(page, count, LPU64"\n", - exp->exp_osc_data.oed_oscc.oscc_next_id); + obd->u.cli.cl_oscc.oscc_next_id); } int osc_rd_prealloc_last_id(char *page, char **start, off_t off, int count, int *eof, void *data) { struct obd_device *obd = data; - struct obd_export *exp; - if (obd == NULL || list_empty(&obd->obd_exports)) + if (obd == NULL) return 0; - spin_lock(&obd->obd_dev_lock); - exp = list_entry(obd->obd_exports.next, struct obd_export, - exp_obd_chain); - spin_unlock(&obd->obd_dev_lock); - return snprintf(page, count, LPU64"\n", - exp->exp_osc_data.oed_oscc.oscc_last_id); + obd->u.cli.cl_oscc.oscc_last_id); } static struct lprocfs_vars lprocfs_obd_vars[] = { diff --git a/lustre/osc/osc_create.c b/lustre/osc/osc_create.c index 845b306..6d3b80f 100644 --- a/lustre/osc/osc_create.c +++ b/lustre/osc/osc_create.c @@ -110,7 +110,7 @@ static int oscc_internal_create(struct osc_creator *oscc) oscc->oscc_flags |= OSCC_FLAG_CREATING; spin_unlock(&oscc->oscc_lock); - request = ptlrpc_prep_req(class_exp2cliimp(oscc->oscc_exp), OST_CREATE, + request = ptlrpc_prep_req(oscc->oscc_obd->u.cli.cl_import, OST_CREATE, 1, &size, NULL); if (request == NULL) { spin_lock(&oscc->oscc_lock); @@ -163,8 +163,8 @@ static int oscc_wait_for_objects(struct osc_creator *oscc, int count) ost_full = (oscc->oscc_flags & OSCC_FLAG_NOSPC); spin_unlock(&oscc->oscc_lock); - osc_invalid = class_exp2cliimp(oscc->oscc_exp)->imp_invalid; - + osc_invalid = oscc->oscc_obd->u.cli.cl_import->imp_invalid; + return have_objs || ost_full || osc_invalid; } @@ -186,7 +186,7 @@ static int oscc_precreate(struct osc_creator *oscc, int wait) if (!oscc_has_objects(oscc, 1) && (oscc->oscc_flags & OSCC_FLAG_NOSPC)) rc = -ENOSPC; - if (class_exp2cliimp(oscc->oscc_exp)->imp_invalid) + if (oscc->oscc_obd->u.cli.cl_import->imp_invalid) rc = -EIO; RETURN(rc); @@ -207,7 +207,7 @@ int osc_create(struct obd_export *exp, struct obdo *oa, struct lov_stripe_md **ea, struct obd_trans_info *oti) { struct lov_stripe_md *lsm; - struct osc_creator *oscc = &exp->u.eu_osc_data.oed_oscc; + struct osc_creator *oscc = &exp->exp_obd->u.cli.cl_oscc; int try_again = 1, rc = 0; ENTRY; LASSERT(oa); @@ -236,7 +236,7 @@ int osc_create(struct obd_export *exp, struct obdo *oa, oa->o_valid |= OBD_MD_FLID; oa->o_id = oscc->oscc_next_id - 1; - rc = osc_real_create(oscc->oscc_exp, oa, ea, NULL); + rc = osc_real_create(exp, oa, ea, NULL); spin_lock(&oscc->oscc_lock); if (rc == -ENOSPC) @@ -262,8 +262,10 @@ int osc_create(struct obd_export *exp, struct obdo *oa, rc = l_wait_event(oscc->oscc_waitq, !oscc_recovering(oscc), &lwi); LASSERT(rc == 0 || rc == -ETIMEDOUT); - if (rc == -ETIMEDOUT) + if (rc == -ETIMEDOUT) { + CDEBUG(D_HA, "%p: timed out waiting for recovery\n", oscc); RETURN(rc); + } CDEBUG(D_HA, "%p: oscc recovery over, waking up\n", oscc); } @@ -295,26 +297,27 @@ int osc_create(struct obd_export *exp, struct obdo *oa, RETURN(rc); } -void oscc_init(struct obd_export *exp) +void oscc_init(struct obd_device *obd) { - struct osc_export_data *oed; + struct osc_creator *oscc; - if (exp == NULL) + if (obd == NULL) return; - oed = &exp->exp_osc_data; - memset(oed, 0, sizeof(*oed)); - INIT_LIST_HEAD(&oed->oed_oscc.oscc_list); - init_waitqueue_head(&oed->oed_oscc.oscc_waitq); - spin_lock_init(&oed->oed_oscc.oscc_lock); - oed->oed_oscc.oscc_exp = exp; - oed->oed_oscc.oscc_kick_barrier = 100; - oed->oed_oscc.oscc_grow_count = 2000; - oed->oed_oscc.oscc_initial_create_count = 2000; - - oed->oed_oscc.oscc_next_id = 2; - oed->oed_oscc.oscc_last_id = 1; - oed->oed_oscc.oscc_flags |= OSCC_FLAG_RECOVERING; + oscc = &obd->u.cli.cl_oscc; + + memset(oscc, 0, sizeof(*oscc)); + INIT_LIST_HEAD(&oscc->oscc_list); + init_waitqueue_head(&oscc->oscc_waitq); + spin_lock_init(&oscc->oscc_lock); + oscc->oscc_obd = obd; + oscc->oscc_kick_barrier = 100; + oscc->oscc_grow_count = 2000; + oscc->oscc_initial_create_count = 2000; + + oscc->oscc_next_id = 2; + oscc->oscc_last_id = 1; + oscc->oscc_flags |= OSCC_FLAG_RECOVERING; /* XXX the export handle should give the oscc the last object */ /* oed->oed_oscc.oscc_last_id = exph->....; */ } diff --git a/lustre/osc/osc_internal.h b/lustre/osc/osc_internal.h index ae3e010..f011d0e 100644 --- a/lustre/osc/osc_internal.h +++ b/lustre/osc/osc_internal.h @@ -59,7 +59,7 @@ int osc_create(struct obd_export *exp, struct obdo *oa, struct lov_stripe_md **ea, struct obd_trans_info *oti); int osc_real_create(struct obd_export *exp, struct obdo *oa, struct lov_stripe_md **ea, struct obd_trans_info *oti); -void oscc_init(struct obd_export *exp); +void oscc_init(struct obd_device *obd); void osc_wake_cache_waiters(struct client_obd *cli); #ifdef __KERNEL__ diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index b0686b3..6858fe1 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -340,8 +340,7 @@ int osc_real_create(struct obd_export *exp, struct obdo *oa, LASSERT((oa->o_valid & OBD_MD_FLFLAGS) && oa->o_flags == OBD_FL_DELORPHAN); DEBUG_REQ(D_HA, request, - "delorphan from OST integration; level == RECOVER"); - request->rq_send_state = LUSTRE_IMP_RECOVER; + "delorphan from OST integration"); } rc = ptlrpc_queue_wait(request); @@ -1995,9 +1994,6 @@ static int osc_trigger_group_io(struct obd_export *exp, struct client_obd *cli = &exp->exp_obd->u.cli; ENTRY; - if (cli->cl_import == NULL || cli->cl_import->imp_invalid) - RETURN(-EIO); - if (loi == NULL) loi = &lsm->lsm_oinfo[0]; @@ -2432,8 +2428,10 @@ static int osc_enqueue(struct obd_export *exp, struct lov_stripe_md *lsm, policy, mode, flags, bl_cb, cp_cb, gl_cb, data, &lvb, sizeof(lvb), lustre_swab_ost_lvb, lockh); - if ((*flags & LDLM_FL_HAS_INTENT && rc == ELDLM_LOCK_ABORTED) || !rc) + if ((*flags & LDLM_FL_HAS_INTENT && rc == ELDLM_LOCK_ABORTED) || !rc) { + CDEBUG(D_INODE, "received kms == "LPU64"\n", lvb.lvb_size); lsm->lsm_oinfo->loi_rss = lvb.lvb_size; + } RETURN(rc); } @@ -2467,7 +2465,7 @@ static int osc_match(struct obd_export *exp, struct lov_stripe_md *lsm, if (mode == LCK_PR) { rc = ldlm_lock_match(obd->obd_namespace, *flags, &res_id, type, policy, LCK_PW, lockh); - if (rc == 1) { + if (rc == 1 && !(*flags & LDLM_FL_TEST_LOCK)) { /* FIXME: This is not incredibly elegant, but it might * be more elegant than adding another parameter to * lock_match. I want a second opinion. */ @@ -2708,6 +2706,7 @@ static int osc_set_info(struct obd_export *exp, obd_count keylen, void *key, obd_count vallen, void *val) { struct ptlrpc_request *req; + struct obd_device *obd = exp->exp_obd; struct obd_import *imp = class_exp2cliimp(exp); struct llog_ctxt *ctxt; int rc, size = keylen; @@ -2718,10 +2717,10 @@ static int osc_set_info(struct obd_export *exp, obd_count keylen, memcmp(key, "next_id", strlen("next_id")) == 0) { if (vallen != sizeof(obd_id)) RETURN(-EINVAL); - exp->u.eu_osc_data.oed_oscc.oscc_next_id = *((obd_id*)val) + 1; + obd->u.cli.cl_oscc.oscc_next_id = *((obd_id*)val) + 1; CDEBUG(D_INODE, "%s: set oscc_next_id = "LPU64"\n", exp->exp_obd->obd_name, - exp->u.eu_osc_data.oed_oscc.oscc_next_id); + obd->u.cli.cl_oscc.oscc_next_id); RETURN(0); } @@ -2730,13 +2729,13 @@ static int osc_set_info(struct obd_export *exp, obd_count keylen, memcmp(key, "growth_count", strlen("growth_count")) == 0) { if (vallen != sizeof(int)) RETURN(-EINVAL); - exp->u.eu_osc_data.oed_oscc.oscc_grow_count = *((int*)val); + obd->u.cli.cl_oscc.oscc_grow_count = *((int*)val); RETURN(0); } if (keylen == strlen("unlinked") && memcmp(key, "unlinked", keylen) == 0) { - struct osc_creator *oscc = &exp->u.eu_osc_data.oed_oscc; + struct osc_creator *oscc = &obd->u.cli.cl_oscc; spin_lock(&oscc->oscc_lock); oscc->oscc_flags &= ~OSCC_FLAG_NOSPC; spin_unlock(&oscc->oscc_lock); @@ -2778,7 +2777,7 @@ static int osc_set_info(struct obd_export *exp, obd_count keylen, imp->imp_server_timeout = 1; CDEBUG(D_HA, "pinging OST %s\n", imp->imp_target_uuid.uuid); - ptlrpc_pinger_add_import(imp); + imp->imp_pingable = 1; RETURN(rc); } @@ -2790,7 +2789,7 @@ static struct llog_operations osc_size_repl_logops = { static struct llog_operations osc_unlink_orig_logops; static int osc_llog_init(struct obd_device *obd, struct obd_device *tgt, - int count, struct llog_logid *logid) + int count, struct llog_catid *catid) { int rc; ENTRY; @@ -2801,8 +2800,8 @@ static int osc_llog_init(struct obd_device *obd, struct obd_device *tgt, osc_unlink_orig_logops.lop_add = llog_obd_origin_add; osc_unlink_orig_logops.lop_connect = llog_origin_connect; - rc = llog_setup(obd, LLOG_UNLINK_ORIG_CTXT, tgt, count, logid, - &osc_unlink_orig_logops); + rc = llog_setup(obd, LLOG_UNLINK_ORIG_CTXT, tgt, count, + &catid->lci_logid, &osc_unlink_orig_logops); if (rc) RETURN(rc); @@ -2829,15 +2828,9 @@ static int osc_connect(struct lustre_handle *exph, struct obd_device *obd, struct obd_uuid *cluuid) { int rc; - struct obd_export *exp; rc = client_connect_import(exph, obd, cluuid); - if (obd->u.cli.cl_conn_count == 1) { - exp = class_conn2export(exph); - oscc_init(exp); - } - return rc; } @@ -2847,36 +2840,66 @@ static int osc_disconnect(struct obd_export *exp, int flags) struct llog_ctxt *ctxt = llog_get_context(obd, LLOG_SIZE_REPL_CTXT); int rc; - if (obd->u.cli.cl_conn_count == 1) { + if (obd->u.cli.cl_conn_count == 1) /* flush any remaining cancel messages out to the target */ llog_sync(ctxt, exp); - /* balance the conn2export for oscc in osc_connect */ - class_export_put(exp); - } - rc = client_disconnect_export(exp, flags); return rc; } -static int osc_invalidate_import(struct obd_device *obd, - struct obd_import *imp) +static int osc_import_event(struct obd_device *obd, + struct obd_import *imp, + enum obd_import_event event) { struct client_obd *cli; + int rc = 0; + LASSERT(imp->imp_obd == obd); - /* this used to try and tear down queued pages, but it was - * not correctly implemented. We'll have to do it again once - * we call obd_invalidate_import() agian */ - /* XXX And we still need to do this */ - /* Reset grants, too */ - cli = &obd->u.cli; - spin_lock(&cli->cl_loi_list_lock); - cli->cl_avail_grant = 0; - cli->cl_lost_grant = 0; - spin_unlock(&cli->cl_loi_list_lock); + switch (event) { + case IMP_EVENT_DISCON: { + /* Only do this on the MDS OSC's */ + if (imp->imp_server_timeout) { + struct osc_creator *oscc = &obd->u.cli.cl_oscc; + + spin_lock(&oscc->oscc_lock); + oscc->oscc_flags |= OSCC_FLAG_RECOVERING; + spin_unlock(&oscc->oscc_lock); + } + break; + } + case IMP_EVENT_INVALIDATE: { + struct ldlm_namespace *ns = obd->obd_namespace; - RETURN(0); + /* this used to try and tear down queued pages, but it was + * not correctly implemented. We'll have to do it again once + * we call obd_invalidate_import() agian */ + /* XXX And we still need to do this */ + + /* Reset grants, too */ + cli = &obd->u.cli; + spin_lock(&cli->cl_loi_list_lock); + cli->cl_avail_grant = 0; + cli->cl_lost_grant = 0; + spin_unlock(&cli->cl_loi_list_lock); + + ldlm_namespace_cleanup(ns, LDLM_FL_LOCAL_ONLY); + + if (obd->obd_observer) + rc = obd_notify(obd->obd_observer, obd, 0); + break; + } + case IMP_EVENT_ACTIVE: { + if (obd->obd_observer) + rc = obd_notify(obd->obd_observer, obd, 1); + break; + } + default: + CERROR("Unknown import event %d\n", event); + LBUG(); + } + RETURN(rc); } int osc_setup(struct obd_device *obd, obd_count len, void *buf) @@ -2890,6 +2913,9 @@ int osc_setup(struct obd_device *obd, obd_count len, void *buf) rc = client_obd_setup(obd, len, buf); if (rc) ptlrpcd_decref(); + else + oscc_init(obd); + RETURN(rc); } @@ -2937,7 +2963,7 @@ struct obd_ops osc_obd_ops = { o_iocontrol: osc_iocontrol, o_get_info: osc_get_info, o_set_info: osc_set_info, - o_invalidate_import: osc_invalidate_import, + o_import_event: osc_import_event, o_llog_init: osc_llog_init, o_llog_finish: osc_llog_finish, }; @@ -2968,7 +2994,7 @@ struct obd_ops sanosc_obd_ops = { o_cancel: osc_cancel, o_cancel_unused:osc_cancel_unused, o_iocontrol: osc_iocontrol, - o_invalidate_import: osc_invalidate_import, + o_import_event: osc_import_event, o_llog_init: osc_llog_init, o_llog_finish: osc_llog_finish, }; diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c index fe6a6da..3771ded 100644 --- a/lustre/ost/ost_handler.c +++ b/lustre/ost/ost_handler.c @@ -442,7 +442,7 @@ static int ost_brw_read(struct ptlrpc_request *req) if (page_rc != 0) { /* some data! */ LASSERT (local_nb[i].page != NULL); ptlrpc_prep_bulk_page(desc, local_nb[i].page, - pp_rnb[i].offset & (PAGE_SIZE - 1), + pp_rnb[i].offset & (PAGE_SIZE-1), page_rc); } @@ -468,9 +468,9 @@ static int ost_brw_read(struct ptlrpc_request *req) } else if (!desc->bd_success || desc->bd_nob_transferred != desc->bd_nob) { DEBUG_REQ(D_ERROR, req, "%s bulk PUT %d(%d)", - desc->bd_success ? + desc->bd_success ? "truncated" : "network error on", - desc->bd_nob_transferred, + desc->bd_nob_transferred, desc->bd_nob); /* XXX should this be a different errno? */ rc = -ETIMEDOUT; @@ -483,7 +483,7 @@ static int ost_brw_read(struct ptlrpc_request *req) /* Must commit after prep above in all cases */ rc = obd_commitrw(OBD_BRW_READ, req->rq_export, &body->oa, 1, - ioo, npages, local_nb, &oti); + ioo, npages, local_nb, &oti, rc); if (rc == 0) { repbody = lustre_msg_buf(req->rq_repmsg, 0, sizeof(*repbody)); @@ -553,7 +553,7 @@ static int ost_brw_write(struct ptlrpc_request *req, struct obd_trans_info *oti) int size[2] = { sizeof(*body) }; int objcount, niocount, npages; int comms_error = 0; - int rc, rc2, swab, i, j; + int rc, swab, i, j; char str[PTL_NALFMT_SIZE]; ENTRY; @@ -685,8 +685,8 @@ static int ost_brw_write(struct ptlrpc_request *req, struct obd_trans_info *oti) } #endif /* Must commit after prep above in all cases */ - rc2 = obd_commitrw(OBD_BRW_WRITE, req->rq_export, &repbody->oa, - objcount, ioo, npages, local_nb, oti); + rc = obd_commitrw(OBD_BRW_WRITE, req->rq_export, &repbody->oa, + objcount, ioo, npages, local_nb, oti, rc); if (rc == 0) { /* set per-requested niobuf return codes */ @@ -705,8 +705,6 @@ static int ost_brw_write(struct ptlrpc_request *req, struct obd_trans_info *oti) } LASSERT(j == npages); } - if (rc == 0) - rc = rc2; out_bulk: ptlrpc_free_bulk(desc); diff --git a/lustre/portals/include/linux/kp30.h b/lustre/portals/include/linux/kp30.h index 53828de..c080a57 100644 --- a/lustre/portals/include/linux/kp30.h +++ b/lustre/portals/include/linux/kp30.h @@ -21,57 +21,57 @@ extern unsigned int portal_debug; extern unsigned int portal_printk; extern unsigned int portal_cerror; /* Debugging subsystems (32 bits, non-overlapping) */ -#define S_UNDEFINED (1 << 0) -#define S_MDC (1 << 1) -#define S_MDS (1 << 2) -#define S_OSC (1 << 3) -#define S_OST (1 << 4) -#define S_CLASS (1 << 5) -#define S_LOG (1 << 6) -#define S_LLITE (1 << 7) -#define S_RPC (1 << 8) -#define S_MGMT (1 << 9) -#define S_PORTALS (1 << 10) -#define S_SOCKNAL (1 << 11) -#define S_QSWNAL (1 << 12) -#define S_PINGER (1 << 13) -#define S_FILTER (1 << 14) -#define S_PTLBD (1 << 15) -#define S_ECHO (1 << 16) -#define S_LDLM (1 << 17) -#define S_LOV (1 << 18) -#define S_GMNAL (1 << 19) -#define S_PTLROUTER (1 << 20) -#define S_COBD (1 << 21) -#define S_IBNAL (1 << 22) +#define S_UNDEFINED 0x00000001 +#define S_MDC 0x00000002 +#define S_MDS 0x00000004 +#define S_OSC 0x00000008 +#define S_OST 0x00000010 +#define S_CLASS 0x00000020 +#define S_LOG 0x00000040 +#define S_LLITE 0x00000080 +#define S_RPC 0x00000100 +#define S_MGMT 0x00000200 +#define S_PORTALS 0x00000400 +#define S_SOCKNAL 0x00000800 +#define S_QSWNAL 0x00001000 +#define S_PINGER 0x00002000 +#define S_FILTER 0x00004000 +#define S_PTLBD 0x00008000 +#define S_ECHO 0x00010000 +#define S_LDLM 0x00020000 +#define S_LOV 0x00040000 +#define S_GMNAL 0x00080000 +#define S_PTLROUTER 0x00100000 +#define S_COBD 0x00200000 +#define S_IBNAL 0x00400000 /* If you change these values, please keep portals/utils/debug.c * up to date! */ /* Debugging masks (32 bits, non-overlapping) */ -#define D_TRACE (1 << 0) /* ENTRY/EXIT markers */ -#define D_INODE (1 << 1) -#define D_SUPER (1 << 2) -#define D_EXT2 (1 << 3) /* anything from ext2_debug */ -#define D_MALLOC (1 << 4) /* print malloc, free information */ -#define D_CACHE (1 << 5) /* cache-related items */ -#define D_INFO (1 << 6) /* general information */ -#define D_IOCTL (1 << 7) /* ioctl related information */ -#define D_BLOCKS (1 << 8) /* ext2 block allocation */ -#define D_NET (1 << 9) /* network communications */ -#define D_WARNING (1 << 10) /* CWARN(...) == CDEBUG (D_WARNING, ...) */ -#define D_BUFFS (1 << 11) -#define D_OTHER (1 << 12) -#define D_DENTRY (1 << 13) -#define D_PORTALS (1 << 14) /* ENTRY/EXIT markers */ -#define D_PAGE (1 << 15) /* bulk page handling */ -#define D_DLMTRACE (1 << 16) -#define D_ERROR (1 << 17) /* CERROR(...) == CDEBUG (D_ERROR, ...) */ -#define D_EMERG (1 << 18) /* CEMERG(...) == CDEBUG (D_EMERG, ...) */ -#define D_HA (1 << 19) /* recovery and failover */ -#define D_RPCTRACE (1 << 20) /* for distributed debugging */ -#define D_VFSTRACE (1 << 21) -#define D_READA (1 << 22) /* read-ahead */ +#define D_TRACE 0x00000001 /* ENTRY/EXIT markers */ +#define D_INODE 0x00000002 +#define D_SUPER 0x00000004 +#define D_EXT2 0x00000008 /* anything from ext2_debug */ +#define D_MALLOC 0x00000010 /* print malloc, free information */ +#define D_CACHE 0x00000020 /* cache-related items */ +#define D_INFO 0x00000040 /* general information */ +#define D_IOCTL 0x00000080 /* ioctl related information */ +#define D_BLOCKS 0x00000100 /* ext2 block allocation */ +#define D_NET 0x00000200 /* network communications */ +#define D_WARNING 0x00000400 /* CWARN(...) == CDEBUG (D_WARNING, ...) */ +#define D_BUFFS 0x00000800 +#define D_OTHER 0x00001000 +#define D_DENTRY 0x00002000 +#define D_PORTALS 0x00004000 /* ENTRY/EXIT markers */ +#define D_PAGE 0x00008000 /* bulk page handling */ +#define D_DLMTRACE 0x00010000 +#define D_ERROR 0x00020000 /* CERROR(...) == CDEBUG (D_ERROR, ...) */ +#define D_EMERG 0x00040000 /* CEMERG(...) == CDEBUG (D_EMERG, ...) */ +#define D_HA 0x00080000 /* recovery and failover */ +#define D_RPCTRACE 0x00100000 /* for distributed debugging */ +#define D_VFSTRACE 0x00200000 +#define D_READA 0x00400000 /* read-ahead */ #ifdef __KERNEL__ # include /* THREAD_SIZE */ @@ -234,6 +234,12 @@ extern void kportal_assertion_failed(char *expr, char *file, const char *func, #define LASSERTF(cond, fmt...) do { } while (0) #endif +#ifdef CONFIG_SMP +#define LASSERT_SPIN_LOCKED(lock) LASSERT(spin_is_locked(lock)) +#else +#define LASSERT_SPIN_LOCKED(lock) do {} while(0) +#endif + #ifdef __arch_um__ #define LBUG_WITH_LOC(file, func, line) \ do { \ diff --git a/lustre/portals/knals/socknal/socknal_cb.c b/lustre/portals/knals/socknal/socknal_cb.c index 72bd0b7..c89e20e 100644 --- a/lustre/portals/knals/socknal/socknal_cb.c +++ b/lustre/portals/knals/socknal/socknal_cb.c @@ -760,19 +760,19 @@ ksocknal_find_target_peer_locked (ksock_tx_t *tx, ptl_nid_t nid) } ksock_conn_t * -ksocknal_find_conn_locked (ksock_tx_t *tx, ksock_peer_t *peer) +ksocknal_find_conn_locked (ksock_tx_t *tx, ksock_peer_t *peer) { struct list_head *tmp; ksock_conn_t *typed = NULL; int tnob = 0; ksock_conn_t *fallback = NULL; int fnob = 0; - + /* Find the conn with the shortest tx queue */ list_for_each (tmp, &peer->ksnp_conns) { ksock_conn_t *c = list_entry(tmp, ksock_conn_t, ksnc_list); int nob = atomic_read(&c->ksnc_tx_nob) + - c->ksnc_sock->sk->sk_wmem_queued; + c->ksnc_sock->sk->sk_wmem_queued; LASSERT (!c->ksnc_closing); diff --git a/lustre/portals/portals/api-init.c b/lustre/portals/portals/api-init.c index b811391..e2921ac 100644 --- a/lustre/portals/portals/api-init.c +++ b/lustre/portals/portals/api-init.c @@ -29,7 +29,7 @@ int ptl_init; unsigned int portal_subsystem_debug = ~0 - (S_PORTALS | S_QSWNAL | S_SOCKNAL | S_GMNAL | S_IBNAL); unsigned int portal_debug = (D_WARNING | D_DLMTRACE | D_ERROR | D_EMERG | D_HA | - D_RPCTRACE | D_VFSTRACE); + D_RPCTRACE | D_VFSTRACE | D_MALLOC); unsigned int portal_cerror = 1; unsigned int portal_printk; unsigned int portal_stack; diff --git a/lustre/portals/unals/procapi.c b/lustre/portals/unals/procapi.c index bddfe9a..c27f555 100644 --- a/lustre/portals/unals/procapi.c +++ b/lustre/portals/unals/procapi.c @@ -71,7 +71,7 @@ void procbridge_wakeup_nal(procbridge p) * side, and collects the result */ static int procbridge_forward(nal_t *n, int id, void *args, size_t args_len, - void *ret, ptl_size_t ret_len) + void *ret, size_t ret_len) { bridge b = (bridge) n->nal_data; diff --git a/lustre/portals/utils/debug.c b/lustre/portals/utils/debug.c index 2ca4dc3..01e690f 100644 --- a/lustre/portals/utils/debug.c +++ b/lustre/portals/utils/debug.c @@ -66,7 +66,8 @@ static int debug_mask = ~0; static const char *portal_debug_subsystems[] = {"undefined", "mdc", "mds", "osc", "ost", "class", "log", "llite", "rpc", "mgmt", "portals", "socknal", "qswnal", "pinger", "filter", - "ptlbd", "echo", "ldlm", "lov", "gmnal", "router", "cobd", NULL}; + "ptlbd", "echo", "ldlm", "lov", "gmnal", "router", "cobd", "ibnal", + NULL}; static const char *portal_debug_masks[] = {"trace", "inode", "super", "ext2", "malloc", "cache", "info", "ioctl", "blocks", "net", "warning", "buffs", "other", "dentry", "portals", diff --git a/lustre/ptlrpc/client.c b/lustre/ptlrpc/client.c index eac0e99..8dc4ad0 100644 --- a/lustre/ptlrpc/client.c +++ b/lustre/ptlrpc/client.c @@ -383,7 +383,8 @@ static int ptlrpc_import_delay_req(struct obd_import *imp, *status = -EIO; } else if (req->rq_send_state != imp->imp_state) { - if (imp->imp_obd->obd_no_recov || imp->imp_dlm_fake) + if (imp->imp_obd->obd_no_recov || imp->imp_dlm_fake + || req->rq_no_delay) *status = -EWOULDBLOCK; else delay = 1; @@ -546,9 +547,13 @@ static int ptlrpc_send_new_req(struct ptlrpc_request *req) req->rq_waiting = 1; spin_unlock (&req->rq_lock); + DEBUG_REQ(D_HA, req, "req from PID %d waiting for recovery: " + "(%s != %s)", + req->rq_reqmsg->status, + ptlrpc_import_state_name(req->rq_send_state), + ptlrpc_import_state_name(imp->imp_state)); LASSERT(list_empty (&req->rq_list)); - // list_del(&req->rq_list); list_add_tail(&req->rq_list, &imp->imp_delayed_list); spin_unlock_irqrestore(&imp->imp_lock, flags); RETURN(0); @@ -1055,9 +1060,7 @@ void ptlrpc_free_req(struct ptlrpc_request *request) static int __ptlrpc_req_finished(struct ptlrpc_request *request, int locked); void ptlrpc_req_finished_with_imp_lock(struct ptlrpc_request *request) { -#ifdef CONFIG_SMP - LASSERT(spin_is_locked(&request->rq_import->imp_lock)); -#endif + LASSERT_SPIN_LOCKED(&request->rq_import->imp_lock); (void)__ptlrpc_req_finished(request, 1); } @@ -1142,9 +1145,7 @@ void ptlrpc_free_committed(struct obd_import *imp) LASSERT(imp != NULL); -#ifdef CONFIG_SMP - LASSERT(spin_is_locked(&imp->imp_lock)); -#endif + LASSERT_SPIN_LOCKED(&imp->imp_lock); CDEBUG(D_HA, "%s: committing for last_committed "LPU64"\n", imp->imp_obd->obd_name, imp->imp_peer_committed_transno); @@ -1213,7 +1214,6 @@ void ptlrpc_resend_req(struct ptlrpc_request *req) } ptlrpc_wake_client_req(req); spin_unlock_irqrestore (&req->rq_lock, flags); - } /* XXX: this function and rq_status are currently unused */ @@ -1262,9 +1262,7 @@ void ptlrpc_retain_replayable_request(struct ptlrpc_request *req, { struct list_head *tmp; -#ifdef CONFIG_SMP - LASSERT(spin_is_locked(&imp->imp_lock)); -#endif + LASSERT_SPIN_LOCKED(&imp->imp_lock); /* don't re-add requests that have been replayed */ if (!list_empty(&req->rq_replay_list)) diff --git a/lustre/ptlrpc/events.c b/lustre/ptlrpc/events.c index 6ba3909..b1f8221 100644 --- a/lustre/ptlrpc/events.c +++ b/lustre/ptlrpc/events.c @@ -228,7 +228,6 @@ void request_in_callback(ptl_event_t *ev) list_add_tail(&req->rq_list, &service->srv_request_queue); service->srv_n_queued_reqs++; - rqbd->rqbd_eventcount++; /* NB everything can disappear under us once the request * has been queued and we unlock, so do the wake now... */ diff --git a/lustre/ptlrpc/import.c b/lustre/ptlrpc/import.c index b32eb2b..dece441 100644 --- a/lustre/ptlrpc/import.c +++ b/lustre/ptlrpc/import.c @@ -102,26 +102,81 @@ int ptlrpc_set_import_discon(struct obd_import *imp) if (imp->imp_state == LUSTRE_IMP_FULL) { IMPORT_SET_STATE_NOLOCK(imp, LUSTRE_IMP_DISCON); + spin_unlock_irqrestore(&imp->imp_lock, flags); + obd_import_event(imp->imp_obd, imp, IMP_EVENT_DISCON); rc = 1; } else { + spin_unlock_irqrestore(&imp->imp_lock, flags); CDEBUG(D_HA, "%p %s: import already not connected: %s\n", imp,imp->imp_client->cli_name, ptlrpc_import_state_name(imp->imp_state)); } - spin_unlock_irqrestore(&imp->imp_lock, flags); return rc; } +void ptlrpc_invalidate_import(struct obd_import *imp) +{ + struct obd_device *obd = imp->imp_obd; + unsigned long flags; + ENTRY; + + spin_lock_irqsave(&imp->imp_lock, flags); + /* This is a bit of a hack, but invalidating replayable + * imports makes a temporary reconnect failure into a much more + * ugly -- and hard to remedy -- situation. */ + if (!imp->imp_replayable) { + CDEBUG(D_HA, "setting import %s INVALID\n", + imp->imp_target_uuid.uuid); + imp->imp_invalid = 1; + } + imp->imp_generation++; + spin_unlock_irqrestore(&imp->imp_lock, flags); + + ptlrpc_abort_inflight(imp); + obd_import_event(obd, imp, IMP_EVENT_INVALIDATE); +} + +void ptlrpc_validate_import(struct obd_import *imp) +{ + struct obd_device *obd = imp->imp_obd; + unsigned long flags; + + spin_lock_irqsave(&imp->imp_lock, flags); + imp->imp_invalid = 0; + spin_unlock_irqrestore(&imp->imp_lock, flags); + + obd_import_event(obd, imp, IMP_EVENT_ACTIVE); +} + void ptlrpc_fail_import(struct obd_import *imp, int generation) { ENTRY; LASSERT (!imp->imp_dlm_fake); - if (ptlrpc_set_import_discon(imp)) - ptlrpc_handle_failed_import(imp); + if (ptlrpc_set_import_discon(imp)) { + unsigned long flags; + if (!imp->imp_replayable) { + CDEBUG(D_HA, "import %s@%s for %s not replayable, " + "auto-deactivating\n", + imp->imp_target_uuid.uuid, + imp->imp_connection->c_remote_uuid.uuid, + imp->imp_obd->obd_name); + ptlrpc_invalidate_import(imp); + } + + CDEBUG(D_HA, "%s: waking up pinger\n", + imp->imp_target_uuid.uuid); + + spin_lock_irqsave(&imp->imp_lock, flags); + imp->imp_force_verify = 1; + spin_unlock_irqrestore(&imp->imp_lock, flags); + + ptlrpc_pinger_wake_up(); + + } EXIT; } @@ -270,8 +325,7 @@ static int ptlrpc_connect_interpret(struct ptlrpc_request *request, if (msg_flags & MSG_CONNECT_REPLAYABLE) { CDEBUG(D_HA, "connected to replayable target: %s\n", imp->imp_target_uuid.uuid); - imp->imp_replayable = 1; - ptlrpc_pinger_add_import(imp); + imp->imp_pingable = imp->imp_replayable = 1; } else { imp->imp_replayable = 0; } @@ -338,9 +392,8 @@ static int ptlrpc_connect_interpret(struct ptlrpc_request *request, finish: rc = ptlrpc_import_recovery_state_machine(imp); if (rc != 0) { - if (aa->pcaa_was_invalid) { - ptlrpc_set_import_active(imp, 0); - } + if (aa->pcaa_was_invalid) + ptlrpc_invalidate_import(imp); if (rc == -ENOTCONN) { CDEBUG(D_HA, "evicted/aborted by %s@%s during recovery;" @@ -355,17 +408,13 @@ finish: if (rc != 0) { IMPORT_SET_STATE(imp, LUSTRE_IMP_DISCON); if (aa->pcaa_initial_connect && !imp->imp_initial_recov) { - ptlrpc_set_import_active(imp, 0); - GOTO(norecov, rc); + ptlrpc_invalidate_import(imp); } - CDEBUG(D_ERROR, - "recovery of %s on %s failed (%d); restarting\n", + CDEBUG(D_ERROR, "recovery of %s on %s failed (%d)\n", imp->imp_target_uuid.uuid, (char *)imp->imp_connection->c_remote_uuid.uuid, rc); - ptlrpc_handle_failed_import(imp); } -norecov: wake_up(&imp->imp_recovery_waitq); RETURN(rc); } @@ -410,7 +459,7 @@ int ptlrpc_import_recovery_state_machine(struct obd_import *imp) CDEBUG(D_HA, "evicted from %s@%s; invalidating\n", imp->imp_target_uuid.uuid, imp->imp_connection->c_remote_uuid.uuid); - ptlrpc_set_import_active(imp, 0); + ptlrpc_invalidate_import(imp); IMPORT_SET_STATE(imp, LUSTRE_IMP_RECOVER); } @@ -449,11 +498,11 @@ int ptlrpc_import_recovery_state_machine(struct obd_import *imp) imp->imp_target_uuid.uuid, imp->imp_connection->c_remote_uuid.uuid); - ptlrpc_set_import_active(imp, 1); rc = ptlrpc_resend(imp); if (rc) GOTO(out, rc); IMPORT_SET_STATE(imp, LUSTRE_IMP_FULL); + ptlrpc_validate_import(imp); } if (imp->imp_state == LUSTRE_IMP_FULL) { @@ -509,8 +558,9 @@ int ptlrpc_disconnect_import(struct obd_import *imp) /* For non-replayable connections, don't attempt reconnect if this fails */ if (!imp->imp_replayable) { - IMPORT_SET_STATE(imp, LUSTRE_IMP_DISCON); - request->rq_send_state = LUSTRE_IMP_DISCON; + request->rq_no_resend = 1; + IMPORT_SET_STATE(imp, LUSTRE_IMP_CONNECTING); + request->rq_send_state = LUSTRE_IMP_CONNECTING; } request->rq_replen = lustre_msg_size(0, NULL); rc = ptlrpc_queue_wait(request); diff --git a/lustre/ptlrpc/llog_client.c b/lustre/ptlrpc/llog_client.c index 8accba6..d34e5e2 100644 --- a/lustre/ptlrpc/llog_client.c +++ b/lustre/ptlrpc/llog_client.c @@ -194,7 +194,7 @@ static int llog_client_read_header(struct llog_handle *handle) GOTO(out, rc =-EFAULT); } memcpy(handle->lgh_hdr, hdr, sizeof (*hdr)); - handle->lgh_last_idx = le32_to_cpu(handle->lgh_hdr->llh_tail.lrt_index); + handle->lgh_last_idx = handle->lgh_hdr->llh_tail.lrt_index; out: if (req) diff --git a/lustre/ptlrpc/llog_net.c b/lustre/ptlrpc/llog_net.c index cdd70e2..17be7dd 100644 --- a/lustre/ptlrpc/llog_net.c +++ b/lustre/ptlrpc/llog_net.c @@ -45,7 +45,8 @@ #ifdef __KERNEL__ int llog_origin_connect(struct llog_ctxt *ctxt, int count, - struct llog_logid *logid, struct llog_gen *gen) + struct llog_logid *logid, struct llog_gen *gen, + struct obd_uuid *uuid) { struct llog_gen_rec *lgr; struct obd_import *imp; @@ -108,7 +109,7 @@ int llog_handle_connect(struct ptlrpc_request *req) ctxt = llog_get_context(obd, req_body->lgdc_ctxt_idx); rc = llog_connect(ctxt, 1, &req_body->lgdc_logid, - &req_body->lgdc_gen); + &req_body->lgdc_gen, NULL); if (rc != 0) CERROR("failed at llog_relp_connect\n"); diff --git a/lustre/ptlrpc/llog_server.c b/lustre/ptlrpc/llog_server.c index a15f67c..4236519 100644 --- a/lustre/ptlrpc/llog_server.c +++ b/lustre/ptlrpc/llog_server.c @@ -185,7 +185,6 @@ int llog_origin_handle_read_header(struct ptlrpc_request *req) struct obd_run_ctxt saved; struct llog_ctxt *ctxt; __u32 flags; - __u8 *buf; int size[] = {sizeof (*hdr)}; int rc, rc2; ENTRY; @@ -197,10 +196,6 @@ int llog_origin_handle_read_header(struct ptlrpc_request *req) GOTO(out, rc =-EFAULT); } - OBD_ALLOC(buf, LLOG_CHUNK_SIZE); - if (!buf) - GOTO(out, rc = -ENOMEM); - ctxt = llog_get_context(obd, body->lgd_ctxt_idx); LASSERT(ctxt != NULL); disk_obd = ctxt->loc_exp->exp_obd; @@ -216,7 +211,6 @@ int llog_origin_handle_read_header(struct ptlrpc_request *req) if (rc) GOTO(out_close, rc); - rc = lustre_pack_reply(req, 1, size, NULL); if (rc) GOTO(out_close, rc = -ENOMEM); @@ -231,7 +225,6 @@ out_close: out_pop: pop_ctxt(&saved, &disk_obd->obd_ctxt, NULL); - OBD_FREE(buf, LLOG_CHUNK_SIZE); out: RETURN(rc); @@ -387,7 +380,7 @@ static int llog_catinfo_cb(struct llog_handle *cat, } ctxt = cbd->ctxt; - if (!(cat->lgh_hdr->llh_flags & cpu_to_le32(LLOG_F_IS_CAT))) + if (!(cat->lgh_hdr->llh_flags & LLOG_F_IS_CAT)) RETURN(-EINVAL); lir = (struct llog_logid_rec *)rec; @@ -431,8 +424,9 @@ static int llog_catinfo_deletions(struct obd_device *obd, char *buf, struct llog_handle *handle; struct obd_run_ctxt saved; int size, i, count; - struct llog_logid *idarray, *id; - char name[32] = "CATLIST"; + struct llog_catid *idarray; + struct llog_logid *id; + char name[32] = CATLIST; int rc; struct cb_data data; struct llog_ctxt *ctxt = llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT); @@ -446,7 +440,6 @@ static int llog_catinfo_deletions(struct obd_device *obd, char *buf, OBD_ALLOC(idarray, size); if (!idarray) RETURN(-ENOMEM); - memset(idarray, 0, size); rc = llog_get_cat_list(obd, obd, name, count, idarray); if (rc) @@ -454,12 +447,13 @@ static int llog_catinfo_deletions(struct obd_device *obd, char *buf, push_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_ctxt, NULL); - id = idarray; data.ctxt = ctxt; data.out = buf; data.remains = buf_len; for (i = 0; i < count; i++) { int l, index, uncanceled = 0; + + id = &idarray[i].lci_logid; rc = llog_create(ctxt, &handle, id, NULL); if (rc) GOTO(out_pop, rc); diff --git a/lustre/ptlrpc/niobuf.c b/lustre/ptlrpc/niobuf.c index c25db89..29b4e36 100644 --- a/lustre/ptlrpc/niobuf.c +++ b/lustre/ptlrpc/niobuf.c @@ -438,10 +438,8 @@ int ptl_send_rpc(struct ptlrpc_request *request) LASSERT (request->rq_replen != 0); if (request->rq_repmsg == NULL) OBD_ALLOC(request->rq_repmsg, request->rq_replen); - if (request->rq_repmsg == NULL) { - LBUG(); + if (request->rq_repmsg == NULL) GOTO(cleanup_bulk, rc = -ENOMEM); - } rc = PtlMEAttach(connection->c_peer.peer_ni->pni_ni_h, request->rq_reply_portal, /* XXX FIXME bug 249 */ @@ -450,7 +448,6 @@ int ptl_send_rpc(struct ptlrpc_request *request) if (rc != PTL_OK) { CERROR("PtlMEAttach failed: %d\n", rc); LASSERT (rc == PTL_NOSPACE); - LBUG(); GOTO(cleanup_repmsg, rc = -ENOMEM); } @@ -477,7 +474,6 @@ int ptl_send_rpc(struct ptlrpc_request *request) if (rc != PTL_OK) { CERROR("PtlMDAttach failed: %d\n", rc); LASSERT (rc == PTL_NOSPACE); - LBUG(); GOTO(cleanup_me, rc -ENOMEM); } @@ -524,7 +520,7 @@ int ptl_send_rpc(struct ptlrpc_request *request) return rc; } -void ptlrpc_register_rqbd (struct ptlrpc_request_buffer_desc *rqbd) +int ptlrpc_register_rqbd (struct ptlrpc_request_buffer_desc *rqbd) { struct ptlrpc_srv_ni *srv_ni = rqbd->rqbd_srv_ni; struct ptlrpc_service *service = srv_ni->sni_service; @@ -532,18 +528,20 @@ void ptlrpc_register_rqbd (struct ptlrpc_request_buffer_desc *rqbd) int rc; ptl_md_t md; ptl_handle_me_t me_h; - unsigned long flags; CDEBUG(D_NET, "PtlMEAttach: portal %d on %s h %lx."LPX64"\n", service->srv_req_portal, srv_ni->sni_ni->pni_name, srv_ni->sni_ni->pni_ni_h.nal_idx, srv_ni->sni_ni->pni_ni_h.cookie); + if (OBD_FAIL_CHECK_ONCE(OBD_FAIL_PTLRPC_RQBD)) + return (-ENOMEM); + rc = PtlMEAttach(srv_ni->sni_ni->pni_ni_h, service->srv_req_portal, match_id, 0, ~0, PTL_UNLINK, PTL_INS_AFTER, &me_h); if (rc != PTL_OK) { CERROR("PtlMEAttach failed: %d\n", rc); - GOTO (failed, NULL); + return (-ENOMEM); } LASSERT(rqbd->rqbd_refcount == 0); @@ -557,32 +555,15 @@ void ptlrpc_register_rqbd (struct ptlrpc_request_buffer_desc *rqbd) md.user_ptr = &rqbd->rqbd_cbid; md.eventq = srv_ni->sni_ni->pni_eq_h; - spin_lock_irqsave (&service->srv_lock, flags); - srv_ni->sni_nrqbd_receiving++; - spin_unlock_irqrestore (&service->srv_lock, flags); - rc = PtlMDAttach(me_h, md, PTL_UNLINK, &rqbd->rqbd_md_h); if (rc == PTL_OK) - return; - - CERROR("PtlMDAttach failed: %d\n", rc); + return (0); + + CERROR("PtlMDAttach failed: %d; \n", rc); LASSERT (rc == PTL_NOSPACE); rc = PtlMEUnlink (me_h); LASSERT (rc == PTL_OK); - - spin_lock_irqsave (&service->srv_lock, flags); - srv_ni->sni_nrqbd_receiving--; - if (srv_ni->sni_nrqbd_receiving == 0) { - /* This service is off-air on this interface because all - * its request buffers are busy. Portals will have started - * dropping incoming requests until more buffers get - * posted */ - CERROR("All %s %s request buffers busy\n", - service->srv_name, srv_ni->sni_ni->pni_name); - } - spin_unlock_irqrestore (&service->srv_lock, flags); - - failed: - LBUG(); /* BUG 1191 */ - /* put req on a retry list? */ + rqbd->rqbd_refcount = 0; + + return (-ENOMEM); } diff --git a/lustre/ptlrpc/pack_generic.c b/lustre/ptlrpc/pack_generic.c index 150bbce..f34f5f2 100644 --- a/lustre/ptlrpc/pack_generic.c +++ b/lustre/ptlrpc/pack_generic.c @@ -48,7 +48,7 @@ lustre_init_msg (struct lustre_msg *msg, int count, int *lens, char **bufs) { char *ptr; int i; - + msg->magic = PTLRPC_MSG_MAGIC; msg->version = PTLRPC_MSG_VERSION; msg->bufcount = count; @@ -65,11 +65,11 @@ lustre_init_msg (struct lustre_msg *msg, int count, int *lens, char **bufs) } } -int lustre_pack_request (struct ptlrpc_request *req, +int lustre_pack_request (struct ptlrpc_request *req, int count, int *lens, char **bufs) { ENTRY; - + req->rq_reqlen = lustre_msg_size (count, lens); OBD_ALLOC(req->rq_reqmsg, req->rq_reqlen); if (req->rq_reqmsg == NULL) @@ -416,7 +416,10 @@ void lustre_swab_ost_last_id(obd_id *id) void lustre_swab_ost_lvb(struct ost_lvb *lvb) { __swab64s(&lvb->lvb_size); - __swab64s(&lvb->lvb_time); + __swab64s(&lvb->lvb_mtime); + __swab64s(&lvb->lvb_atime); + __swab64s(&lvb->lvb_ctime); + __swab64s(&lvb->lvb_blocks); } void lustre_swab_ll_fid (struct ll_fid *fid) @@ -662,7 +665,6 @@ void lustre_swab_llogd_conn_body (struct llogd_conn_body *d) __swab32s (&d->lgdc_ctxt_idx); } -#ifdef BUG_1343 void lustre_assert_wire_constants(void) { /* Wire protocol assertions generated by 'wirecheck' @@ -671,776 +673,1468 @@ void lustre_assert_wire_constants(void) /* Constants... */ - LASSERT(PTLRPC_MSG_MAGIC == 0x0BD00BD0); - LASSERT(PTLRPC_MSG_VERSION == 0x00000003); - LASSERT(PTL_RPC_MSG_REQUEST == 4711); - LASSERT(PTL_RPC_MSG_ERR == 4712); - LASSERT(PTL_RPC_MSG_REPLY == 4713); - LASSERT(MSG_LAST_REPLAY == 1); - LASSERT(MSG_RESENT == 2); - LASSERT(MSG_REPLAY == 4); - LASSERT(MSG_CONNECT_RECOVERING == 1); - LASSERT(MSG_CONNECT_RECONNECT == 2); - LASSERT(MSG_CONNECT_REPLAYABLE == 4); - LASSERT(OST_REPLY == 0); - LASSERT(OST_GETATTR == 1); - LASSERT(OST_SETATTR == 2); - LASSERT(OST_READ == 3); - LASSERT(OST_WRITE == 4); - LASSERT(OST_CREATE == 5); - LASSERT(OST_DESTROY == 6); - LASSERT(OST_GET_INFO == 7); - LASSERT(OST_CONNECT == 8); - LASSERT(OST_DISCONNECT == 9); - LASSERT(OST_PUNCH == 10); - LASSERT(OST_OPEN == 11); - LASSERT(OST_CLOSE == 12); - LASSERT(OST_STATFS == 13); - LASSERT(OST_SAN_READ == 14); - LASSERT(OST_SAN_WRITE == 15); - LASSERT(OST_SYNC == 16); - LASSERT(OST_LAST_OPC == 18); - LASSERT(OBD_OBJECT_EOF == 0xffffffffffffffffULL); - LASSERT(OST_REQ_HAS_OA1 == 1); - LASSERT(MDS_GETATTR == 33); - LASSERT(MDS_GETATTR_NAME == 34); - LASSERT(MDS_CLOSE == 35); - LASSERT(MDS_REINT == 36); - LASSERT(MDS_READPAGE == 37); - LASSERT(MDS_CONNECT == 38); - LASSERT(MDS_DISCONNECT == 39); - LASSERT(MDS_GETSTATUS == 40); - LASSERT(MDS_STATFS == 41); - LASSERT(MDS_PIN == 42); - LASSERT(MDS_UNPIN == 43); - LASSERT(MDS_SYNC == 44); - LASSERT(MDS_DONE_WRITING == 45); - LASSERT(MDS_LAST_OPC == 46); - LASSERT(REINT_SETATTR == 1); - LASSERT(REINT_CREATE == 2); - LASSERT(REINT_LINK == 3); - LASSERT(REINT_UNLINK == 4); - LASSERT(REINT_RENAME == 5); - LASSERT(REINT_OPEN == 6); - LASSERT(REINT_MAX == 6); - LASSERT(DISP_IT_EXECD == 1); - LASSERT(DISP_LOOKUP_EXECD == 2); - LASSERT(DISP_LOOKUP_NEG == 4); - LASSERT(DISP_LOOKUP_POS == 8); - LASSERT(DISP_OPEN_CREATE == 16); - LASSERT(DISP_OPEN_OPEN == 32); - LASSERT(MDS_STATUS_CONN == 1); - LASSERT(MDS_STATUS_LOV == 2); - LASSERT(MDS_OPEN_HAS_EA == 1073741824); - LASSERT(LDLM_ENQUEUE == 101); - LASSERT(LDLM_CONVERT == 102); - LASSERT(LDLM_CANCEL == 103); - LASSERT(LDLM_BL_CALLBACK == 104); - LASSERT(LDLM_CP_CALLBACK == 105); - LASSERT(LDLM_LAST_OPC == 106); - LASSERT(LCK_EX == 1); - LASSERT(LCK_PW == 2); - LASSERT(LCK_PR == 3); - LASSERT(LCK_CW == 4); - LASSERT(LCK_CR == 5); - LASSERT(LCK_NL == 6); - LASSERT(PTLBD_QUERY == 200); - LASSERT(PTLBD_READ == 201); - LASSERT(PTLBD_WRITE == 202); - LASSERT(PTLBD_FLUSH == 203); - LASSERT(PTLBD_CONNECT == 204); - LASSERT(PTLBD_DISCONNECT == 205); - LASSERT(PTLBD_LAST_OPC == 206); - LASSERT(MGMT_CONNECT == 250); - LASSERT(MGMT_DISCONNECT == 251); - LASSERT(MGMT_EXCEPTION == 252); - LASSERT(OBD_PING == 400); - LASSERT(OBD_LOG_CANCEL == 401); - LASSERT(OBD_LAST_OPC == 402); + LASSERTF(PTLRPC_MSG_MAGIC == 0x0BD00BD0," found %lld\n", + (long long)PTLRPC_MSG_MAGIC); + LASSERTF(PTLRPC_MSG_VERSION == 0x00000003," found %lld\n", + (long long)PTLRPC_MSG_VERSION); + LASSERTF(PTL_RPC_MSG_REQUEST == 4711, " found %lld\n", + (long long)PTL_RPC_MSG_REQUEST); + LASSERTF(PTL_RPC_MSG_ERR == 4712, " found %lld\n", + (long long)PTL_RPC_MSG_ERR); + LASSERTF(PTL_RPC_MSG_REPLY == 4713, " found %lld\n", + (long long)PTL_RPC_MSG_REPLY); + LASSERTF(MSG_LAST_REPLAY == 1, " found %lld\n", + (long long)MSG_LAST_REPLAY); + LASSERTF(MSG_RESENT == 2, " found %lld\n", + (long long)MSG_RESENT); + LASSERTF(MSG_REPLAY == 4, " found %lld\n", + (long long)MSG_REPLAY); + LASSERTF(MSG_CONNECT_RECOVERING == 1, " found %lld\n", + (long long)MSG_CONNECT_RECOVERING); + LASSERTF(MSG_CONNECT_RECONNECT == 2, " found %lld\n", + (long long)MSG_CONNECT_RECONNECT); + LASSERTF(MSG_CONNECT_REPLAYABLE == 4, " found %lld\n", + (long long)MSG_CONNECT_REPLAYABLE); + LASSERTF(OST_REPLY == 0, " found %lld\n", + (long long)OST_REPLY); + LASSERTF(OST_GETATTR == 1, " found %lld\n", + (long long)OST_GETATTR); + LASSERTF(OST_SETATTR == 2, " found %lld\n", + (long long)OST_SETATTR); + LASSERTF(OST_READ == 3, " found %lld\n", + (long long)OST_READ); + LASSERTF(OST_WRITE == 4, " found %lld\n", + (long long)OST_WRITE); + LASSERTF(OST_CREATE == 5, " found %lld\n", + (long long)OST_CREATE); + LASSERTF(OST_DESTROY == 6, " found %lld\n", + (long long)OST_DESTROY); + LASSERTF(OST_GET_INFO == 7, " found %lld\n", + (long long)OST_GET_INFO); + LASSERTF(OST_CONNECT == 8, " found %lld\n", + (long long)OST_CONNECT); + LASSERTF(OST_DISCONNECT == 9, " found %lld\n", + (long long)OST_DISCONNECT); + LASSERTF(OST_PUNCH == 10, " found %lld\n", + (long long)OST_PUNCH); + LASSERTF(OST_OPEN == 11, " found %lld\n", + (long long)OST_OPEN); + LASSERTF(OST_CLOSE == 12, " found %lld\n", + (long long)OST_CLOSE); + LASSERTF(OST_STATFS == 13, " found %lld\n", + (long long)OST_STATFS); + LASSERTF(OST_SAN_READ == 14, " found %lld\n", + (long long)OST_SAN_READ); + LASSERTF(OST_SAN_WRITE == 15, " found %lld\n", + (long long)OST_SAN_WRITE); + LASSERTF(OST_SYNC == 16, " found %lld\n", + (long long)OST_SYNC); + LASSERTF(OST_LAST_OPC == 18, " found %lld\n", + (long long)OST_LAST_OPC); + LASSERTF(OBD_OBJECT_EOF == 0xffffffffffffffffULL," found %lld\n", + (long long)OBD_OBJECT_EOF); + LASSERTF(OST_REQ_HAS_OA1 == 1, " found %lld\n", + (long long)OST_REQ_HAS_OA1); + LASSERTF(MDS_GETATTR == 33, " found %lld\n", + (long long)MDS_GETATTR); + LASSERTF(MDS_GETATTR_NAME == 34, " found %lld\n", + (long long)MDS_GETATTR_NAME); + LASSERTF(MDS_CLOSE == 35, " found %lld\n", + (long long)MDS_CLOSE); + LASSERTF(MDS_REINT == 36, " found %lld\n", + (long long)MDS_REINT); + LASSERTF(MDS_READPAGE == 37, " found %lld\n", + (long long)MDS_READPAGE); + LASSERTF(MDS_CONNECT == 38, " found %lld\n", + (long long)MDS_CONNECT); + LASSERTF(MDS_DISCONNECT == 39, " found %lld\n", + (long long)MDS_DISCONNECT); + LASSERTF(MDS_GETSTATUS == 40, " found %lld\n", + (long long)MDS_GETSTATUS); + LASSERTF(MDS_STATFS == 41, " found %lld\n", + (long long)MDS_STATFS); + LASSERTF(MDS_PIN == 42, " found %lld\n", + (long long)MDS_PIN); + LASSERTF(MDS_UNPIN == 43, " found %lld\n", + (long long)MDS_UNPIN); + LASSERTF(MDS_SYNC == 44, " found %lld\n", + (long long)MDS_SYNC); + LASSERTF(MDS_DONE_WRITING == 45, " found %lld\n", + (long long)MDS_DONE_WRITING); + LASSERTF(MDS_LAST_OPC == 46, " found %lld\n", + (long long)MDS_LAST_OPC); + LASSERTF(REINT_SETATTR == 1, " found %lld\n", + (long long)REINT_SETATTR); + LASSERTF(REINT_CREATE == 2, " found %lld\n", + (long long)REINT_CREATE); + LASSERTF(REINT_LINK == 3, " found %lld\n", + (long long)REINT_LINK); + LASSERTF(REINT_UNLINK == 4, " found %lld\n", + (long long)REINT_UNLINK); + LASSERTF(REINT_RENAME == 5, " found %lld\n", + (long long)REINT_RENAME); + LASSERTF(REINT_OPEN == 6, " found %lld\n", + (long long)REINT_OPEN); + LASSERTF(REINT_MAX == 6, " found %lld\n", + (long long)REINT_MAX); + LASSERTF(DISP_IT_EXECD == 1, " found %lld\n", + (long long)DISP_IT_EXECD); + LASSERTF(DISP_LOOKUP_EXECD == 2, " found %lld\n", + (long long)DISP_LOOKUP_EXECD); + LASSERTF(DISP_LOOKUP_NEG == 4, " found %lld\n", + (long long)DISP_LOOKUP_NEG); + LASSERTF(DISP_LOOKUP_POS == 8, " found %lld\n", + (long long)DISP_LOOKUP_POS); + LASSERTF(DISP_OPEN_CREATE == 16, " found %lld\n", + (long long)DISP_OPEN_CREATE); + LASSERTF(DISP_OPEN_OPEN == 32, " found %lld\n", + (long long)DISP_OPEN_OPEN); + LASSERTF(MDS_STATUS_CONN == 1, " found %lld\n", + (long long)MDS_STATUS_CONN); + LASSERTF(MDS_STATUS_LOV == 2, " found %lld\n", + (long long)MDS_STATUS_LOV); + LASSERTF(MDS_OPEN_HAS_EA == 1073741824, " found %lld\n", + (long long)MDS_OPEN_HAS_EA); + LASSERTF(LDLM_ENQUEUE == 101, " found %lld\n", + (long long)LDLM_ENQUEUE); + LASSERTF(LDLM_CONVERT == 102, " found %lld\n", + (long long)LDLM_CONVERT); + LASSERTF(LDLM_CANCEL == 103, " found %lld\n", + (long long)LDLM_CANCEL); + LASSERTF(LDLM_BL_CALLBACK == 104, " found %lld\n", + (long long)LDLM_BL_CALLBACK); + LASSERTF(LDLM_CP_CALLBACK == 105, " found %lld\n", + (long long)LDLM_CP_CALLBACK); + LASSERTF(LDLM_LAST_OPC == 107, " found %lld\n", + (long long)LDLM_LAST_OPC); + LASSERTF(LCK_EX == 1, " found %lld\n", + (long long)LCK_EX); + LASSERTF(LCK_PW == 2, " found %lld\n", + (long long)LCK_PW); + LASSERTF(LCK_PR == 4, " found %lld\n", + (long long)LCK_PR); + LASSERTF(LCK_CW == 8, " found %lld\n", + (long long)LCK_CW); + LASSERTF(LCK_CR == 16, " found %lld\n", + (long long)LCK_CR); + LASSERTF(LCK_NL == 32, " found %lld\n", + (long long)LCK_NL); + LASSERTF(PTLBD_QUERY == 200, " found %lld\n", + (long long)PTLBD_QUERY); + LASSERTF(PTLBD_READ == 201, " found %lld\n", + (long long)PTLBD_READ); + LASSERTF(PTLBD_WRITE == 202, " found %lld\n", + (long long)PTLBD_WRITE); + LASSERTF(PTLBD_FLUSH == 203, " found %lld\n", + (long long)PTLBD_FLUSH); + LASSERTF(PTLBD_CONNECT == 204, " found %lld\n", + (long long)PTLBD_CONNECT); + LASSERTF(PTLBD_DISCONNECT == 205, " found %lld\n", + (long long)PTLBD_DISCONNECT); + LASSERTF(PTLBD_LAST_OPC == 206, " found %lld\n", + (long long)PTLBD_LAST_OPC); + LASSERTF(MGMT_CONNECT == 250, " found %lld\n", + (long long)MGMT_CONNECT); + LASSERTF(MGMT_DISCONNECT == 251, " found %lld\n", + (long long)MGMT_DISCONNECT); + LASSERTF(MGMT_EXCEPTION == 252, " found %lld\n", + (long long)MGMT_EXCEPTION); + LASSERTF(OBD_PING == 400, " found %lld\n", + (long long)OBD_PING); + LASSERTF(OBD_LOG_CANCEL == 401, " found %lld\n", + (long long)OBD_LOG_CANCEL); + LASSERTF(OBD_LAST_OPC == 402, " found %lld\n", + (long long)OBD_LAST_OPC); /* Sizes and Offsets */ /* Checks for struct lustre_handle */ - LASSERT((int)sizeof(struct lustre_handle) == 8); - LASSERT(offsetof(struct lustre_handle, cookie) == 0); - LASSERT((int)sizeof(((struct lustre_handle *)0)->cookie) == 8); + LASSERTF((int)sizeof(struct lustre_handle) == 8, " found %lld\n", + (long long)(int)sizeof(struct lustre_handle)); + LASSERTF(offsetof(struct lustre_handle, cookie) == 0, " found %lld\n", + (long long)offsetof(struct lustre_handle, cookie)); + LASSERTF((int)sizeof(((struct lustre_handle *)0)->cookie) == 8, " found %lld\n", + (long long)(int)sizeof(((struct lustre_handle *)0)->cookie)); /* Checks for struct lustre_msg */ - LASSERT((int)sizeof(struct lustre_msg) == 64); - LASSERT(offsetof(struct lustre_msg, handle) == 0); - LASSERT((int)sizeof(((struct lustre_msg *)0)->handle) == 8); - LASSERT(offsetof(struct lustre_msg, magic) == 8); - LASSERT((int)sizeof(((struct lustre_msg *)0)->magic) == 4); - LASSERT(offsetof(struct lustre_msg, type) == 12); - LASSERT((int)sizeof(((struct lustre_msg *)0)->type) == 4); - LASSERT(offsetof(struct lustre_msg, version) == 16); - LASSERT((int)sizeof(((struct lustre_msg *)0)->version) == 4); - LASSERT(offsetof(struct lustre_msg, opc) == 20); - LASSERT((int)sizeof(((struct lustre_msg *)0)->opc) == 4); - LASSERT(offsetof(struct lustre_msg, last_xid) == 24); - LASSERT((int)sizeof(((struct lustre_msg *)0)->last_xid) == 8); - LASSERT(offsetof(struct lustre_msg, last_committed) == 32); - LASSERT((int)sizeof(((struct lustre_msg *)0)->last_committed) == 8); - LASSERT(offsetof(struct lustre_msg, transno) == 40); - LASSERT((int)sizeof(((struct lustre_msg *)0)->transno) == 8); - LASSERT(offsetof(struct lustre_msg, status) == 48); - LASSERT((int)sizeof(((struct lustre_msg *)0)->status) == 4); - LASSERT(offsetof(struct lustre_msg, flags) == 52); - LASSERT((int)sizeof(((struct lustre_msg *)0)->flags) == 4); - LASSERT(offsetof(struct lustre_msg, bufcount) == 60); - LASSERT((int)sizeof(((struct lustre_msg *)0)->bufcount) == 4); - LASSERT(offsetof(struct lustre_msg, buflens[7]) == 92); - LASSERT((int)sizeof(((struct lustre_msg *)0)->buflens[7]) == 4); + LASSERTF((int)sizeof(struct lustre_msg) == 64, " found %lld\n", + (long long)(int)sizeof(struct lustre_msg)); + LASSERTF(offsetof(struct lustre_msg, handle) == 0, " found %lld\n", + (long long)offsetof(struct lustre_msg, handle)); + LASSERTF((int)sizeof(((struct lustre_msg *)0)->handle) == 8, " found %lld\n", + (long long)(int)sizeof(((struct lustre_msg *)0)->handle)); + LASSERTF(offsetof(struct lustre_msg, magic) == 8, " found %lld\n", + (long long)offsetof(struct lustre_msg, magic)); + LASSERTF((int)sizeof(((struct lustre_msg *)0)->magic) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lustre_msg *)0)->magic)); + LASSERTF(offsetof(struct lustre_msg, type) == 12, " found %lld\n", + (long long)offsetof(struct lustre_msg, type)); + LASSERTF((int)sizeof(((struct lustre_msg *)0)->type) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lustre_msg *)0)->type)); + LASSERTF(offsetof(struct lustre_msg, version) == 16, " found %lld\n", + (long long)offsetof(struct lustre_msg, version)); + LASSERTF((int)sizeof(((struct lustre_msg *)0)->version) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lustre_msg *)0)->version)); + LASSERTF(offsetof(struct lustre_msg, opc) == 20, " found %lld\n", + (long long)offsetof(struct lustre_msg, opc)); + LASSERTF((int)sizeof(((struct lustre_msg *)0)->opc) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lustre_msg *)0)->opc)); + LASSERTF(offsetof(struct lustre_msg, last_xid) == 24, " found %lld\n", + (long long)offsetof(struct lustre_msg, last_xid)); + LASSERTF((int)sizeof(((struct lustre_msg *)0)->last_xid) == 8, " found %lld\n", + (long long)(int)sizeof(((struct lustre_msg *)0)->last_xid)); + LASSERTF(offsetof(struct lustre_msg, last_committed) == 32, " found %lld\n", + (long long)offsetof(struct lustre_msg, last_committed)); + LASSERTF((int)sizeof(((struct lustre_msg *)0)->last_committed) == 8, " found %lld\n", + (long long)(int)sizeof(((struct lustre_msg *)0)->last_committed)); + LASSERTF(offsetof(struct lustre_msg, transno) == 40, " found %lld\n", + (long long)offsetof(struct lustre_msg, transno)); + LASSERTF((int)sizeof(((struct lustre_msg *)0)->transno) == 8, " found %lld\n", + (long long)(int)sizeof(((struct lustre_msg *)0)->transno)); + LASSERTF(offsetof(struct lustre_msg, status) == 48, " found %lld\n", + (long long)offsetof(struct lustre_msg, status)); + LASSERTF((int)sizeof(((struct lustre_msg *)0)->status) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lustre_msg *)0)->status)); + LASSERTF(offsetof(struct lustre_msg, flags) == 52, " found %lld\n", + (long long)offsetof(struct lustre_msg, flags)); + LASSERTF((int)sizeof(((struct lustre_msg *)0)->flags) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lustre_msg *)0)->flags)); + LASSERTF(offsetof(struct lustre_msg, bufcount) == 60, " found %lld\n", + (long long)offsetof(struct lustre_msg, bufcount)); + LASSERTF((int)sizeof(((struct lustre_msg *)0)->bufcount) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lustre_msg *)0)->bufcount)); + LASSERTF(offsetof(struct lustre_msg, buflens[7]) == 92, " found %lld\n", + (long long)offsetof(struct lustre_msg, buflens[7])); + LASSERTF((int)sizeof(((struct lustre_msg *)0)->buflens[7]) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lustre_msg *)0)->buflens[7])); /* Checks for struct obdo */ - LASSERT((int)sizeof(struct obdo) == 168); - LASSERT(offsetof(struct obdo, o_id) == 0); - LASSERT((int)sizeof(((struct obdo *)0)->o_id) == 8); - LASSERT(offsetof(struct obdo, o_gr) == 8); - LASSERT((int)sizeof(((struct obdo *)0)->o_gr) == 8); - LASSERT(offsetof(struct obdo, o_atime) == 16); - LASSERT((int)sizeof(((struct obdo *)0)->o_atime) == 8); - LASSERT(offsetof(struct obdo, o_mtime) == 24); - LASSERT((int)sizeof(((struct obdo *)0)->o_mtime) == 8); - LASSERT(offsetof(struct obdo, o_ctime) == 32); - LASSERT((int)sizeof(((struct obdo *)0)->o_ctime) == 8); - LASSERT(offsetof(struct obdo, o_size) == 40); - LASSERT((int)sizeof(((struct obdo *)0)->o_size) == 8); - LASSERT(offsetof(struct obdo, o_blocks) == 48); - LASSERT((int)sizeof(((struct obdo *)0)->o_blocks) == 8); - LASSERT(offsetof(struct obdo, o_grant) == 56); - LASSERT((int)sizeof(((struct obdo *)0)->o_grant) == 8); - LASSERT(offsetof(struct obdo, o_blksize) == 64); - LASSERT((int)sizeof(((struct obdo *)0)->o_blksize) == 4); - LASSERT(offsetof(struct obdo, o_mode) == 68); - LASSERT((int)sizeof(((struct obdo *)0)->o_mode) == 4); - LASSERT(offsetof(struct obdo, o_uid) == 72); - LASSERT((int)sizeof(((struct obdo *)0)->o_uid) == 4); - LASSERT(offsetof(struct obdo, o_gid) == 76); - LASSERT((int)sizeof(((struct obdo *)0)->o_gid) == 4); - LASSERT(offsetof(struct obdo, o_flags) == 80); - LASSERT((int)sizeof(((struct obdo *)0)->o_flags) == 4); - LASSERT(offsetof(struct obdo, o_nlink) == 84); - LASSERT((int)sizeof(((struct obdo *)0)->o_nlink) == 4); - LASSERT(offsetof(struct obdo, o_generation) == 88); - LASSERT((int)sizeof(((struct obdo *)0)->o_generation) == 4); - LASSERT(offsetof(struct obdo, o_valid) == 92); - LASSERT((int)sizeof(((struct obdo *)0)->o_valid) == 4); - LASSERT(offsetof(struct obdo, o_misc) == 96); - LASSERT((int)sizeof(((struct obdo *)0)->o_misc) == 4); - LASSERT(offsetof(struct obdo, o_easize) == 100); - LASSERT((int)sizeof(((struct obdo *)0)->o_easize) == 4); - LASSERT(offsetof(struct obdo, o_inline) == 104); - LASSERT((int)sizeof(((struct obdo *)0)->o_inline) == 64); - LASSERT(OBD_MD_FLID == 1); - LASSERT(OBD_MD_FLATIME == 2); - LASSERT(OBD_MD_FLMTIME == 4); - LASSERT(OBD_MD_FLCTIME == 8); - LASSERT(OBD_MD_FLSIZE == 16); - LASSERT(OBD_MD_FLBLOCKS == 32); - LASSERT(OBD_MD_FLBLKSZ == 64); - LASSERT(OBD_MD_FLMODE == 128); - LASSERT(OBD_MD_FLTYPE == 256); - LASSERT(OBD_MD_FLUID == 512); - LASSERT(OBD_MD_FLGID == 1024); - LASSERT(OBD_MD_FLFLAGS == 2048); - LASSERT(OBD_MD_FLNLINK == 8192); - LASSERT(OBD_MD_FLGENER == 16384); - LASSERT(OBD_MD_FLINLINE == 32768); - LASSERT(OBD_MD_FLRDEV == 65536); - LASSERT(OBD_MD_FLEASIZE == 131072); - LASSERT(OBD_MD_LINKNAME == 262144); - LASSERT(OBD_MD_FLHANDLE == 524288); - LASSERT(OBD_MD_FLCKSUM == 1048576); - LASSERT(OBD_MD_FLQOS == 2097152); - LASSERT(OBD_MD_FLOSCOPQ == 4194304); - LASSERT(OBD_MD_FLCOOKIE == 8388608); - LASSERT(OBD_MD_FLGROUP == 16777216); - LASSERT(OBD_FL_INLINEDATA == 1); - LASSERT(OBD_FL_OBDMDEXISTS == 2); - LASSERT(OBD_FL_DELORPHAN == 4); - LASSERT(OBD_FL_NORPC == 8); - LASSERT(OBD_FL_IDONLY == 16); - LASSERT(OBD_FL_RECREATE_OBJS == 32); + LASSERTF((int)sizeof(struct obdo) == 168, " found %lld\n", + (long long)(int)sizeof(struct obdo)); + LASSERTF(offsetof(struct obdo, o_id) == 0, " found %lld\n", + (long long)offsetof(struct obdo, o_id)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_id) == 8, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_id)); + LASSERTF(offsetof(struct obdo, o_gr) == 8, " found %lld\n", + (long long)offsetof(struct obdo, o_gr)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_gr) == 8, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_gr)); + LASSERTF(offsetof(struct obdo, o_atime) == 16, " found %lld\n", + (long long)offsetof(struct obdo, o_atime)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_atime) == 8, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_atime)); + LASSERTF(offsetof(struct obdo, o_mtime) == 24, " found %lld\n", + (long long)offsetof(struct obdo, o_mtime)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_mtime) == 8, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_mtime)); + LASSERTF(offsetof(struct obdo, o_ctime) == 32, " found %lld\n", + (long long)offsetof(struct obdo, o_ctime)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_ctime) == 8, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_ctime)); + LASSERTF(offsetof(struct obdo, o_size) == 40, " found %lld\n", + (long long)offsetof(struct obdo, o_size)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_size) == 8, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_size)); + LASSERTF(offsetof(struct obdo, o_blocks) == 48, " found %lld\n", + (long long)offsetof(struct obdo, o_blocks)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_blocks) == 8, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_blocks)); + LASSERTF(offsetof(struct obdo, o_grant) == 56, " found %lld\n", + (long long)offsetof(struct obdo, o_grant)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_grant) == 8, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_grant)); + LASSERTF(offsetof(struct obdo, o_blksize) == 64, " found %lld\n", + (long long)offsetof(struct obdo, o_blksize)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_blksize) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_blksize)); + LASSERTF(offsetof(struct obdo, o_mode) == 68, " found %lld\n", + (long long)offsetof(struct obdo, o_mode)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_mode) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_mode)); + LASSERTF(offsetof(struct obdo, o_uid) == 72, " found %lld\n", + (long long)offsetof(struct obdo, o_uid)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_uid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_uid)); + LASSERTF(offsetof(struct obdo, o_gid) == 76, " found %lld\n", + (long long)offsetof(struct obdo, o_gid)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_gid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_gid)); + LASSERTF(offsetof(struct obdo, o_flags) == 80, " found %lld\n", + (long long)offsetof(struct obdo, o_flags)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_flags) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_flags)); + LASSERTF(offsetof(struct obdo, o_nlink) == 84, " found %lld\n", + (long long)offsetof(struct obdo, o_nlink)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_nlink) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_nlink)); + LASSERTF(offsetof(struct obdo, o_generation) == 88, " found %lld\n", + (long long)offsetof(struct obdo, o_generation)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_generation) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_generation)); + LASSERTF(offsetof(struct obdo, o_valid) == 92, " found %lld\n", + (long long)offsetof(struct obdo, o_valid)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_valid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_valid)); + LASSERTF(offsetof(struct obdo, o_misc) == 96, " found %lld\n", + (long long)offsetof(struct obdo, o_misc)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_misc) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_misc)); + LASSERTF(offsetof(struct obdo, o_easize) == 100, " found %lld\n", + (long long)offsetof(struct obdo, o_easize)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_easize) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_easize)); + LASSERTF(offsetof(struct obdo, o_inline) == 104, " found %lld\n", + (long long)offsetof(struct obdo, o_inline)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_inline) == 64, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_inline)); + LASSERTF(OBD_MD_FLID == 1, " found %lld\n", + (long long)OBD_MD_FLID); + LASSERTF(OBD_MD_FLATIME == 2, " found %lld\n", + (long long)OBD_MD_FLATIME); + LASSERTF(OBD_MD_FLMTIME == 4, " found %lld\n", + (long long)OBD_MD_FLMTIME); + LASSERTF(OBD_MD_FLCTIME == 8, " found %lld\n", + (long long)OBD_MD_FLCTIME); + LASSERTF(OBD_MD_FLSIZE == 16, " found %lld\n", + (long long)OBD_MD_FLSIZE); + LASSERTF(OBD_MD_FLBLOCKS == 32, " found %lld\n", + (long long)OBD_MD_FLBLOCKS); + LASSERTF(OBD_MD_FLBLKSZ == 64, " found %lld\n", + (long long)OBD_MD_FLBLKSZ); + LASSERTF(OBD_MD_FLMODE == 128, " found %lld\n", + (long long)OBD_MD_FLMODE); + LASSERTF(OBD_MD_FLTYPE == 256, " found %lld\n", + (long long)OBD_MD_FLTYPE); + LASSERTF(OBD_MD_FLUID == 512, " found %lld\n", + (long long)OBD_MD_FLUID); + LASSERTF(OBD_MD_FLGID == 1024, " found %lld\n", + (long long)OBD_MD_FLGID); + LASSERTF(OBD_MD_FLFLAGS == 2048, " found %lld\n", + (long long)OBD_MD_FLFLAGS); + LASSERTF(OBD_MD_FLNLINK == 8192, " found %lld\n", + (long long)OBD_MD_FLNLINK); + LASSERTF(OBD_MD_FLGENER == 16384, " found %lld\n", + (long long)OBD_MD_FLGENER); + LASSERTF(OBD_MD_FLINLINE == 32768, " found %lld\n", + (long long)OBD_MD_FLINLINE); + LASSERTF(OBD_MD_FLRDEV == 65536, " found %lld\n", + (long long)OBD_MD_FLRDEV); + LASSERTF(OBD_MD_FLEASIZE == 131072, " found %lld\n", + (long long)OBD_MD_FLEASIZE); + LASSERTF(OBD_MD_LINKNAME == 262144, " found %lld\n", + (long long)OBD_MD_LINKNAME); + LASSERTF(OBD_MD_FLHANDLE == 524288, " found %lld\n", + (long long)OBD_MD_FLHANDLE); + LASSERTF(OBD_MD_FLCKSUM == 1048576, " found %lld\n", + (long long)OBD_MD_FLCKSUM); + LASSERTF(OBD_MD_FLQOS == 2097152, " found %lld\n", + (long long)OBD_MD_FLQOS); + LASSERTF(OBD_MD_FLOSCOPQ == 4194304, " found %lld\n", + (long long)OBD_MD_FLOSCOPQ); + LASSERTF(OBD_MD_FLCOOKIE == 8388608, " found %lld\n", + (long long)OBD_MD_FLCOOKIE); + LASSERTF(OBD_MD_FLGROUP == 16777216, " found %lld\n", + (long long)OBD_MD_FLGROUP); + LASSERTF(OBD_FL_INLINEDATA == 1, " found %lld\n", + (long long)OBD_FL_INLINEDATA); + LASSERTF(OBD_FL_OBDMDEXISTS == 2, " found %lld\n", + (long long)OBD_FL_OBDMDEXISTS); + LASSERTF(OBD_FL_DELORPHAN == 4, " found %lld\n", + (long long)OBD_FL_DELORPHAN); + LASSERTF(OBD_FL_NORPC == 8, " found %lld\n", + (long long)OBD_FL_NORPC); + LASSERTF(OBD_FL_IDONLY == 16, " found %lld\n", + (long long)OBD_FL_IDONLY); + LASSERTF(OBD_FL_RECREATE_OBJS == 32, " found %lld\n", + (long long)OBD_FL_RECREATE_OBJS); /* Checks for struct lov_mds_md_v1 */ - LASSERT((int)sizeof(struct lov_mds_md_v1) == 32); - LASSERT(offsetof(struct lov_mds_md_v1, lmm_magic) == 0); - LASSERT((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_magic) == 4); - LASSERT(offsetof(struct lov_mds_md_v1, lmm_pattern) == 4); - LASSERT((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_pattern) == 4); - LASSERT(offsetof(struct lov_mds_md_v1, lmm_object_id) == 8); - LASSERT((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_object_id) == 8); - LASSERT(offsetof(struct lov_mds_md_v1, lmm_object_gr) == 16); - LASSERT((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_object_gr) == 8); - LASSERT(offsetof(struct lov_mds_md_v1, lmm_stripe_size) == 24); - LASSERT((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_stripe_size) == 4); - LASSERT(offsetof(struct lov_mds_md_v1, lmm_stripe_count) == 28); - LASSERT((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_stripe_count) == 4); - LASSERT(offsetof(struct lov_mds_md_v1, lmm_objects) == 32); - LASSERT((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_objects) == 0); + LASSERTF((int)sizeof(struct lov_mds_md_v1) == 32, " found %lld\n", + (long long)(int)sizeof(struct lov_mds_md_v1)); + LASSERTF(offsetof(struct lov_mds_md_v1, lmm_magic) == 0, " found %lld\n", + (long long)offsetof(struct lov_mds_md_v1, lmm_magic)); + LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_magic) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_magic)); + LASSERTF(offsetof(struct lov_mds_md_v1, lmm_pattern) == 4, " found %lld\n", + (long long)offsetof(struct lov_mds_md_v1, lmm_pattern)); + LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_pattern) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_pattern)); + LASSERTF(offsetof(struct lov_mds_md_v1, lmm_object_id) == 8, " found %lld\n", + (long long)offsetof(struct lov_mds_md_v1, lmm_object_id)); + LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_object_id) == 8, " found %lld\n", + (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_object_id)); + LASSERTF(offsetof(struct lov_mds_md_v1, lmm_object_gr) == 16, " found %lld\n", + (long long)offsetof(struct lov_mds_md_v1, lmm_object_gr)); + LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_object_gr) == 8, " found %lld\n", + (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_object_gr)); + LASSERTF(offsetof(struct lov_mds_md_v1, lmm_stripe_size) == 24, " found %lld\n", + (long long)offsetof(struct lov_mds_md_v1, lmm_stripe_size)); + LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_stripe_size) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_stripe_size)); + LASSERTF(offsetof(struct lov_mds_md_v1, lmm_stripe_count) == 28, " found %lld\n", + (long long)offsetof(struct lov_mds_md_v1, lmm_stripe_count)); + LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_stripe_count) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_stripe_count)); + LASSERTF(offsetof(struct lov_mds_md_v1, lmm_objects) == 32, " found %lld\n", + (long long)offsetof(struct lov_mds_md_v1, lmm_objects)); + LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_objects) == 0, " found %lld\n", + (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_objects)); /* Checks for struct lov_ost_data_v1 */ - LASSERT((int)sizeof(struct lov_ost_data_v1) == 24); - LASSERT(offsetof(struct lov_ost_data_v1, l_object_id) == 0); - LASSERT((int)sizeof(((struct lov_ost_data_v1 *)0)->l_object_id) == 8); - LASSERT(offsetof(struct lov_ost_data_v1, l_object_gr) == 8); - LASSERT((int)sizeof(((struct lov_ost_data_v1 *)0)->l_object_gr) == 8); - LASSERT(offsetof(struct lov_ost_data_v1, l_ost_gen) == 16); - LASSERT((int)sizeof(((struct lov_ost_data_v1 *)0)->l_ost_gen) == 4); - LASSERT(offsetof(struct lov_ost_data_v1, l_ost_idx) == 20); - LASSERT((int)sizeof(((struct lov_ost_data_v1 *)0)->l_ost_idx) == 4); - LASSERT(LOV_MAGIC_V0 == 198183888); - LASSERT(LOV_MAGIC_V1 == 198249424); - LASSERT(LOV_PATTERN_RAID0 == 1); - LASSERT(LOV_PATTERN_RAID1 == 2); + LASSERTF((int)sizeof(struct lov_ost_data_v1) == 24, " found %lld\n", + (long long)(int)sizeof(struct lov_ost_data_v1)); + LASSERTF(offsetof(struct lov_ost_data_v1, l_object_id) == 0, " found %lld\n", + (long long)offsetof(struct lov_ost_data_v1, l_object_id)); + LASSERTF((int)sizeof(((struct lov_ost_data_v1 *)0)->l_object_id) == 8, " found %lld\n", + (long long)(int)sizeof(((struct lov_ost_data_v1 *)0)->l_object_id)); + LASSERTF(offsetof(struct lov_ost_data_v1, l_object_gr) == 8, " found %lld\n", + (long long)offsetof(struct lov_ost_data_v1, l_object_gr)); + LASSERTF((int)sizeof(((struct lov_ost_data_v1 *)0)->l_object_gr) == 8, " found %lld\n", + (long long)(int)sizeof(((struct lov_ost_data_v1 *)0)->l_object_gr)); + LASSERTF(offsetof(struct lov_ost_data_v1, l_ost_gen) == 16, " found %lld\n", + (long long)offsetof(struct lov_ost_data_v1, l_ost_gen)); + LASSERTF((int)sizeof(((struct lov_ost_data_v1 *)0)->l_ost_gen) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lov_ost_data_v1 *)0)->l_ost_gen)); + LASSERTF(offsetof(struct lov_ost_data_v1, l_ost_idx) == 20, " found %lld\n", + (long long)offsetof(struct lov_ost_data_v1, l_ost_idx)); + LASSERTF((int)sizeof(((struct lov_ost_data_v1 *)0)->l_ost_idx) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lov_ost_data_v1 *)0)->l_ost_idx)); + LASSERTF(LOV_MAGIC_V0 == 198183888, " found %lld\n", + (long long)LOV_MAGIC_V0); + LASSERTF(LOV_MAGIC_V1 == 198249424, " found %lld\n", + (long long)LOV_MAGIC_V1); + LASSERTF(LOV_PATTERN_RAID0 == 1, " found %lld\n", + (long long)LOV_PATTERN_RAID0); + LASSERTF(LOV_PATTERN_RAID1 == 2, " found %lld\n", + (long long)LOV_PATTERN_RAID1); /* Checks for struct obd_statfs */ - LASSERT((int)sizeof(struct obd_statfs) == 144); - LASSERT(offsetof(struct obd_statfs, os_type) == 0); - LASSERT((int)sizeof(((struct obd_statfs *)0)->os_type) == 8); - LASSERT(offsetof(struct obd_statfs, os_blocks) == 8); - LASSERT((int)sizeof(((struct obd_statfs *)0)->os_blocks) == 8); - LASSERT(offsetof(struct obd_statfs, os_bfree) == 16); - LASSERT((int)sizeof(((struct obd_statfs *)0)->os_bfree) == 8); - LASSERT(offsetof(struct obd_statfs, os_bavail) == 24); - LASSERT((int)sizeof(((struct obd_statfs *)0)->os_bavail) == 8); - LASSERT(offsetof(struct obd_statfs, os_ffree) == 40); - LASSERT((int)sizeof(((struct obd_statfs *)0)->os_ffree) == 8); - LASSERT(offsetof(struct obd_statfs, os_fsid) == 48); - LASSERT((int)sizeof(((struct obd_statfs *)0)->os_fsid) == 40); - LASSERT(offsetof(struct obd_statfs, os_bsize) == 88); - LASSERT((int)sizeof(((struct obd_statfs *)0)->os_bsize) == 4); - LASSERT(offsetof(struct obd_statfs, os_namelen) == 92); - LASSERT((int)sizeof(((struct obd_statfs *)0)->os_namelen) == 4); - LASSERT(offsetof(struct obd_statfs, os_spare) == 104); - LASSERT((int)sizeof(((struct obd_statfs *)0)->os_spare) == 40); + LASSERTF((int)sizeof(struct obd_statfs) == 144, " found %lld\n", + (long long)(int)sizeof(struct obd_statfs)); + LASSERTF(offsetof(struct obd_statfs, os_type) == 0, " found %lld\n", + (long long)offsetof(struct obd_statfs, os_type)); + LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_type) == 8, " found %lld\n", + (long long)(int)sizeof(((struct obd_statfs *)0)->os_type)); + LASSERTF(offsetof(struct obd_statfs, os_blocks) == 8, " found %lld\n", + (long long)offsetof(struct obd_statfs, os_blocks)); + LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_blocks) == 8, " found %lld\n", + (long long)(int)sizeof(((struct obd_statfs *)0)->os_blocks)); + LASSERTF(offsetof(struct obd_statfs, os_bfree) == 16, " found %lld\n", + (long long)offsetof(struct obd_statfs, os_bfree)); + LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_bfree) == 8, " found %lld\n", + (long long)(int)sizeof(((struct obd_statfs *)0)->os_bfree)); + LASSERTF(offsetof(struct obd_statfs, os_bavail) == 24, " found %lld\n", + (long long)offsetof(struct obd_statfs, os_bavail)); + LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_bavail) == 8, " found %lld\n", + (long long)(int)sizeof(((struct obd_statfs *)0)->os_bavail)); + LASSERTF(offsetof(struct obd_statfs, os_ffree) == 40, " found %lld\n", + (long long)offsetof(struct obd_statfs, os_ffree)); + LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_ffree) == 8, " found %lld\n", + (long long)(int)sizeof(((struct obd_statfs *)0)->os_ffree)); + LASSERTF(offsetof(struct obd_statfs, os_fsid) == 48, " found %lld\n", + (long long)offsetof(struct obd_statfs, os_fsid)); + LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_fsid) == 40, " found %lld\n", + (long long)(int)sizeof(((struct obd_statfs *)0)->os_fsid)); + LASSERTF(offsetof(struct obd_statfs, os_bsize) == 88, " found %lld\n", + (long long)offsetof(struct obd_statfs, os_bsize)); + LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_bsize) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obd_statfs *)0)->os_bsize)); + LASSERTF(offsetof(struct obd_statfs, os_namelen) == 92, " found %lld\n", + (long long)offsetof(struct obd_statfs, os_namelen)); + LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_namelen) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obd_statfs *)0)->os_namelen)); + LASSERTF(offsetof(struct obd_statfs, os_spare) == 104, " found %lld\n", + (long long)offsetof(struct obd_statfs, os_spare)); + LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_spare) == 40, " found %lld\n", + (long long)(int)sizeof(((struct obd_statfs *)0)->os_spare)); /* Checks for struct obd_ioobj */ - LASSERT((int)sizeof(struct obd_ioobj) == 24); - LASSERT(offsetof(struct obd_ioobj, ioo_id) == 0); - LASSERT((int)sizeof(((struct obd_ioobj *)0)->ioo_id) == 8); - LASSERT(offsetof(struct obd_ioobj, ioo_gr) == 8); - LASSERT((int)sizeof(((struct obd_ioobj *)0)->ioo_gr) == 8); - LASSERT(offsetof(struct obd_ioobj, ioo_type) == 16); - LASSERT((int)sizeof(((struct obd_ioobj *)0)->ioo_type) == 4); - LASSERT(offsetof(struct obd_ioobj, ioo_bufcnt) == 20); - LASSERT((int)sizeof(((struct obd_ioobj *)0)->ioo_bufcnt) == 4); + LASSERTF((int)sizeof(struct obd_ioobj) == 24, " found %lld\n", + (long long)(int)sizeof(struct obd_ioobj)); + LASSERTF(offsetof(struct obd_ioobj, ioo_id) == 0, " found %lld\n", + (long long)offsetof(struct obd_ioobj, ioo_id)); + LASSERTF((int)sizeof(((struct obd_ioobj *)0)->ioo_id) == 8, " found %lld\n", + (long long)(int)sizeof(((struct obd_ioobj *)0)->ioo_id)); + LASSERTF(offsetof(struct obd_ioobj, ioo_gr) == 8, " found %lld\n", + (long long)offsetof(struct obd_ioobj, ioo_gr)); + LASSERTF((int)sizeof(((struct obd_ioobj *)0)->ioo_gr) == 8, " found %lld\n", + (long long)(int)sizeof(((struct obd_ioobj *)0)->ioo_gr)); + LASSERTF(offsetof(struct obd_ioobj, ioo_type) == 16, " found %lld\n", + (long long)offsetof(struct obd_ioobj, ioo_type)); + LASSERTF((int)sizeof(((struct obd_ioobj *)0)->ioo_type) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obd_ioobj *)0)->ioo_type)); + LASSERTF(offsetof(struct obd_ioobj, ioo_bufcnt) == 20, " found %lld\n", + (long long)offsetof(struct obd_ioobj, ioo_bufcnt)); + LASSERTF((int)sizeof(((struct obd_ioobj *)0)->ioo_bufcnt) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obd_ioobj *)0)->ioo_bufcnt)); /* Checks for struct niobuf_remote */ - LASSERT((int)sizeof(struct niobuf_remote) == 16); - LASSERT(offsetof(struct niobuf_remote, offset) == 0); - LASSERT((int)sizeof(((struct niobuf_remote *)0)->offset) == 8); - LASSERT(offsetof(struct niobuf_remote, len) == 8); - LASSERT((int)sizeof(((struct niobuf_remote *)0)->len) == 4); - LASSERT(offsetof(struct niobuf_remote, flags) == 12); - LASSERT((int)sizeof(((struct niobuf_remote *)0)->flags) == 4); - LASSERT(OBD_BRW_READ == 1); - LASSERT(OBD_BRW_WRITE == 2); - LASSERT(OBD_BRW_SYNC == 8); - LASSERT(OBD_BRW_FROM_GRANT == 32); + LASSERTF((int)sizeof(struct niobuf_remote) == 16, " found %lld\n", + (long long)(int)sizeof(struct niobuf_remote)); + LASSERTF(offsetof(struct niobuf_remote, offset) == 0, " found %lld\n", + (long long)offsetof(struct niobuf_remote, offset)); + LASSERTF((int)sizeof(((struct niobuf_remote *)0)->offset) == 8, " found %lld\n", + (long long)(int)sizeof(((struct niobuf_remote *)0)->offset)); + LASSERTF(offsetof(struct niobuf_remote, len) == 8, " found %lld\n", + (long long)offsetof(struct niobuf_remote, len)); + LASSERTF((int)sizeof(((struct niobuf_remote *)0)->len) == 4, " found %lld\n", + (long long)(int)sizeof(((struct niobuf_remote *)0)->len)); + LASSERTF(offsetof(struct niobuf_remote, flags) == 12, " found %lld\n", + (long long)offsetof(struct niobuf_remote, flags)); + LASSERTF((int)sizeof(((struct niobuf_remote *)0)->flags) == 4, " found %lld\n", + (long long)(int)sizeof(((struct niobuf_remote *)0)->flags)); + LASSERTF(OBD_BRW_READ == 1, " found %lld\n", + (long long)OBD_BRW_READ); + LASSERTF(OBD_BRW_WRITE == 2, " found %lld\n", + (long long)OBD_BRW_WRITE); + LASSERTF(OBD_BRW_SYNC == 8, " found %lld\n", + (long long)OBD_BRW_SYNC); + LASSERTF(OBD_BRW_FROM_GRANT == 32, " found %lld\n", + (long long)OBD_BRW_FROM_GRANT); /* Checks for struct ost_body */ - LASSERT((int)sizeof(struct ost_body) == 168); - LASSERT(offsetof(struct ost_body, oa) == 0); - LASSERT((int)sizeof(((struct ost_body *)0)->oa) == 168); + LASSERTF((int)sizeof(struct ost_body) == 168, " found %lld\n", + (long long)(int)sizeof(struct ost_body)); + LASSERTF(offsetof(struct ost_body, oa) == 0, " found %lld\n", + (long long)offsetof(struct ost_body, oa)); + LASSERTF((int)sizeof(((struct ost_body *)0)->oa) == 168, " found %lld\n", + (long long)(int)sizeof(((struct ost_body *)0)->oa)); /* Checks for struct ll_fid */ - LASSERT((int)sizeof(struct ll_fid) == 16); - LASSERT(offsetof(struct ll_fid, id) == 0); - LASSERT((int)sizeof(((struct ll_fid *)0)->id) == 8); - LASSERT(offsetof(struct ll_fid, generation) == 8); - LASSERT((int)sizeof(((struct ll_fid *)0)->generation) == 4); - LASSERT(offsetof(struct ll_fid, f_type) == 12); - LASSERT((int)sizeof(((struct ll_fid *)0)->f_type) == 4); + LASSERTF((int)sizeof(struct ll_fid) == 16, " found %lld\n", + (long long)(int)sizeof(struct ll_fid)); + LASSERTF(offsetof(struct ll_fid, id) == 0, " found %lld\n", + (long long)offsetof(struct ll_fid, id)); + LASSERTF((int)sizeof(((struct ll_fid *)0)->id) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ll_fid *)0)->id)); + LASSERTF(offsetof(struct ll_fid, generation) == 8, " found %lld\n", + (long long)offsetof(struct ll_fid, generation)); + LASSERTF((int)sizeof(((struct ll_fid *)0)->generation) == 4, " found %lld\n", + (long long)(int)sizeof(((struct ll_fid *)0)->generation)); + LASSERTF(offsetof(struct ll_fid, f_type) == 12, " found %lld\n", + (long long)offsetof(struct ll_fid, f_type)); + LASSERTF((int)sizeof(((struct ll_fid *)0)->f_type) == 4, " found %lld\n", + (long long)(int)sizeof(((struct ll_fid *)0)->f_type)); /* Checks for struct mds_status_req */ - LASSERT((int)sizeof(struct mds_status_req) == 8); - LASSERT(offsetof(struct mds_status_req, flags) == 0); - LASSERT((int)sizeof(((struct mds_status_req *)0)->flags) == 4); - LASSERT(offsetof(struct mds_status_req, repbuf) == 4); - LASSERT((int)sizeof(((struct mds_status_req *)0)->repbuf) == 4); + LASSERTF((int)sizeof(struct mds_status_req) == 8, " found %lld\n", + (long long)(int)sizeof(struct mds_status_req)); + LASSERTF(offsetof(struct mds_status_req, flags) == 0, " found %lld\n", + (long long)offsetof(struct mds_status_req, flags)); + LASSERTF((int)sizeof(((struct mds_status_req *)0)->flags) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_status_req *)0)->flags)); + LASSERTF(offsetof(struct mds_status_req, repbuf) == 4, " found %lld\n", + (long long)offsetof(struct mds_status_req, repbuf)); + LASSERTF((int)sizeof(((struct mds_status_req *)0)->repbuf) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_status_req *)0)->repbuf)); /* Checks for struct mds_body */ - LASSERT((int)sizeof(struct mds_body) == 136); - LASSERT(offsetof(struct mds_body, fid1) == 0); - LASSERT((int)sizeof(((struct mds_body *)0)->fid1) == 16); - LASSERT(offsetof(struct mds_body, fid2) == 16); - LASSERT((int)sizeof(((struct mds_body *)0)->fid2) == 16); - LASSERT(offsetof(struct mds_body, handle) == 32); - LASSERT((int)sizeof(((struct mds_body *)0)->handle) == 8); - LASSERT(offsetof(struct mds_body, size) == 40); - LASSERT((int)sizeof(((struct mds_body *)0)->size) == 8); - LASSERT(offsetof(struct mds_body, blocks) == 48); - LASSERT((int)sizeof(((struct mds_body *)0)->blocks) == 8); - LASSERT(offsetof(struct mds_body, io_epoch) == 56); - LASSERT((int)sizeof(((struct mds_body *)0)->io_epoch) == 8); - LASSERT(offsetof(struct mds_body, ino) == 64); - LASSERT((int)sizeof(((struct mds_body *)0)->ino) == 4); - LASSERT(offsetof(struct mds_body, valid) == 68); - LASSERT((int)sizeof(((struct mds_body *)0)->valid) == 4); - LASSERT(offsetof(struct mds_body, fsuid) == 72); - LASSERT((int)sizeof(((struct mds_body *)0)->fsuid) == 4); - LASSERT(offsetof(struct mds_body, fsgid) == 76); - LASSERT((int)sizeof(((struct mds_body *)0)->fsgid) == 4); - LASSERT(offsetof(struct mds_body, capability) == 80); - LASSERT((int)sizeof(((struct mds_body *)0)->capability) == 4); - LASSERT(offsetof(struct mds_body, mode) == 84); - LASSERT((int)sizeof(((struct mds_body *)0)->mode) == 4); - LASSERT(offsetof(struct mds_body, uid) == 88); - LASSERT((int)sizeof(((struct mds_body *)0)->uid) == 4); - LASSERT(offsetof(struct mds_body, gid) == 92); - LASSERT((int)sizeof(((struct mds_body *)0)->gid) == 4); - LASSERT(offsetof(struct mds_body, mtime) == 96); - LASSERT((int)sizeof(((struct mds_body *)0)->mtime) == 4); - LASSERT(offsetof(struct mds_body, ctime) == 100); - LASSERT((int)sizeof(((struct mds_body *)0)->ctime) == 4); - LASSERT(offsetof(struct mds_body, atime) == 104); - LASSERT((int)sizeof(((struct mds_body *)0)->atime) == 4); - LASSERT(offsetof(struct mds_body, flags) == 108); - LASSERT((int)sizeof(((struct mds_body *)0)->flags) == 4); - LASSERT(offsetof(struct mds_body, rdev) == 112); - LASSERT((int)sizeof(((struct mds_body *)0)->rdev) == 4); - LASSERT(offsetof(struct mds_body, nlink) == 116); - LASSERT((int)sizeof(((struct mds_body *)0)->nlink) == 4); - LASSERT(offsetof(struct mds_body, generation) == 120); - LASSERT((int)sizeof(((struct mds_body *)0)->generation) == 4); - LASSERT(offsetof(struct mds_body, suppgid) == 124); - LASSERT((int)sizeof(((struct mds_body *)0)->suppgid) == 4); - LASSERT(offsetof(struct mds_body, eadatasize) == 128); - LASSERT((int)sizeof(((struct mds_body *)0)->eadatasize) == 4); - LASSERT(FMODE_READ == 1); - LASSERT(FMODE_WRITE == 2); - LASSERT(FMODE_EXEC == 4); - LASSERT(MDS_OPEN_CREAT == 64); - LASSERT(MDS_OPEN_EXCL == 128); - LASSERT(MDS_OPEN_TRUNC == 512); - LASSERT(MDS_OPEN_APPEND == 1024); - LASSERT(MDS_OPEN_SYNC == 4096); - LASSERT(MDS_OPEN_DIRECTORY == 65536); - LASSERT(MDS_OPEN_DELAY_CREATE == 16777216); - LASSERT(MDS_OPEN_HAS_EA == 1073741824); + LASSERTF((int)sizeof(struct mds_body) == 136, " found %lld\n", + (long long)(int)sizeof(struct mds_body)); + LASSERTF(offsetof(struct mds_body, fid1) == 0, " found %lld\n", + (long long)offsetof(struct mds_body, fid1)); + LASSERTF((int)sizeof(((struct mds_body *)0)->fid1) == 16, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->fid1)); + LASSERTF(offsetof(struct mds_body, fid2) == 16, " found %lld\n", + (long long)offsetof(struct mds_body, fid2)); + LASSERTF((int)sizeof(((struct mds_body *)0)->fid2) == 16, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->fid2)); + LASSERTF(offsetof(struct mds_body, handle) == 32, " found %lld\n", + (long long)offsetof(struct mds_body, handle)); + LASSERTF((int)sizeof(((struct mds_body *)0)->handle) == 8, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->handle)); + LASSERTF(offsetof(struct mds_body, size) == 40, " found %lld\n", + (long long)offsetof(struct mds_body, size)); + LASSERTF((int)sizeof(((struct mds_body *)0)->size) == 8, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->size)); + LASSERTF(offsetof(struct mds_body, blocks) == 48, " found %lld\n", + (long long)offsetof(struct mds_body, blocks)); + LASSERTF((int)sizeof(((struct mds_body *)0)->blocks) == 8, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->blocks)); + LASSERTF(offsetof(struct mds_body, io_epoch) == 56, " found %lld\n", + (long long)offsetof(struct mds_body, io_epoch)); + LASSERTF((int)sizeof(((struct mds_body *)0)->io_epoch) == 8, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->io_epoch)); + LASSERTF(offsetof(struct mds_body, ino) == 64, " found %lld\n", + (long long)offsetof(struct mds_body, ino)); + LASSERTF((int)sizeof(((struct mds_body *)0)->ino) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->ino)); + LASSERTF(offsetof(struct mds_body, valid) == 68, " found %lld\n", + (long long)offsetof(struct mds_body, valid)); + LASSERTF((int)sizeof(((struct mds_body *)0)->valid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->valid)); + LASSERTF(offsetof(struct mds_body, fsuid) == 72, " found %lld\n", + (long long)offsetof(struct mds_body, fsuid)); + LASSERTF((int)sizeof(((struct mds_body *)0)->fsuid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->fsuid)); + LASSERTF(offsetof(struct mds_body, fsgid) == 76, " found %lld\n", + (long long)offsetof(struct mds_body, fsgid)); + LASSERTF((int)sizeof(((struct mds_body *)0)->fsgid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->fsgid)); + LASSERTF(offsetof(struct mds_body, capability) == 80, " found %lld\n", + (long long)offsetof(struct mds_body, capability)); + LASSERTF((int)sizeof(((struct mds_body *)0)->capability) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->capability)); + LASSERTF(offsetof(struct mds_body, mode) == 84, " found %lld\n", + (long long)offsetof(struct mds_body, mode)); + LASSERTF((int)sizeof(((struct mds_body *)0)->mode) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->mode)); + LASSERTF(offsetof(struct mds_body, uid) == 88, " found %lld\n", + (long long)offsetof(struct mds_body, uid)); + LASSERTF((int)sizeof(((struct mds_body *)0)->uid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->uid)); + LASSERTF(offsetof(struct mds_body, gid) == 92, " found %lld\n", + (long long)offsetof(struct mds_body, gid)); + LASSERTF((int)sizeof(((struct mds_body *)0)->gid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->gid)); + LASSERTF(offsetof(struct mds_body, mtime) == 96, " found %lld\n", + (long long)offsetof(struct mds_body, mtime)); + LASSERTF((int)sizeof(((struct mds_body *)0)->mtime) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->mtime)); + LASSERTF(offsetof(struct mds_body, ctime) == 100, " found %lld\n", + (long long)offsetof(struct mds_body, ctime)); + LASSERTF((int)sizeof(((struct mds_body *)0)->ctime) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->ctime)); + LASSERTF(offsetof(struct mds_body, atime) == 104, " found %lld\n", + (long long)offsetof(struct mds_body, atime)); + LASSERTF((int)sizeof(((struct mds_body *)0)->atime) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->atime)); + LASSERTF(offsetof(struct mds_body, flags) == 108, " found %lld\n", + (long long)offsetof(struct mds_body, flags)); + LASSERTF((int)sizeof(((struct mds_body *)0)->flags) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->flags)); + LASSERTF(offsetof(struct mds_body, rdev) == 112, " found %lld\n", + (long long)offsetof(struct mds_body, rdev)); + LASSERTF((int)sizeof(((struct mds_body *)0)->rdev) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->rdev)); + LASSERTF(offsetof(struct mds_body, nlink) == 116, " found %lld\n", + (long long)offsetof(struct mds_body, nlink)); + LASSERTF((int)sizeof(((struct mds_body *)0)->nlink) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->nlink)); + LASSERTF(offsetof(struct mds_body, generation) == 120, " found %lld\n", + (long long)offsetof(struct mds_body, generation)); + LASSERTF((int)sizeof(((struct mds_body *)0)->generation) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->generation)); + LASSERTF(offsetof(struct mds_body, suppgid) == 124, " found %lld\n", + (long long)offsetof(struct mds_body, suppgid)); + LASSERTF((int)sizeof(((struct mds_body *)0)->suppgid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->suppgid)); + LASSERTF(offsetof(struct mds_body, eadatasize) == 128, " found %lld\n", + (long long)offsetof(struct mds_body, eadatasize)); + LASSERTF((int)sizeof(((struct mds_body *)0)->eadatasize) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->eadatasize)); + LASSERTF(FMODE_READ == 1, " found %lld\n", + (long long)FMODE_READ); + LASSERTF(FMODE_WRITE == 2, " found %lld\n", + (long long)FMODE_WRITE); + LASSERTF(FMODE_EXEC == 4, " found %lld\n", + (long long)FMODE_EXEC); + LASSERTF(MDS_OPEN_CREAT == 64, " found %lld\n", + (long long)MDS_OPEN_CREAT); + LASSERTF(MDS_OPEN_EXCL == 128, " found %lld\n", + (long long)MDS_OPEN_EXCL); + LASSERTF(MDS_OPEN_TRUNC == 512, " found %lld\n", + (long long)MDS_OPEN_TRUNC); + LASSERTF(MDS_OPEN_APPEND == 1024, " found %lld\n", + (long long)MDS_OPEN_APPEND); + LASSERTF(MDS_OPEN_SYNC == 4096, " found %lld\n", + (long long)MDS_OPEN_SYNC); + LASSERTF(MDS_OPEN_DIRECTORY == 65536, " found %lld\n", + (long long)MDS_OPEN_DIRECTORY); + LASSERTF(MDS_OPEN_DELAY_CREATE == 16777216, " found %lld\n", + (long long)MDS_OPEN_DELAY_CREATE); + LASSERTF(MDS_OPEN_HAS_EA == 1073741824, " found %lld\n", + (long long)MDS_OPEN_HAS_EA); /* Checks for struct mds_rec_setattr */ - LASSERT((int)sizeof(struct mds_rec_setattr) == 88); - LASSERT(offsetof(struct mds_rec_setattr, sa_opcode) == 0); - LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_opcode) == 4); - LASSERT(offsetof(struct mds_rec_setattr, sa_fsuid) == 4); - LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_fsuid) == 4); - LASSERT(offsetof(struct mds_rec_setattr, sa_fsgid) == 8); - LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_fsgid) == 4); - LASSERT(offsetof(struct mds_rec_setattr, sa_cap) == 12); - LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_cap) == 4); - LASSERT(offsetof(struct mds_rec_setattr, sa_suppgid) == 16); - LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_suppgid) == 4); - LASSERT(offsetof(struct mds_rec_setattr, sa_valid) == 20); - LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_valid) == 4); - LASSERT(offsetof(struct mds_rec_setattr, sa_fid) == 24); - LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_fid) == 16); - LASSERT(offsetof(struct mds_rec_setattr, sa_mode) == 40); - LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_mode) == 4); - LASSERT(offsetof(struct mds_rec_setattr, sa_uid) == 44); - LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_uid) == 4); - LASSERT(offsetof(struct mds_rec_setattr, sa_gid) == 48); - LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_gid) == 4); - LASSERT(offsetof(struct mds_rec_setattr, sa_attr_flags) == 52); - LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_attr_flags) == 4); - LASSERT(offsetof(struct mds_rec_setattr, sa_size) == 56); - LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_size) == 8); - LASSERT(offsetof(struct mds_rec_setattr, sa_atime) == 64); - LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_atime) == 8); - LASSERT(offsetof(struct mds_rec_setattr, sa_mtime) == 72); - LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_mtime) == 8); - LASSERT(offsetof(struct mds_rec_setattr, sa_ctime) == 80); - LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_ctime) == 8); + LASSERTF((int)sizeof(struct mds_rec_setattr) == 88, " found %lld\n", + (long long)(int)sizeof(struct mds_rec_setattr)); + LASSERTF(offsetof(struct mds_rec_setattr, sa_opcode) == 0, " found %lld\n", + (long long)offsetof(struct mds_rec_setattr, sa_opcode)); + LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_opcode) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_opcode)); + LASSERTF(offsetof(struct mds_rec_setattr, sa_fsuid) == 4, " found %lld\n", + (long long)offsetof(struct mds_rec_setattr, sa_fsuid)); + LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_fsuid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_fsuid)); + LASSERTF(offsetof(struct mds_rec_setattr, sa_fsgid) == 8, " found %lld\n", + (long long)offsetof(struct mds_rec_setattr, sa_fsgid)); + LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_fsgid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_fsgid)); + LASSERTF(offsetof(struct mds_rec_setattr, sa_cap) == 12, " found %lld\n", + (long long)offsetof(struct mds_rec_setattr, sa_cap)); + LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_cap) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_cap)); + LASSERTF(offsetof(struct mds_rec_setattr, sa_suppgid) == 16, " found %lld\n", + (long long)offsetof(struct mds_rec_setattr, sa_suppgid)); + LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_suppgid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_suppgid)); + LASSERTF(offsetof(struct mds_rec_setattr, sa_valid) == 20, " found %lld\n", + (long long)offsetof(struct mds_rec_setattr, sa_valid)); + LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_valid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_valid)); + LASSERTF(offsetof(struct mds_rec_setattr, sa_fid) == 24, " found %lld\n", + (long long)offsetof(struct mds_rec_setattr, sa_fid)); + LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_fid) == 16, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_fid)); + LASSERTF(offsetof(struct mds_rec_setattr, sa_mode) == 40, " found %lld\n", + (long long)offsetof(struct mds_rec_setattr, sa_mode)); + LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_mode) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_mode)); + LASSERTF(offsetof(struct mds_rec_setattr, sa_uid) == 44, " found %lld\n", + (long long)offsetof(struct mds_rec_setattr, sa_uid)); + LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_uid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_uid)); + LASSERTF(offsetof(struct mds_rec_setattr, sa_gid) == 48, " found %lld\n", + (long long)offsetof(struct mds_rec_setattr, sa_gid)); + LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_gid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_gid)); + LASSERTF(offsetof(struct mds_rec_setattr, sa_attr_flags) == 52, " found %lld\n", + (long long)offsetof(struct mds_rec_setattr, sa_attr_flags)); + LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_attr_flags) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_attr_flags)); + LASSERTF(offsetof(struct mds_rec_setattr, sa_size) == 56, " found %lld\n", + (long long)offsetof(struct mds_rec_setattr, sa_size)); + LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_size) == 8, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_size)); + LASSERTF(offsetof(struct mds_rec_setattr, sa_atime) == 64, " found %lld\n", + (long long)offsetof(struct mds_rec_setattr, sa_atime)); + LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_atime) == 8, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_atime)); + LASSERTF(offsetof(struct mds_rec_setattr, sa_mtime) == 72, " found %lld\n", + (long long)offsetof(struct mds_rec_setattr, sa_mtime)); + LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_mtime) == 8, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_mtime)); + LASSERTF(offsetof(struct mds_rec_setattr, sa_ctime) == 80, " found %lld\n", + (long long)offsetof(struct mds_rec_setattr, sa_ctime)); + LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_ctime) == 8, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_ctime)); /* Checks for struct mds_rec_create */ - LASSERT((int)sizeof(struct mds_rec_create) == 80); - LASSERT(offsetof(struct mds_rec_create, cr_opcode) == 0); - LASSERT((int)sizeof(((struct mds_rec_create *)0)->cr_opcode) == 4); - LASSERT(offsetof(struct mds_rec_create, cr_fsuid) == 4); - LASSERT((int)sizeof(((struct mds_rec_create *)0)->cr_fsuid) == 4); - LASSERT(offsetof(struct mds_rec_create, cr_fsgid) == 8); - LASSERT((int)sizeof(((struct mds_rec_create *)0)->cr_fsgid) == 4); - LASSERT(offsetof(struct mds_rec_create, cr_cap) == 12); - LASSERT((int)sizeof(((struct mds_rec_create *)0)->cr_cap) == 4); - LASSERT(offsetof(struct mds_rec_create, cr_flags) == 16); - LASSERT((int)sizeof(((struct mds_rec_create *)0)->cr_flags) == 4); - LASSERT(offsetof(struct mds_rec_create, cr_mode) == 20); - LASSERT((int)sizeof(((struct mds_rec_create *)0)->cr_mode) == 4); - LASSERT(offsetof(struct mds_rec_create, cr_fid) == 24); - LASSERT((int)sizeof(((struct mds_rec_create *)0)->cr_fid) == 16); - LASSERT(offsetof(struct mds_rec_create, cr_replayfid) == 40); - LASSERT((int)sizeof(((struct mds_rec_create *)0)->cr_replayfid) == 16); - LASSERT(offsetof(struct mds_rec_create, cr_time) == 56); - LASSERT((int)sizeof(((struct mds_rec_create *)0)->cr_time) == 8); - LASSERT(offsetof(struct mds_rec_create, cr_rdev) == 64); - LASSERT((int)sizeof(((struct mds_rec_create *)0)->cr_rdev) == 8); - LASSERT(offsetof(struct mds_rec_create, cr_suppgid) == 72); - LASSERT((int)sizeof(((struct mds_rec_create *)0)->cr_suppgid) == 4); + LASSERTF((int)sizeof(struct mds_rec_create) == 80, " found %lld\n", + (long long)(int)sizeof(struct mds_rec_create)); + LASSERTF(offsetof(struct mds_rec_create, cr_opcode) == 0, " found %lld\n", + (long long)offsetof(struct mds_rec_create, cr_opcode)); + LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_opcode) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_opcode)); + LASSERTF(offsetof(struct mds_rec_create, cr_fsuid) == 4, " found %lld\n", + (long long)offsetof(struct mds_rec_create, cr_fsuid)); + LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_fsuid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_fsuid)); + LASSERTF(offsetof(struct mds_rec_create, cr_fsgid) == 8, " found %lld\n", + (long long)offsetof(struct mds_rec_create, cr_fsgid)); + LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_fsgid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_fsgid)); + LASSERTF(offsetof(struct mds_rec_create, cr_cap) == 12, " found %lld\n", + (long long)offsetof(struct mds_rec_create, cr_cap)); + LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_cap) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_cap)); + LASSERTF(offsetof(struct mds_rec_create, cr_flags) == 16, " found %lld\n", + (long long)offsetof(struct mds_rec_create, cr_flags)); + LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_flags) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_flags)); + LASSERTF(offsetof(struct mds_rec_create, cr_mode) == 20, " found %lld\n", + (long long)offsetof(struct mds_rec_create, cr_mode)); + LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_mode) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_mode)); + LASSERTF(offsetof(struct mds_rec_create, cr_fid) == 24, " found %lld\n", + (long long)offsetof(struct mds_rec_create, cr_fid)); + LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_fid) == 16, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_fid)); + LASSERTF(offsetof(struct mds_rec_create, cr_replayfid) == 40, " found %lld\n", + (long long)offsetof(struct mds_rec_create, cr_replayfid)); + LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_replayfid) == 16, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_replayfid)); + LASSERTF(offsetof(struct mds_rec_create, cr_time) == 56, " found %lld\n", + (long long)offsetof(struct mds_rec_create, cr_time)); + LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_time) == 8, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_time)); + LASSERTF(offsetof(struct mds_rec_create, cr_rdev) == 64, " found %lld\n", + (long long)offsetof(struct mds_rec_create, cr_rdev)); + LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_rdev) == 8, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_rdev)); + LASSERTF(offsetof(struct mds_rec_create, cr_suppgid) == 72, " found %lld\n", + (long long)offsetof(struct mds_rec_create, cr_suppgid)); + LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_suppgid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_suppgid)); /* Checks for struct mds_rec_link */ - LASSERT((int)sizeof(struct mds_rec_link) == 64); - LASSERT(offsetof(struct mds_rec_link, lk_opcode) == 0); - LASSERT((int)sizeof(((struct mds_rec_link *)0)->lk_opcode) == 4); - LASSERT(offsetof(struct mds_rec_link, lk_fsuid) == 4); - LASSERT((int)sizeof(((struct mds_rec_link *)0)->lk_fsuid) == 4); - LASSERT(offsetof(struct mds_rec_link, lk_fsgid) == 8); - LASSERT((int)sizeof(((struct mds_rec_link *)0)->lk_fsgid) == 4); - LASSERT(offsetof(struct mds_rec_link, lk_cap) == 12); - LASSERT((int)sizeof(((struct mds_rec_link *)0)->lk_cap) == 4); - LASSERT(offsetof(struct mds_rec_link, lk_suppgid1) == 16); - LASSERT((int)sizeof(((struct mds_rec_link *)0)->lk_suppgid1) == 4); - LASSERT(offsetof(struct mds_rec_link, lk_suppgid2) == 20); - LASSERT((int)sizeof(((struct mds_rec_link *)0)->lk_suppgid2) == 4); - LASSERT(offsetof(struct mds_rec_link, lk_fid1) == 24); - LASSERT((int)sizeof(((struct mds_rec_link *)0)->lk_fid1) == 16); - LASSERT(offsetof(struct mds_rec_link, lk_fid2) == 40); - LASSERT((int)sizeof(((struct mds_rec_link *)0)->lk_fid2) == 16); - LASSERT(offsetof(struct mds_rec_link, lk_time) == 56); - LASSERT((int)sizeof(((struct mds_rec_link *)0)->lk_time) == 8); + LASSERTF((int)sizeof(struct mds_rec_link) == 64, " found %lld\n", + (long long)(int)sizeof(struct mds_rec_link)); + LASSERTF(offsetof(struct mds_rec_link, lk_opcode) == 0, " found %lld\n", + (long long)offsetof(struct mds_rec_link, lk_opcode)); + LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_opcode) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_opcode)); + LASSERTF(offsetof(struct mds_rec_link, lk_fsuid) == 4, " found %lld\n", + (long long)offsetof(struct mds_rec_link, lk_fsuid)); + LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_fsuid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_fsuid)); + LASSERTF(offsetof(struct mds_rec_link, lk_fsgid) == 8, " found %lld\n", + (long long)offsetof(struct mds_rec_link, lk_fsgid)); + LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_fsgid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_fsgid)); + LASSERTF(offsetof(struct mds_rec_link, lk_cap) == 12, " found %lld\n", + (long long)offsetof(struct mds_rec_link, lk_cap)); + LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_cap) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_cap)); + LASSERTF(offsetof(struct mds_rec_link, lk_suppgid1) == 16, " found %lld\n", + (long long)offsetof(struct mds_rec_link, lk_suppgid1)); + LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_suppgid1) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_suppgid1)); + LASSERTF(offsetof(struct mds_rec_link, lk_suppgid2) == 20, " found %lld\n", + (long long)offsetof(struct mds_rec_link, lk_suppgid2)); + LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_suppgid2) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_suppgid2)); + LASSERTF(offsetof(struct mds_rec_link, lk_fid1) == 24, " found %lld\n", + (long long)offsetof(struct mds_rec_link, lk_fid1)); + LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_fid1) == 16, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_fid1)); + LASSERTF(offsetof(struct mds_rec_link, lk_fid2) == 40, " found %lld\n", + (long long)offsetof(struct mds_rec_link, lk_fid2)); + LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_fid2) == 16, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_fid2)); + LASSERTF(offsetof(struct mds_rec_link, lk_time) == 56, " found %lld\n", + (long long)offsetof(struct mds_rec_link, lk_time)); + LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_time) == 8, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_time)); /* Checks for struct mds_rec_unlink */ - LASSERT((int)sizeof(struct mds_rec_unlink) == 64); - LASSERT(offsetof(struct mds_rec_unlink, ul_opcode) == 0); - LASSERT((int)sizeof(((struct mds_rec_unlink *)0)->ul_opcode) == 4); - LASSERT(offsetof(struct mds_rec_unlink, ul_fsuid) == 4); - LASSERT((int)sizeof(((struct mds_rec_unlink *)0)->ul_fsuid) == 4); - LASSERT(offsetof(struct mds_rec_unlink, ul_fsgid) == 8); - LASSERT((int)sizeof(((struct mds_rec_unlink *)0)->ul_fsgid) == 4); - LASSERT(offsetof(struct mds_rec_unlink, ul_cap) == 12); - LASSERT((int)sizeof(((struct mds_rec_unlink *)0)->ul_cap) == 4); - LASSERT(offsetof(struct mds_rec_unlink, ul_suppgid) == 16); - LASSERT((int)sizeof(((struct mds_rec_unlink *)0)->ul_suppgid) == 4); - LASSERT(offsetof(struct mds_rec_unlink, ul_mode) == 20); - LASSERT((int)sizeof(((struct mds_rec_unlink *)0)->ul_mode) == 4); - LASSERT(offsetof(struct mds_rec_unlink, ul_fid1) == 24); - LASSERT((int)sizeof(((struct mds_rec_unlink *)0)->ul_fid1) == 16); - LASSERT(offsetof(struct mds_rec_unlink, ul_fid2) == 40); - LASSERT((int)sizeof(((struct mds_rec_unlink *)0)->ul_fid2) == 16); - LASSERT(offsetof(struct mds_rec_unlink, ul_time) == 56); - LASSERT((int)sizeof(((struct mds_rec_unlink *)0)->ul_time) == 8); + LASSERTF((int)sizeof(struct mds_rec_unlink) == 64, " found %lld\n", + (long long)(int)sizeof(struct mds_rec_unlink)); + LASSERTF(offsetof(struct mds_rec_unlink, ul_opcode) == 0, " found %lld\n", + (long long)offsetof(struct mds_rec_unlink, ul_opcode)); + LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_opcode) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_opcode)); + LASSERTF(offsetof(struct mds_rec_unlink, ul_fsuid) == 4, " found %lld\n", + (long long)offsetof(struct mds_rec_unlink, ul_fsuid)); + LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_fsuid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_fsuid)); + LASSERTF(offsetof(struct mds_rec_unlink, ul_fsgid) == 8, " found %lld\n", + (long long)offsetof(struct mds_rec_unlink, ul_fsgid)); + LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_fsgid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_fsgid)); + LASSERTF(offsetof(struct mds_rec_unlink, ul_cap) == 12, " found %lld\n", + (long long)offsetof(struct mds_rec_unlink, ul_cap)); + LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_cap) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_cap)); + LASSERTF(offsetof(struct mds_rec_unlink, ul_suppgid) == 16, " found %lld\n", + (long long)offsetof(struct mds_rec_unlink, ul_suppgid)); + LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_suppgid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_suppgid)); + LASSERTF(offsetof(struct mds_rec_unlink, ul_mode) == 20, " found %lld\n", + (long long)offsetof(struct mds_rec_unlink, ul_mode)); + LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_mode) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_mode)); + LASSERTF(offsetof(struct mds_rec_unlink, ul_fid1) == 24, " found %lld\n", + (long long)offsetof(struct mds_rec_unlink, ul_fid1)); + LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_fid1) == 16, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_fid1)); + LASSERTF(offsetof(struct mds_rec_unlink, ul_fid2) == 40, " found %lld\n", + (long long)offsetof(struct mds_rec_unlink, ul_fid2)); + LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_fid2) == 16, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_fid2)); + LASSERTF(offsetof(struct mds_rec_unlink, ul_time) == 56, " found %lld\n", + (long long)offsetof(struct mds_rec_unlink, ul_time)); + LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_time) == 8, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_time)); /* Checks for struct mds_rec_rename */ - LASSERT((int)sizeof(struct mds_rec_rename) == 64); - LASSERT(offsetof(struct mds_rec_rename, rn_opcode) == 0); - LASSERT((int)sizeof(((struct mds_rec_rename *)0)->rn_opcode) == 4); - LASSERT(offsetof(struct mds_rec_rename, rn_fsuid) == 4); - LASSERT((int)sizeof(((struct mds_rec_rename *)0)->rn_fsuid) == 4); - LASSERT(offsetof(struct mds_rec_rename, rn_fsgid) == 8); - LASSERT((int)sizeof(((struct mds_rec_rename *)0)->rn_fsgid) == 4); - LASSERT(offsetof(struct mds_rec_rename, rn_cap) == 12); - LASSERT((int)sizeof(((struct mds_rec_rename *)0)->rn_cap) == 4); - LASSERT(offsetof(struct mds_rec_rename, rn_suppgid1) == 16); - LASSERT((int)sizeof(((struct mds_rec_rename *)0)->rn_suppgid1) == 4); - LASSERT(offsetof(struct mds_rec_rename, rn_suppgid2) == 20); - LASSERT((int)sizeof(((struct mds_rec_rename *)0)->rn_suppgid2) == 4); - LASSERT(offsetof(struct mds_rec_rename, rn_fid1) == 24); - LASSERT((int)sizeof(((struct mds_rec_rename *)0)->rn_fid1) == 16); - LASSERT(offsetof(struct mds_rec_rename, rn_fid2) == 40); - LASSERT((int)sizeof(((struct mds_rec_rename *)0)->rn_fid2) == 16); - LASSERT(offsetof(struct mds_rec_rename, rn_time) == 56); - LASSERT((int)sizeof(((struct mds_rec_rename *)0)->rn_time) == 8); + LASSERTF((int)sizeof(struct mds_rec_rename) == 64, " found %lld\n", + (long long)(int)sizeof(struct mds_rec_rename)); + LASSERTF(offsetof(struct mds_rec_rename, rn_opcode) == 0, " found %lld\n", + (long long)offsetof(struct mds_rec_rename, rn_opcode)); + LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_opcode) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_opcode)); + LASSERTF(offsetof(struct mds_rec_rename, rn_fsuid) == 4, " found %lld\n", + (long long)offsetof(struct mds_rec_rename, rn_fsuid)); + LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_fsuid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_fsuid)); + LASSERTF(offsetof(struct mds_rec_rename, rn_fsgid) == 8, " found %lld\n", + (long long)offsetof(struct mds_rec_rename, rn_fsgid)); + LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_fsgid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_fsgid)); + LASSERTF(offsetof(struct mds_rec_rename, rn_cap) == 12, " found %lld\n", + (long long)offsetof(struct mds_rec_rename, rn_cap)); + LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_cap) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_cap)); + LASSERTF(offsetof(struct mds_rec_rename, rn_suppgid1) == 16, " found %lld\n", + (long long)offsetof(struct mds_rec_rename, rn_suppgid1)); + LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_suppgid1) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_suppgid1)); + LASSERTF(offsetof(struct mds_rec_rename, rn_suppgid2) == 20, " found %lld\n", + (long long)offsetof(struct mds_rec_rename, rn_suppgid2)); + LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_suppgid2) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_suppgid2)); + LASSERTF(offsetof(struct mds_rec_rename, rn_fid1) == 24, " found %lld\n", + (long long)offsetof(struct mds_rec_rename, rn_fid1)); + LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_fid1) == 16, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_fid1)); + LASSERTF(offsetof(struct mds_rec_rename, rn_fid2) == 40, " found %lld\n", + (long long)offsetof(struct mds_rec_rename, rn_fid2)); + LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_fid2) == 16, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_fid2)); + LASSERTF(offsetof(struct mds_rec_rename, rn_time) == 56, " found %lld\n", + (long long)offsetof(struct mds_rec_rename, rn_time)); + LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_time) == 8, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_time)); /* Checks for struct lov_desc */ - LASSERT((int)sizeof(struct lov_desc) == 72); - LASSERT(offsetof(struct lov_desc, ld_tgt_count) == 0); - LASSERT((int)sizeof(((struct lov_desc *)0)->ld_tgt_count) == 4); - LASSERT(offsetof(struct lov_desc, ld_active_tgt_count) == 4); - LASSERT((int)sizeof(((struct lov_desc *)0)->ld_active_tgt_count) == 4); - LASSERT(offsetof(struct lov_desc, ld_default_stripe_count) == 8); - LASSERT((int)sizeof(((struct lov_desc *)0)->ld_default_stripe_count) == 4); - LASSERT(offsetof(struct lov_desc, ld_pattern) == 12); - LASSERT((int)sizeof(((struct lov_desc *)0)->ld_pattern) == 4); - LASSERT(offsetof(struct lov_desc, ld_default_stripe_size) == 16); - LASSERT((int)sizeof(((struct lov_desc *)0)->ld_default_stripe_size) == 8); - LASSERT(offsetof(struct lov_desc, ld_default_stripe_offset) == 24); - LASSERT((int)sizeof(((struct lov_desc *)0)->ld_default_stripe_offset) == 8); - LASSERT(offsetof(struct lov_desc, ld_uuid) == 32); - LASSERT((int)sizeof(((struct lov_desc *)0)->ld_uuid) == 40); + LASSERTF((int)sizeof(struct lov_desc) == 72, " found %lld\n", + (long long)(int)sizeof(struct lov_desc)); + LASSERTF(offsetof(struct lov_desc, ld_tgt_count) == 0, " found %lld\n", + (long long)offsetof(struct lov_desc, ld_tgt_count)); + LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_tgt_count) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lov_desc *)0)->ld_tgt_count)); + LASSERTF(offsetof(struct lov_desc, ld_active_tgt_count) == 4, " found %lld\n", + (long long)offsetof(struct lov_desc, ld_active_tgt_count)); + LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_active_tgt_count) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lov_desc *)0)->ld_active_tgt_count)); + LASSERTF(offsetof(struct lov_desc, ld_default_stripe_count) == 8, " found %lld\n", + (long long)offsetof(struct lov_desc, ld_default_stripe_count)); + LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_default_stripe_count) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lov_desc *)0)->ld_default_stripe_count)); + LASSERTF(offsetof(struct lov_desc, ld_pattern) == 12, " found %lld\n", + (long long)offsetof(struct lov_desc, ld_pattern)); + LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_pattern) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lov_desc *)0)->ld_pattern)); + LASSERTF(offsetof(struct lov_desc, ld_default_stripe_size) == 16, " found %lld\n", + (long long)offsetof(struct lov_desc, ld_default_stripe_size)); + LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_default_stripe_size) == 8, " found %lld\n", + (long long)(int)sizeof(((struct lov_desc *)0)->ld_default_stripe_size)); + LASSERTF(offsetof(struct lov_desc, ld_default_stripe_offset) == 24, " found %lld\n", + (long long)offsetof(struct lov_desc, ld_default_stripe_offset)); + LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_default_stripe_offset) == 8, " found %lld\n", + (long long)(int)sizeof(((struct lov_desc *)0)->ld_default_stripe_offset)); + LASSERTF(offsetof(struct lov_desc, ld_uuid) == 32, " found %lld\n", + (long long)offsetof(struct lov_desc, ld_uuid)); + LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_uuid) == 40, " found %lld\n", + (long long)(int)sizeof(((struct lov_desc *)0)->ld_uuid)); /* Checks for struct ldlm_res_id */ - LASSERT((int)sizeof(struct ldlm_res_id) == 32); - LASSERT(offsetof(struct ldlm_res_id, name[4]) == 32); - LASSERT((int)sizeof(((struct ldlm_res_id *)0)->name[4]) == 8); + LASSERTF((int)sizeof(struct ldlm_res_id) == 32, " found %lld\n", + (long long)(int)sizeof(struct ldlm_res_id)); + LASSERTF(offsetof(struct ldlm_res_id, name[4]) == 32, " found %lld\n", + (long long)offsetof(struct ldlm_res_id, name[4])); + LASSERTF((int)sizeof(((struct ldlm_res_id *)0)->name[4]) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_res_id *)0)->name[4])); /* Checks for struct ldlm_extent */ - LASSERT((int)sizeof(struct ldlm_extent) == 16); - LASSERT(offsetof(struct ldlm_extent, start) == 0); - LASSERT((int)sizeof(((struct ldlm_extent *)0)->start) == 8); - LASSERT(offsetof(struct ldlm_extent, end) == 8); - LASSERT((int)sizeof(((struct ldlm_extent *)0)->end) == 8); + LASSERTF((int)sizeof(struct ldlm_extent) == 16, " found %lld\n", + (long long)(int)sizeof(struct ldlm_extent)); + LASSERTF(offsetof(struct ldlm_extent, start) == 0, " found %lld\n", + (long long)offsetof(struct ldlm_extent, start)); + LASSERTF((int)sizeof(((struct ldlm_extent *)0)->start) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_extent *)0)->start)); + LASSERTF(offsetof(struct ldlm_extent, end) == 8, " found %lld\n", + (long long)offsetof(struct ldlm_extent, end)); + LASSERTF((int)sizeof(((struct ldlm_extent *)0)->end) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_extent *)0)->end)); /* Checks for struct ldlm_flock */ - LASSERT((int)sizeof(struct ldlm_flock) == 32); - LASSERT(offsetof(struct ldlm_flock, start) == 0); - LASSERT((int)sizeof(((struct ldlm_flock *)0)->start) == 8); - LASSERT(offsetof(struct ldlm_flock, end) == 8); - LASSERT((int)sizeof(((struct ldlm_flock *)0)->end) == 8); - LASSERT(offsetof(struct ldlm_flock, blocking_export) == 16); - LASSERT((int)sizeof(((struct ldlm_flock *)0)->blocking_export) == 8); - LASSERT(offsetof(struct ldlm_flock, blocking_pid) == 24); - LASSERT((int)sizeof(((struct ldlm_flock *)0)->blocking_pid) == 4); - LASSERT(offsetof(struct ldlm_flock, pid) == 28); - LASSERT((int)sizeof(((struct ldlm_flock *)0)->pid) == 4); + LASSERTF((int)sizeof(struct ldlm_flock) == 32, " found %lld\n", + (long long)(int)sizeof(struct ldlm_flock)); + LASSERTF(offsetof(struct ldlm_flock, start) == 0, " found %lld\n", + (long long)offsetof(struct ldlm_flock, start)); + LASSERTF((int)sizeof(((struct ldlm_flock *)0)->start) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_flock *)0)->start)); + LASSERTF(offsetof(struct ldlm_flock, end) == 8, " found %lld\n", + (long long)offsetof(struct ldlm_flock, end)); + LASSERTF((int)sizeof(((struct ldlm_flock *)0)->end) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_flock *)0)->end)); + LASSERTF(offsetof(struct ldlm_flock, blocking_export) == 16, " found %lld\n", + (long long)offsetof(struct ldlm_flock, blocking_export)); + LASSERTF((int)sizeof(((struct ldlm_flock *)0)->blocking_export) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_flock *)0)->blocking_export)); + LASSERTF(offsetof(struct ldlm_flock, blocking_pid) == 24, " found %lld\n", + (long long)offsetof(struct ldlm_flock, blocking_pid)); + LASSERTF((int)sizeof(((struct ldlm_flock *)0)->blocking_pid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_flock *)0)->blocking_pid)); + LASSERTF(offsetof(struct ldlm_flock, pid) == 28, " found %lld\n", + (long long)offsetof(struct ldlm_flock, pid)); + LASSERTF((int)sizeof(((struct ldlm_flock *)0)->pid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_flock *)0)->pid)); /* Checks for struct ldlm_intent */ - LASSERT((int)sizeof(struct ldlm_intent) == 8); - LASSERT(offsetof(struct ldlm_intent, opc) == 0); - LASSERT((int)sizeof(((struct ldlm_intent *)0)->opc) == 8); + LASSERTF((int)sizeof(struct ldlm_intent) == 8, " found %lld\n", + (long long)(int)sizeof(struct ldlm_intent)); + LASSERTF(offsetof(struct ldlm_intent, opc) == 0, " found %lld\n", + (long long)offsetof(struct ldlm_intent, opc)); + LASSERTF((int)sizeof(((struct ldlm_intent *)0)->opc) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_intent *)0)->opc)); /* Checks for struct ldlm_resource_desc */ - LASSERT((int)sizeof(struct ldlm_resource_desc) == 40); - LASSERT(offsetof(struct ldlm_resource_desc, lr_type) == 0); - LASSERT((int)sizeof(((struct ldlm_resource_desc *)0)->lr_type) == 4); - LASSERT(offsetof(struct ldlm_resource_desc, lr_name) == 8); - LASSERT((int)sizeof(((struct ldlm_resource_desc *)0)->lr_name) == 32); + LASSERTF((int)sizeof(struct ldlm_resource_desc) == 40, " found %lld\n", + (long long)(int)sizeof(struct ldlm_resource_desc)); + LASSERTF(offsetof(struct ldlm_resource_desc, lr_type) == 0, " found %lld\n", + (long long)offsetof(struct ldlm_resource_desc, lr_type)); + LASSERTF((int)sizeof(((struct ldlm_resource_desc *)0)->lr_type) == 4, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_resource_desc *)0)->lr_type)); + LASSERTF(offsetof(struct ldlm_resource_desc, lr_name) == 8, " found %lld\n", + (long long)offsetof(struct ldlm_resource_desc, lr_name)); + LASSERTF((int)sizeof(((struct ldlm_resource_desc *)0)->lr_name) == 32, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_resource_desc *)0)->lr_name)); /* Checks for struct ldlm_lock_desc */ - LASSERT((int)sizeof(struct ldlm_lock_desc) == 108); - LASSERT(offsetof(struct ldlm_lock_desc, l_resource) == 0); - LASSERT((int)sizeof(((struct ldlm_lock_desc *)0)->l_resource) == 52); - LASSERT(offsetof(struct ldlm_lock_desc, l_req_mode) == 52); - LASSERT((int)sizeof(((struct ldlm_lock_desc *)0)->l_req_mode) == 4); - LASSERT(offsetof(struct ldlm_lock_desc, l_granted_mode) == 56); - LASSERT((int)sizeof(((struct ldlm_lock_desc *)0)->l_granted_mode) == 4); - LASSERT(offsetof(struct ldlm_lock_desc, l_policy_data) == 60); - LASSERT((int)sizeof(((struct ldlm_lock_desc *)0)->l_policy_data) == 32); - LASSERT(offsetof(struct ldlm_lock_desc, l_version[4]) == 108); - LASSERT((int)sizeof(((struct ldlm_lock_desc *)0)->l_version[4]) == 4); + LASSERTF((int)sizeof(struct ldlm_lock_desc) == 80, " found %lld\n", + (long long)(int)sizeof(struct ldlm_lock_desc)); + LASSERTF(offsetof(struct ldlm_lock_desc, l_resource) == 0, " found %lld\n", + (long long)offsetof(struct ldlm_lock_desc, l_resource)); + LASSERTF((int)sizeof(((struct ldlm_lock_desc *)0)->l_resource) == 40, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_lock_desc *)0)->l_resource)); + LASSERTF(offsetof(struct ldlm_lock_desc, l_req_mode) == 40, " found %lld\n", + (long long)offsetof(struct ldlm_lock_desc, l_req_mode)); + LASSERTF((int)sizeof(((struct ldlm_lock_desc *)0)->l_req_mode) == 4, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_lock_desc *)0)->l_req_mode)); + LASSERTF(offsetof(struct ldlm_lock_desc, l_granted_mode) == 44, " found %lld\n", + (long long)offsetof(struct ldlm_lock_desc, l_granted_mode)); + LASSERTF((int)sizeof(((struct ldlm_lock_desc *)0)->l_granted_mode) == 4, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_lock_desc *)0)->l_granted_mode)); + LASSERTF(offsetof(struct ldlm_lock_desc, l_policy_data) == 48, " found %lld\n", + (long long)offsetof(struct ldlm_lock_desc, l_policy_data)); + LASSERTF((int)sizeof(((struct ldlm_lock_desc *)0)->l_policy_data) == 32, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_lock_desc *)0)->l_policy_data)); /* Checks for struct ldlm_request */ - LASSERT((int)sizeof(struct ldlm_request) == 128); - LASSERT(offsetof(struct ldlm_request, lock_flags) == 0); - LASSERT((int)sizeof(((struct ldlm_request *)0)->lock_flags) == 4); - LASSERT(offsetof(struct ldlm_request, lock_desc) == 4); - LASSERT((int)sizeof(((struct ldlm_request *)0)->lock_desc) == 108); - LASSERT(offsetof(struct ldlm_request, lock_handle1) == 112); - LASSERT((int)sizeof(((struct ldlm_request *)0)->lock_handle1) == 8); - LASSERT(offsetof(struct ldlm_request, lock_handle2) == 120); - LASSERT((int)sizeof(((struct ldlm_request *)0)->lock_handle2) == 8); + LASSERTF((int)sizeof(struct ldlm_request) == 104, " found %lld\n", + (long long)(int)sizeof(struct ldlm_request)); + LASSERTF(offsetof(struct ldlm_request, lock_flags) == 0, " found %lld\n", + (long long)offsetof(struct ldlm_request, lock_flags)); + LASSERTF((int)sizeof(((struct ldlm_request *)0)->lock_flags) == 4, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_request *)0)->lock_flags)); + LASSERTF(offsetof(struct ldlm_request, lock_desc) == 8, " found %lld\n", + (long long)offsetof(struct ldlm_request, lock_desc)); + LASSERTF((int)sizeof(((struct ldlm_request *)0)->lock_desc) == 80, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_request *)0)->lock_desc)); + LASSERTF(offsetof(struct ldlm_request, lock_handle1) == 88, " found %lld\n", + (long long)offsetof(struct ldlm_request, lock_handle1)); + LASSERTF((int)sizeof(((struct ldlm_request *)0)->lock_handle1) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_request *)0)->lock_handle1)); + LASSERTF(offsetof(struct ldlm_request, lock_handle2) == 96, " found %lld\n", + (long long)offsetof(struct ldlm_request, lock_handle2)); + LASSERTF((int)sizeof(((struct ldlm_request *)0)->lock_handle2) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_request *)0)->lock_handle2)); /* Checks for struct ldlm_reply */ - LASSERT((int)sizeof(struct ldlm_reply) == 96); - LASSERT(offsetof(struct ldlm_reply, lock_flags) == 0); - LASSERT((int)sizeof(((struct ldlm_reply *)0)->lock_flags) == 4); - LASSERT(offsetof(struct ldlm_reply, lock_mode) == 4); - LASSERT((int)sizeof(((struct ldlm_reply *)0)->lock_mode) == 4); - LASSERT(offsetof(struct ldlm_reply, lock_resource_name) == 8); - LASSERT((int)sizeof(((struct ldlm_reply *)0)->lock_resource_name) == 32); - LASSERT(offsetof(struct ldlm_reply, lock_handle) == 40); - LASSERT((int)sizeof(((struct ldlm_reply *)0)->lock_handle) == 8); - LASSERT(offsetof(struct ldlm_reply, lock_policy_data) == 48); - LASSERT((int)sizeof(((struct ldlm_reply *)0)->lock_policy_data) == 32); - LASSERT(offsetof(struct ldlm_reply, lock_policy_res1) == 80); - LASSERT((int)sizeof(((struct ldlm_reply *)0)->lock_policy_res1) == 8); - LASSERT(offsetof(struct ldlm_reply, lock_policy_res2) == 88); - LASSERT((int)sizeof(((struct ldlm_reply *)0)->lock_policy_res2) == 8); + LASSERTF((int)sizeof(struct ldlm_reply) == 112, " found %lld\n", + (long long)(int)sizeof(struct ldlm_reply)); + LASSERTF(offsetof(struct ldlm_reply, lock_flags) == 0, " found %lld\n", + (long long)offsetof(struct ldlm_reply, lock_flags)); + LASSERTF((int)sizeof(((struct ldlm_reply *)0)->lock_flags) == 4, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_reply *)0)->lock_flags)); + LASSERTF(offsetof(struct ldlm_request, lock_desc) == 8, " found %lld\n", + (long long)offsetof(struct ldlm_request, lock_desc)); + LASSERTF((int)sizeof(((struct ldlm_request *)0)->lock_desc) == 80, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_request *)0)->lock_desc)); + LASSERTF(offsetof(struct ldlm_reply, lock_handle) == 88, " found %lld\n", + (long long)offsetof(struct ldlm_reply, lock_handle)); + LASSERTF((int)sizeof(((struct ldlm_reply *)0)->lock_handle) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_reply *)0)->lock_handle)); + LASSERTF(offsetof(struct ldlm_reply, lock_policy_res1) == 96, " found %lld\n", + (long long)offsetof(struct ldlm_reply, lock_policy_res1)); + LASSERTF((int)sizeof(((struct ldlm_reply *)0)->lock_policy_res1) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_reply *)0)->lock_policy_res1)); + LASSERTF(offsetof(struct ldlm_reply, lock_policy_res2) == 104, " found %lld\n", + (long long)offsetof(struct ldlm_reply, lock_policy_res2)); + LASSERTF((int)sizeof(((struct ldlm_reply *)0)->lock_policy_res2) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_reply *)0)->lock_policy_res2)); + + /* Checks for struct ost_lvb */ + LASSERTF((int)sizeof(struct ost_lvb) == 40, " found %lld\n", + (long long)(int)sizeof(struct ost_lvb)); + LASSERTF(offsetof(struct ost_lvb, lvb_size) == 0, " found %lld\n", + (long long)offsetof(struct ost_lvb, lvb_size)); + LASSERTF((int)sizeof(((struct ost_lvb *)0)->lvb_size) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ost_lvb *)0)->lvb_size)); + LASSERTF(offsetof(struct ost_lvb, lvb_mtime) == 8, " found %lld\n", + (long long)offsetof(struct ost_lvb, lvb_mtime)); + LASSERTF((int)sizeof(((struct ost_lvb *)0)->lvb_mtime) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ost_lvb *)0)->lvb_mtime)); + LASSERTF(offsetof(struct ost_lvb, lvb_atime) == 16, " found %lld\n", + (long long)offsetof(struct ost_lvb, lvb_atime)); + LASSERTF((int)sizeof(((struct ost_lvb *)0)->lvb_atime) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ost_lvb *)0)->lvb_atime)); + LASSERTF(offsetof(struct ost_lvb, lvb_ctime) == 24, " found %lld\n", + (long long)offsetof(struct ost_lvb, lvb_ctime)); + LASSERTF((int)sizeof(((struct ost_lvb *)0)->lvb_ctime) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ost_lvb *)0)->lvb_ctime)); + LASSERTF(offsetof(struct ost_lvb, lvb_blocks) == 32, " found %lld\n", + (long long)offsetof(struct ost_lvb, lvb_blocks)); + LASSERTF((int)sizeof(((struct ost_lvb *)0)->lvb_blocks) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ost_lvb *)0)->lvb_blocks)); /* Checks for struct ptlbd_op */ - LASSERT((int)sizeof(struct ptlbd_op) == 12); - LASSERT(offsetof(struct ptlbd_op, op_cmd) == 0); - LASSERT((int)sizeof(((struct ptlbd_op *)0)->op_cmd) == 2); - LASSERT(offsetof(struct ptlbd_op, op_lun) == 2); - LASSERT((int)sizeof(((struct ptlbd_op *)0)->op_lun) == 2); - LASSERT(offsetof(struct ptlbd_op, op_niob_cnt) == 4); - LASSERT((int)sizeof(((struct ptlbd_op *)0)->op_niob_cnt) == 2); - LASSERT(offsetof(struct ptlbd_op, op__padding) == 6); - LASSERT((int)sizeof(((struct ptlbd_op *)0)->op__padding) == 2); - LASSERT(offsetof(struct ptlbd_op, op_block_cnt) == 8); - LASSERT((int)sizeof(((struct ptlbd_op *)0)->op_block_cnt) == 4); + LASSERTF((int)sizeof(struct ptlbd_op) == 12, " found %lld\n", + (long long)(int)sizeof(struct ptlbd_op)); + LASSERTF(offsetof(struct ptlbd_op, op_cmd) == 0, " found %lld\n", + (long long)offsetof(struct ptlbd_op, op_cmd)); + LASSERTF((int)sizeof(((struct ptlbd_op *)0)->op_cmd) == 2, " found %lld\n", + (long long)(int)sizeof(((struct ptlbd_op *)0)->op_cmd)); + LASSERTF(offsetof(struct ptlbd_op, op_lun) == 2, " found %lld\n", + (long long)offsetof(struct ptlbd_op, op_lun)); + LASSERTF((int)sizeof(((struct ptlbd_op *)0)->op_lun) == 2, " found %lld\n", + (long long)(int)sizeof(((struct ptlbd_op *)0)->op_lun)); + LASSERTF(offsetof(struct ptlbd_op, op_niob_cnt) == 4, " found %lld\n", + (long long)offsetof(struct ptlbd_op, op_niob_cnt)); + LASSERTF((int)sizeof(((struct ptlbd_op *)0)->op_niob_cnt) == 2, " found %lld\n", + (long long)(int)sizeof(((struct ptlbd_op *)0)->op_niob_cnt)); + LASSERTF(offsetof(struct ptlbd_op, op__padding) == 6, " found %lld\n", + (long long)offsetof(struct ptlbd_op, op__padding)); + LASSERTF((int)sizeof(((struct ptlbd_op *)0)->op__padding) == 2, " found %lld\n", + (long long)(int)sizeof(((struct ptlbd_op *)0)->op__padding)); + LASSERTF(offsetof(struct ptlbd_op, op_block_cnt) == 8, " found %lld\n", + (long long)offsetof(struct ptlbd_op, op_block_cnt)); + LASSERTF((int)sizeof(((struct ptlbd_op *)0)->op_block_cnt) == 4, " found %lld\n", + (long long)(int)sizeof(((struct ptlbd_op *)0)->op_block_cnt)); /* Checks for struct ptlbd_niob */ - LASSERT((int)sizeof(struct ptlbd_niob) == 24); - LASSERT(offsetof(struct ptlbd_niob, n_xid) == 0); - LASSERT((int)sizeof(((struct ptlbd_niob *)0)->n_xid) == 8); - LASSERT(offsetof(struct ptlbd_niob, n_block_nr) == 8); - LASSERT((int)sizeof(((struct ptlbd_niob *)0)->n_block_nr) == 8); - LASSERT(offsetof(struct ptlbd_niob, n_offset) == 16); - LASSERT((int)sizeof(((struct ptlbd_niob *)0)->n_offset) == 4); - LASSERT(offsetof(struct ptlbd_niob, n_length) == 20); - LASSERT((int)sizeof(((struct ptlbd_niob *)0)->n_length) == 4); + LASSERTF((int)sizeof(struct ptlbd_niob) == 24, " found %lld\n", + (long long)(int)sizeof(struct ptlbd_niob)); + LASSERTF(offsetof(struct ptlbd_niob, n_xid) == 0, " found %lld\n", + (long long)offsetof(struct ptlbd_niob, n_xid)); + LASSERTF((int)sizeof(((struct ptlbd_niob *)0)->n_xid) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ptlbd_niob *)0)->n_xid)); + LASSERTF(offsetof(struct ptlbd_niob, n_block_nr) == 8, " found %lld\n", + (long long)offsetof(struct ptlbd_niob, n_block_nr)); + LASSERTF((int)sizeof(((struct ptlbd_niob *)0)->n_block_nr) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ptlbd_niob *)0)->n_block_nr)); + LASSERTF(offsetof(struct ptlbd_niob, n_offset) == 16, " found %lld\n", + (long long)offsetof(struct ptlbd_niob, n_offset)); + LASSERTF((int)sizeof(((struct ptlbd_niob *)0)->n_offset) == 4, " found %lld\n", + (long long)(int)sizeof(((struct ptlbd_niob *)0)->n_offset)); + LASSERTF(offsetof(struct ptlbd_niob, n_length) == 20, " found %lld\n", + (long long)offsetof(struct ptlbd_niob, n_length)); + LASSERTF((int)sizeof(((struct ptlbd_niob *)0)->n_length) == 4, " found %lld\n", + (long long)(int)sizeof(((struct ptlbd_niob *)0)->n_length)); /* Checks for struct ptlbd_rsp */ - LASSERT((int)sizeof(struct ptlbd_rsp) == 4); - LASSERT(offsetof(struct ptlbd_rsp, r_status) == 0); - LASSERT((int)sizeof(((struct ptlbd_rsp *)0)->r_status) == 2); - LASSERT(offsetof(struct ptlbd_rsp, r_error_cnt) == 2); - LASSERT((int)sizeof(((struct ptlbd_rsp *)0)->r_error_cnt) == 2); + LASSERTF((int)sizeof(struct ptlbd_rsp) == 4, " found %lld\n", + (long long)(int)sizeof(struct ptlbd_rsp)); + LASSERTF(offsetof(struct ptlbd_rsp, r_status) == 0, " found %lld\n", + (long long)offsetof(struct ptlbd_rsp, r_status)); + LASSERTF((int)sizeof(((struct ptlbd_rsp *)0)->r_status) == 2, " found %lld\n", + (long long)(int)sizeof(((struct ptlbd_rsp *)0)->r_status)); + LASSERTF(offsetof(struct ptlbd_rsp, r_error_cnt) == 2, " found %lld\n", + (long long)offsetof(struct ptlbd_rsp, r_error_cnt)); + LASSERTF((int)sizeof(((struct ptlbd_rsp *)0)->r_error_cnt) == 2, " found %lld\n", + (long long)(int)sizeof(((struct ptlbd_rsp *)0)->r_error_cnt)); /* Checks for struct llog_logid */ - LASSERT((int)sizeof(struct llog_logid) == 20); - LASSERT(offsetof(struct llog_logid, lgl_oid) == 0); - LASSERT((int)sizeof(((struct llog_logid *)0)->lgl_oid) == 8); - LASSERT(offsetof(struct llog_logid, lgl_ogr) == 8); - LASSERT((int)sizeof(((struct llog_logid *)0)->lgl_ogr) == 8); - LASSERT(offsetof(struct llog_logid, lgl_ogen) == 16); - LASSERT((int)sizeof(((struct llog_logid *)0)->lgl_ogen) == 4); - LASSERT(OST_SZ_REC == 274730752); - LASSERT(OST_RAID1_REC == 274731008); - LASSERT(MDS_UNLINK_REC == 274801668); - LASSERT(OBD_CFG_REC == 274857984); - LASSERT(PTL_CFG_REC == 274923520); - LASSERT(LLOG_GEN_REC == 274989056); - LASSERT(LLOG_HDR_MAGIC == 275010873); - LASSERT(LLOG_LOGID_MAGIC == 275010874); + LASSERTF((int)sizeof(struct llog_logid) == 20, " found %lld\n", + (long long)(int)sizeof(struct llog_logid)); + LASSERTF(offsetof(struct llog_logid, lgl_oid) == 0, " found %lld\n", + (long long)offsetof(struct llog_logid, lgl_oid)); + LASSERTF((int)sizeof(((struct llog_logid *)0)->lgl_oid) == 8, " found %lld\n", + (long long)(int)sizeof(((struct llog_logid *)0)->lgl_oid)); + LASSERTF(offsetof(struct llog_logid, lgl_ogr) == 8, " found %lld\n", + (long long)offsetof(struct llog_logid, lgl_ogr)); + LASSERTF((int)sizeof(((struct llog_logid *)0)->lgl_ogr) == 8, " found %lld\n", + (long long)(int)sizeof(((struct llog_logid *)0)->lgl_ogr)); + LASSERTF(offsetof(struct llog_logid, lgl_ogen) == 16, " found %lld\n", + (long long)offsetof(struct llog_logid, lgl_ogen)); + LASSERTF((int)sizeof(((struct llog_logid *)0)->lgl_ogen) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_logid *)0)->lgl_ogen)); + LASSERTF(OST_SZ_REC == 274730752, " found %lld\n", + (long long)OST_SZ_REC); + LASSERTF(OST_RAID1_REC == 274731008, " found %lld\n", + (long long)OST_RAID1_REC); + LASSERTF(MDS_UNLINK_REC == 274801668, " found %lld\n", + (long long)MDS_UNLINK_REC); + LASSERTF(OBD_CFG_REC == 274857984, " found %lld\n", + (long long)OBD_CFG_REC); + LASSERTF(PTL_CFG_REC == 274923520, " found %lld\n", + (long long)PTL_CFG_REC); + LASSERTF(LLOG_GEN_REC == 274989056, " found %lld\n", + (long long)LLOG_GEN_REC); + LASSERTF(LLOG_HDR_MAGIC == 275010873, " found %lld\n", + (long long)LLOG_HDR_MAGIC); + LASSERTF(LLOG_LOGID_MAGIC == 275010875, " found %lld\n", + (long long)LLOG_LOGID_MAGIC); + + /* Checks for struct llog_catid */ + LASSERTF((int)sizeof(struct llog_catid) == 32, " found %lld\n", + (long long)(int)sizeof(struct llog_catid)); + LASSERTF(offsetof(struct llog_catid, lci_logid) == 0, " found %lld\n", + (long long)offsetof(struct llog_catid, lci_logid)); + LASSERTF((int)sizeof(((struct llog_catid *)0)->lci_logid) == 20, " found %lld\n", + (long long)(int)sizeof(((struct llog_catid *)0)->lci_logid)); /* Checks for struct llog_rec_hdr */ - LASSERT((int)sizeof(struct llog_rec_hdr) == 16); - LASSERT(offsetof(struct llog_rec_hdr, lrh_len) == 0); - LASSERT((int)sizeof(((struct llog_rec_hdr *)0)->lrh_len) == 4); - LASSERT(offsetof(struct llog_rec_hdr, lrh_index) == 4); - LASSERT((int)sizeof(((struct llog_rec_hdr *)0)->lrh_index) == 4); - LASSERT(offsetof(struct llog_rec_hdr, lrh_type) == 8); - LASSERT((int)sizeof(((struct llog_rec_hdr *)0)->lrh_type) == 4); + LASSERTF((int)sizeof(struct llog_rec_hdr) == 16, " found %lld\n", + (long long)(int)sizeof(struct llog_rec_hdr)); + LASSERTF(offsetof(struct llog_rec_hdr, lrh_len) == 0, " found %lld\n", + (long long)offsetof(struct llog_rec_hdr, lrh_len)); + LASSERTF((int)sizeof(((struct llog_rec_hdr *)0)->lrh_len) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_rec_hdr *)0)->lrh_len)); + LASSERTF(offsetof(struct llog_rec_hdr, lrh_index) == 4, " found %lld\n", + (long long)offsetof(struct llog_rec_hdr, lrh_index)); + LASSERTF((int)sizeof(((struct llog_rec_hdr *)0)->lrh_index) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_rec_hdr *)0)->lrh_index)); + LASSERTF(offsetof(struct llog_rec_hdr, lrh_type) == 8, " found %lld\n", + (long long)offsetof(struct llog_rec_hdr, lrh_type)); + LASSERTF((int)sizeof(((struct llog_rec_hdr *)0)->lrh_type) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_rec_hdr *)0)->lrh_type)); /* Checks for struct llog_rec_tail */ - LASSERT((int)sizeof(struct llog_rec_tail) == 8); - LASSERT(offsetof(struct llog_rec_tail, lrt_len) == 0); - LASSERT((int)sizeof(((struct llog_rec_tail *)0)->lrt_len) == 4); - LASSERT(offsetof(struct llog_rec_tail, lrt_index) == 4); - LASSERT((int)sizeof(((struct llog_rec_tail *)0)->lrt_index) == 4); + LASSERTF((int)sizeof(struct llog_rec_tail) == 8, " found %lld\n", + (long long)(int)sizeof(struct llog_rec_tail)); + LASSERTF(offsetof(struct llog_rec_tail, lrt_len) == 0, " found %lld\n", + (long long)offsetof(struct llog_rec_tail, lrt_len)); + LASSERTF((int)sizeof(((struct llog_rec_tail *)0)->lrt_len) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_rec_tail *)0)->lrt_len)); + LASSERTF(offsetof(struct llog_rec_tail, lrt_index) == 4, " found %lld\n", + (long long)offsetof(struct llog_rec_tail, lrt_index)); + LASSERTF((int)sizeof(((struct llog_rec_tail *)0)->lrt_index) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_rec_tail *)0)->lrt_index)); /* Checks for struct llog_logid_rec */ - LASSERT((int)sizeof(struct llog_logid_rec) == 48); - LASSERT(offsetof(struct llog_logid_rec, lid_hdr) == 0); - LASSERT((int)sizeof(((struct llog_logid_rec *)0)->lid_hdr) == 16); - LASSERT(offsetof(struct llog_logid_rec, lid_id) == 16); - LASSERT((int)sizeof(((struct llog_logid_rec *)0)->lid_id) == 20); - LASSERT(offsetof(struct llog_logid_rec, lid_tail) == 40); - LASSERT((int)sizeof(((struct llog_logid_rec *)0)->lid_tail) == 8); + LASSERTF((int)sizeof(struct llog_logid_rec) == 64, " found %lld\n", + (long long)(int)sizeof(struct llog_logid_rec)); + LASSERTF(offsetof(struct llog_logid_rec, lid_hdr) == 0, " found %lld\n", + (long long)offsetof(struct llog_logid_rec, lid_hdr)); + LASSERTF((int)sizeof(((struct llog_logid_rec *)0)->lid_hdr) == 16, " found %lld\n", + (long long)(int)sizeof(((struct llog_logid_rec *)0)->lid_hdr)); + LASSERTF(offsetof(struct llog_logid_rec, lid_id) == 16, " found %lld\n", + (long long)offsetof(struct llog_logid_rec, lid_id)); + LASSERTF((int)sizeof(((struct llog_logid_rec *)0)->lid_id) == 20, " found %lld\n", + (long long)(int)sizeof(((struct llog_logid_rec *)0)->lid_id)); + LASSERTF(offsetof(struct llog_logid_rec, lid_tail) == 56, " found %lld\n", + (long long)offsetof(struct llog_logid_rec, lid_tail)); + LASSERTF((int)sizeof(((struct llog_logid_rec *)0)->lid_tail) == 8, " found %lld\n", + (long long)(int)sizeof(((struct llog_logid_rec *)0)->lid_tail)); /* Checks for struct llog_create_rec */ - LASSERT((int)sizeof(struct llog_create_rec) == 56); - LASSERT(offsetof(struct llog_create_rec, lcr_hdr) == 0); - LASSERT((int)sizeof(((struct llog_create_rec *)0)->lcr_hdr) == 16); - LASSERT(offsetof(struct llog_create_rec, lcr_fid) == 16); - LASSERT((int)sizeof(((struct llog_create_rec *)0)->lcr_fid) == 16); - LASSERT(offsetof(struct llog_create_rec, lcr_oid) == 32); - LASSERT((int)sizeof(((struct llog_create_rec *)0)->lcr_oid) == 8); - LASSERT(offsetof(struct llog_create_rec, lcr_ogen) == 40); - LASSERT((int)sizeof(((struct llog_create_rec *)0)->lcr_ogen) == 4); + LASSERTF((int)sizeof(struct llog_create_rec) == 56, " found %lld\n", + (long long)(int)sizeof(struct llog_create_rec)); + LASSERTF(offsetof(struct llog_create_rec, lcr_hdr) == 0, " found %lld\n", + (long long)offsetof(struct llog_create_rec, lcr_hdr)); + LASSERTF((int)sizeof(((struct llog_create_rec *)0)->lcr_hdr) == 16, " found %lld\n", + (long long)(int)sizeof(((struct llog_create_rec *)0)->lcr_hdr)); + LASSERTF(offsetof(struct llog_create_rec, lcr_fid) == 16, " found %lld\n", + (long long)offsetof(struct llog_create_rec, lcr_fid)); + LASSERTF((int)sizeof(((struct llog_create_rec *)0)->lcr_fid) == 16, " found %lld\n", + (long long)(int)sizeof(((struct llog_create_rec *)0)->lcr_fid)); + LASSERTF(offsetof(struct llog_create_rec, lcr_oid) == 32, " found %lld\n", + (long long)offsetof(struct llog_create_rec, lcr_oid)); + LASSERTF((int)sizeof(((struct llog_create_rec *)0)->lcr_oid) == 8, " found %lld\n", + (long long)(int)sizeof(((struct llog_create_rec *)0)->lcr_oid)); + LASSERTF(offsetof(struct llog_create_rec, lcr_ogen) == 40, " found %lld\n", + (long long)offsetof(struct llog_create_rec, lcr_ogen)); + LASSERTF((int)sizeof(((struct llog_create_rec *)0)->lcr_ogen) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_create_rec *)0)->lcr_ogen)); /* Checks for struct llog_orphan_rec */ - LASSERT((int)sizeof(struct llog_orphan_rec) == 40); - LASSERT(offsetof(struct llog_orphan_rec, lor_hdr) == 0); - LASSERT((int)sizeof(((struct llog_orphan_rec *)0)->lor_hdr) == 16); - LASSERT(offsetof(struct llog_orphan_rec, lor_oid) == 16); - LASSERT((int)sizeof(((struct llog_orphan_rec *)0)->lor_oid) == 8); - LASSERT(offsetof(struct llog_orphan_rec, lor_ogen) == 24); - LASSERT((int)sizeof(((struct llog_orphan_rec *)0)->lor_ogen) == 4); - LASSERT(offsetof(struct llog_orphan_rec, lor_tail) == 32); - LASSERT((int)sizeof(((struct llog_orphan_rec *)0)->lor_tail) == 8); + LASSERTF((int)sizeof(struct llog_orphan_rec) == 40, " found %lld\n", + (long long)(int)sizeof(struct llog_orphan_rec)); + LASSERTF(offsetof(struct llog_orphan_rec, lor_hdr) == 0, " found %lld\n", + (long long)offsetof(struct llog_orphan_rec, lor_hdr)); + LASSERTF((int)sizeof(((struct llog_orphan_rec *)0)->lor_hdr) == 16, " found %lld\n", + (long long)(int)sizeof(((struct llog_orphan_rec *)0)->lor_hdr)); + LASSERTF(offsetof(struct llog_orphan_rec, lor_oid) == 16, " found %lld\n", + (long long)offsetof(struct llog_orphan_rec, lor_oid)); + LASSERTF((int)sizeof(((struct llog_orphan_rec *)0)->lor_oid) == 8, " found %lld\n", + (long long)(int)sizeof(((struct llog_orphan_rec *)0)->lor_oid)); + LASSERTF(offsetof(struct llog_orphan_rec, lor_ogen) == 24, " found %lld\n", + (long long)offsetof(struct llog_orphan_rec, lor_ogen)); + LASSERTF((int)sizeof(((struct llog_orphan_rec *)0)->lor_ogen) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_orphan_rec *)0)->lor_ogen)); + LASSERTF(offsetof(struct llog_orphan_rec, lor_tail) == 32, " found %lld\n", + (long long)offsetof(struct llog_orphan_rec, lor_tail)); + LASSERTF((int)sizeof(((struct llog_orphan_rec *)0)->lor_tail) == 8, " found %lld\n", + (long long)(int)sizeof(((struct llog_orphan_rec *)0)->lor_tail)); /* Checks for struct llog_unlink_rec */ - LASSERT((int)sizeof(struct llog_unlink_rec) == 40); - LASSERT(offsetof(struct llog_unlink_rec, lur_hdr) == 0); - LASSERT((int)sizeof(((struct llog_unlink_rec *)0)->lur_hdr) == 16); - LASSERT(offsetof(struct llog_unlink_rec, lur_oid) == 16); - LASSERT((int)sizeof(((struct llog_unlink_rec *)0)->lur_oid) == 8); - LASSERT(offsetof(struct llog_unlink_rec, lur_ogen) == 24); - LASSERT((int)sizeof(((struct llog_unlink_rec *)0)->lur_ogen) == 4); - LASSERT(offsetof(struct llog_unlink_rec, lur_tail) == 32); - LASSERT((int)sizeof(((struct llog_unlink_rec *)0)->lur_tail) == 8); + LASSERTF((int)sizeof(struct llog_unlink_rec) == 40, " found %lld\n", + (long long)(int)sizeof(struct llog_unlink_rec)); + LASSERTF(offsetof(struct llog_unlink_rec, lur_hdr) == 0, " found %lld\n", + (long long)offsetof(struct llog_unlink_rec, lur_hdr)); + LASSERTF((int)sizeof(((struct llog_unlink_rec *)0)->lur_hdr) == 16, " found %lld\n", + (long long)(int)sizeof(((struct llog_unlink_rec *)0)->lur_hdr)); + LASSERTF(offsetof(struct llog_unlink_rec, lur_oid) == 16, " found %lld\n", + (long long)offsetof(struct llog_unlink_rec, lur_oid)); + LASSERTF((int)sizeof(((struct llog_unlink_rec *)0)->lur_oid) == 8, " found %lld\n", + (long long)(int)sizeof(((struct llog_unlink_rec *)0)->lur_oid)); + LASSERTF(offsetof(struct llog_unlink_rec, lur_ogen) == 24, " found %lld\n", + (long long)offsetof(struct llog_unlink_rec, lur_ogen)); + LASSERTF((int)sizeof(((struct llog_unlink_rec *)0)->lur_ogen) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_unlink_rec *)0)->lur_ogen)); + LASSERTF(offsetof(struct llog_unlink_rec, lur_tail) == 32, " found %lld\n", + (long long)offsetof(struct llog_unlink_rec, lur_tail)); + LASSERTF((int)sizeof(((struct llog_unlink_rec *)0)->lur_tail) == 8, " found %lld\n", + (long long)(int)sizeof(((struct llog_unlink_rec *)0)->lur_tail)); /* Checks for struct llog_size_change_rec */ - LASSERT((int)sizeof(struct llog_size_change_rec) == 48); - LASSERT(offsetof(struct llog_size_change_rec, lsc_hdr) == 0); - LASSERT((int)sizeof(((struct llog_size_change_rec *)0)->lsc_hdr) == 16); - LASSERT(offsetof(struct llog_size_change_rec, lsc_fid) == 16); - LASSERT((int)sizeof(((struct llog_size_change_rec *)0)->lsc_fid) == 16); - LASSERT(offsetof(struct llog_size_change_rec, lsc_io_epoch) == 32); - LASSERT((int)sizeof(((struct llog_size_change_rec *)0)->lsc_io_epoch) == 4); - LASSERT(offsetof(struct llog_size_change_rec, lsc_tail) == 40); - LASSERT((int)sizeof(((struct llog_size_change_rec *)0)->lsc_tail) == 8); + LASSERTF((int)sizeof(struct llog_size_change_rec) == 48, " found %lld\n", + (long long)(int)sizeof(struct llog_size_change_rec)); + LASSERTF(offsetof(struct llog_size_change_rec, lsc_hdr) == 0, " found %lld\n", + (long long)offsetof(struct llog_size_change_rec, lsc_hdr)); + LASSERTF((int)sizeof(((struct llog_size_change_rec *)0)->lsc_hdr) == 16, " found %lld\n", + (long long)(int)sizeof(((struct llog_size_change_rec *)0)->lsc_hdr)); + LASSERTF(offsetof(struct llog_size_change_rec, lsc_fid) == 16, " found %lld\n", + (long long)offsetof(struct llog_size_change_rec, lsc_fid)); + LASSERTF((int)sizeof(((struct llog_size_change_rec *)0)->lsc_fid) == 16, " found %lld\n", + (long long)(int)sizeof(((struct llog_size_change_rec *)0)->lsc_fid)); + LASSERTF(offsetof(struct llog_size_change_rec, lsc_io_epoch) == 32, " found %lld\n", + (long long)offsetof(struct llog_size_change_rec, lsc_io_epoch)); + LASSERTF((int)sizeof(((struct llog_size_change_rec *)0)->lsc_io_epoch) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_size_change_rec *)0)->lsc_io_epoch)); + LASSERTF(offsetof(struct llog_size_change_rec, lsc_tail) == 40, " found %lld\n", + (long long)offsetof(struct llog_size_change_rec, lsc_tail)); + LASSERTF((int)sizeof(((struct llog_size_change_rec *)0)->lsc_tail) == 8, " found %lld\n", + (long long)(int)sizeof(((struct llog_size_change_rec *)0)->lsc_tail)); /* Checks for struct llog_gen */ - LASSERT((int)sizeof(struct llog_gen) == 16); - LASSERT(offsetof(struct llog_gen, mnt_cnt) == 0); - LASSERT((int)sizeof(((struct llog_gen *)0)->mnt_cnt) == 8); - LASSERT(offsetof(struct llog_gen, conn_cnt) == 8); - LASSERT((int)sizeof(((struct llog_gen *)0)->conn_cnt) == 8); + LASSERTF((int)sizeof(struct llog_gen) == 16, " found %lld\n", + (long long)(int)sizeof(struct llog_gen)); + LASSERTF(offsetof(struct llog_gen, mnt_cnt) == 0, " found %lld\n", + (long long)offsetof(struct llog_gen, mnt_cnt)); + LASSERTF((int)sizeof(((struct llog_gen *)0)->mnt_cnt) == 8, " found %lld\n", + (long long)(int)sizeof(((struct llog_gen *)0)->mnt_cnt)); + LASSERTF(offsetof(struct llog_gen, conn_cnt) == 8, " found %lld\n", + (long long)offsetof(struct llog_gen, conn_cnt)); + LASSERTF((int)sizeof(((struct llog_gen *)0)->conn_cnt) == 8, " found %lld\n", + (long long)(int)sizeof(((struct llog_gen *)0)->conn_cnt)); /* Checks for struct llog_gen_rec */ - LASSERT((int)sizeof(struct llog_gen_rec) == 40); - LASSERT(offsetof(struct llog_gen_rec, lgr_hdr) == 0); - LASSERT((int)sizeof(((struct llog_gen_rec *)0)->lgr_hdr) == 16); - LASSERT(offsetof(struct llog_gen_rec, lgr_gen) == 16); - LASSERT((int)sizeof(((struct llog_gen_rec *)0)->lgr_gen) == 16); - LASSERT(offsetof(struct llog_gen_rec, lgr_tail) == 32); - LASSERT((int)sizeof(((struct llog_gen_rec *)0)->lgr_tail) == 8); + LASSERTF((int)sizeof(struct llog_gen_rec) == 40, " found %lld\n", + (long long)(int)sizeof(struct llog_gen_rec)); + LASSERTF(offsetof(struct llog_gen_rec, lgr_hdr) == 0, " found %lld\n", + (long long)offsetof(struct llog_gen_rec, lgr_hdr)); + LASSERTF((int)sizeof(((struct llog_gen_rec *)0)->lgr_hdr) == 16, " found %lld\n", + (long long)(int)sizeof(((struct llog_gen_rec *)0)->lgr_hdr)); + LASSERTF(offsetof(struct llog_gen_rec, lgr_gen) == 16, " found %lld\n", + (long long)offsetof(struct llog_gen_rec, lgr_gen)); + LASSERTF((int)sizeof(((struct llog_gen_rec *)0)->lgr_gen) == 16, " found %lld\n", + (long long)(int)sizeof(((struct llog_gen_rec *)0)->lgr_gen)); + LASSERTF(offsetof(struct llog_gen_rec, lgr_tail) == 32, " found %lld\n", + (long long)offsetof(struct llog_gen_rec, lgr_tail)); + LASSERTF((int)sizeof(((struct llog_gen_rec *)0)->lgr_tail) == 8, " found %lld\n", + (long long)(int)sizeof(((struct llog_gen_rec *)0)->lgr_tail)); /* Checks for struct llog_log_hdr */ - LASSERT((int)sizeof(struct llog_log_hdr) == 4096); - LASSERT(offsetof(struct llog_log_hdr, llh_hdr) == 0); - LASSERT((int)sizeof(((struct llog_log_hdr *)0)->llh_hdr) == 16); - LASSERT(offsetof(struct llog_log_hdr, llh_timestamp) == 16); - LASSERT((int)sizeof(((struct llog_log_hdr *)0)->llh_timestamp) == 8); - LASSERT(offsetof(struct llog_log_hdr, llh_count) == 24); - LASSERT((int)sizeof(((struct llog_log_hdr *)0)->llh_count) == 4); - LASSERT(offsetof(struct llog_log_hdr, llh_bitmap_offset) == 28); - LASSERT((int)sizeof(((struct llog_log_hdr *)0)->llh_bitmap_offset) == 4); - LASSERT(offsetof(struct llog_log_hdr, llh_size) == 32); - LASSERT((int)sizeof(((struct llog_log_hdr *)0)->llh_size) == 4); - LASSERT(offsetof(struct llog_log_hdr, llh_flags) == 36); - LASSERT((int)sizeof(((struct llog_log_hdr *)0)->llh_flags) == 4); - LASSERT(offsetof(struct llog_log_hdr, llh_cat_idx) == 40); - LASSERT((int)sizeof(((struct llog_log_hdr *)0)->llh_cat_idx) == 4); - LASSERT(offsetof(struct llog_log_hdr, llh_tgtuuid) == 44); - LASSERT((int)sizeof(((struct llog_log_hdr *)0)->llh_tgtuuid) == 40); - LASSERT(offsetof(struct llog_log_hdr, llh_reserved) == 84); - LASSERT((int)sizeof(((struct llog_log_hdr *)0)->llh_reserved) == 4); - LASSERT(offsetof(struct llog_log_hdr, llh_bitmap) == 88); - LASSERT((int)sizeof(((struct llog_log_hdr *)0)->llh_bitmap) == 4000); - LASSERT(offsetof(struct llog_log_hdr, llh_tail) == 4088); - LASSERT((int)sizeof(((struct llog_log_hdr *)0)->llh_tail) == 8); + LASSERTF((int)sizeof(struct llog_log_hdr) == 4096, " found %lld\n", + (long long)(int)sizeof(struct llog_log_hdr)); + LASSERTF(offsetof(struct llog_log_hdr, llh_hdr) == 0, " found %lld\n", + (long long)offsetof(struct llog_log_hdr, llh_hdr)); + LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_hdr) == 16, " found %lld\n", + (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_hdr)); + LASSERTF(offsetof(struct llog_log_hdr, llh_timestamp) == 16, " found %lld\n", + (long long)offsetof(struct llog_log_hdr, llh_timestamp)); + LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_timestamp) == 8, " found %lld\n", + (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_timestamp)); + LASSERTF(offsetof(struct llog_log_hdr, llh_count) == 24, " found %lld\n", + (long long)offsetof(struct llog_log_hdr, llh_count)); + LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_count) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_count)); + LASSERTF(offsetof(struct llog_log_hdr, llh_bitmap_offset) == 28, " found %lld\n", + (long long)offsetof(struct llog_log_hdr, llh_bitmap_offset)); + LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_bitmap_offset) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_bitmap_offset)); + LASSERTF(offsetof(struct llog_log_hdr, llh_size) == 32, " found %lld\n", + (long long)offsetof(struct llog_log_hdr, llh_size)); + LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_size) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_size)); + LASSERTF(offsetof(struct llog_log_hdr, llh_flags) == 36, " found %lld\n", + (long long)offsetof(struct llog_log_hdr, llh_flags)); + LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_flags) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_flags)); + LASSERTF(offsetof(struct llog_log_hdr, llh_cat_idx) == 40, " found %lld\n", + (long long)offsetof(struct llog_log_hdr, llh_cat_idx)); + LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_cat_idx) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_cat_idx)); + LASSERTF(offsetof(struct llog_log_hdr, llh_tgtuuid) == 44, " found %lld\n", + (long long)offsetof(struct llog_log_hdr, llh_tgtuuid)); + LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_tgtuuid) == 40, " found %lld\n", + (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_tgtuuid)); + LASSERTF(offsetof(struct llog_log_hdr, llh_reserved) == 84, " found %lld\n", + (long long)offsetof(struct llog_log_hdr, llh_reserved)); + LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_reserved) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_reserved)); + LASSERTF(offsetof(struct llog_log_hdr, llh_bitmap) == 88, " found %lld\n", + (long long)offsetof(struct llog_log_hdr, llh_bitmap)); + LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_bitmap) == 4000, " found %lld\n", + (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_bitmap)); + LASSERTF(offsetof(struct llog_log_hdr, llh_tail) == 4088, " found %lld\n", + (long long)offsetof(struct llog_log_hdr, llh_tail)); + LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_tail) == 8, " found %lld\n", + (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_tail)); /* Checks for struct llog_cookie */ - LASSERT((int)sizeof(struct llog_cookie) == 32); - LASSERT(offsetof(struct llog_cookie, lgc_lgl) == 0); - LASSERT((int)sizeof(((struct llog_cookie *)0)->lgc_lgl) == 20); - LASSERT(offsetof(struct llog_cookie, lgc_subsys) == 20); - LASSERT((int)sizeof(((struct llog_cookie *)0)->lgc_subsys) == 4); - LASSERT(offsetof(struct llog_cookie, lgc_index) == 24); - LASSERT((int)sizeof(((struct llog_cookie *)0)->lgc_index) == 4); + LASSERTF((int)sizeof(struct llog_cookie) == 32, " found %lld\n", + (long long)(int)sizeof(struct llog_cookie)); + LASSERTF(offsetof(struct llog_cookie, lgc_lgl) == 0, " found %lld\n", + (long long)offsetof(struct llog_cookie, lgc_lgl)); + LASSERTF((int)sizeof(((struct llog_cookie *)0)->lgc_lgl) == 20, " found %lld\n", + (long long)(int)sizeof(((struct llog_cookie *)0)->lgc_lgl)); + LASSERTF(offsetof(struct llog_cookie, lgc_subsys) == 20, " found %lld\n", + (long long)offsetof(struct llog_cookie, lgc_subsys)); + LASSERTF((int)sizeof(((struct llog_cookie *)0)->lgc_subsys) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_cookie *)0)->lgc_subsys)); + LASSERTF(offsetof(struct llog_cookie, lgc_index) == 24, " found %lld\n", + (long long)offsetof(struct llog_cookie, lgc_index)); + LASSERTF((int)sizeof(((struct llog_cookie *)0)->lgc_index) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_cookie *)0)->lgc_index)); /* Checks for struct llogd_body */ - LASSERT((int)sizeof(struct llogd_body) == 48); - LASSERT(offsetof(struct llogd_body, lgd_logid) == 0); - LASSERT((int)sizeof(((struct llogd_body *)0)->lgd_logid) == 20); - LASSERT(offsetof(struct llogd_body, lgd_ctxt_idx) == 20); - LASSERT((int)sizeof(((struct llogd_body *)0)->lgd_ctxt_idx) == 4); - LASSERT(offsetof(struct llogd_body, lgd_llh_flags) == 24); - LASSERT((int)sizeof(((struct llogd_body *)0)->lgd_llh_flags) == 4); - LASSERT(offsetof(struct llogd_body, lgd_index) == 28); - LASSERT((int)sizeof(((struct llogd_body *)0)->lgd_index) == 4); - LASSERT(offsetof(struct llogd_body, lgd_saved_index) == 32); - LASSERT((int)sizeof(((struct llogd_body *)0)->lgd_saved_index) == 4); - LASSERT(offsetof(struct llogd_body, lgd_len) == 36); - LASSERT((int)sizeof(((struct llogd_body *)0)->lgd_len) == 4); - LASSERT(offsetof(struct llogd_body, lgd_cur_offset) == 40); - LASSERT((int)sizeof(((struct llogd_body *)0)->lgd_cur_offset) == 8); - LASSERT(LLOG_ORIGIN_HANDLE_CREATE == 501); - LASSERT(LLOG_ORIGIN_HANDLE_NEXT_BLOCK == 502); - LASSERT(LLOG_ORIGIN_HANDLE_READ_HEADER == 503); - LASSERT(LLOG_ORIGIN_HANDLE_WRITE_REC == 504); - LASSERT(LLOG_ORIGIN_HANDLE_CLOSE == 505); - LASSERT(LLOG_ORIGIN_CONNECT == 506); - LASSERT(LLOG_CATINFO == 507); + LASSERTF((int)sizeof(struct llogd_body) == 48, " found %lld\n", + (long long)(int)sizeof(struct llogd_body)); + LASSERTF(offsetof(struct llogd_body, lgd_logid) == 0, " found %lld\n", + (long long)offsetof(struct llogd_body, lgd_logid)); + LASSERTF((int)sizeof(((struct llogd_body *)0)->lgd_logid) == 20, " found %lld\n", + (long long)(int)sizeof(((struct llogd_body *)0)->lgd_logid)); + LASSERTF(offsetof(struct llogd_body, lgd_ctxt_idx) == 20, " found %lld\n", + (long long)offsetof(struct llogd_body, lgd_ctxt_idx)); + LASSERTF((int)sizeof(((struct llogd_body *)0)->lgd_ctxt_idx) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llogd_body *)0)->lgd_ctxt_idx)); + LASSERTF(offsetof(struct llogd_body, lgd_llh_flags) == 24, " found %lld\n", + (long long)offsetof(struct llogd_body, lgd_llh_flags)); + LASSERTF((int)sizeof(((struct llogd_body *)0)->lgd_llh_flags) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llogd_body *)0)->lgd_llh_flags)); + LASSERTF(offsetof(struct llogd_body, lgd_index) == 28, " found %lld\n", + (long long)offsetof(struct llogd_body, lgd_index)); + LASSERTF((int)sizeof(((struct llogd_body *)0)->lgd_index) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llogd_body *)0)->lgd_index)); + LASSERTF(offsetof(struct llogd_body, lgd_saved_index) == 32, " found %lld\n", + (long long)offsetof(struct llogd_body, lgd_saved_index)); + LASSERTF((int)sizeof(((struct llogd_body *)0)->lgd_saved_index) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llogd_body *)0)->lgd_saved_index)); + LASSERTF(offsetof(struct llogd_body, lgd_len) == 36, " found %lld\n", + (long long)offsetof(struct llogd_body, lgd_len)); + LASSERTF((int)sizeof(((struct llogd_body *)0)->lgd_len) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llogd_body *)0)->lgd_len)); + LASSERTF(offsetof(struct llogd_body, lgd_cur_offset) == 40, " found %lld\n", + (long long)offsetof(struct llogd_body, lgd_cur_offset)); + LASSERTF((int)sizeof(((struct llogd_body *)0)->lgd_cur_offset) == 8, " found %lld\n", + (long long)(int)sizeof(((struct llogd_body *)0)->lgd_cur_offset)); + LASSERTF(LLOG_ORIGIN_HANDLE_CREATE == 501, " found %lld\n", + (long long)LLOG_ORIGIN_HANDLE_CREATE); + LASSERTF(LLOG_ORIGIN_HANDLE_NEXT_BLOCK == 502, " found %lld\n", + (long long)LLOG_ORIGIN_HANDLE_NEXT_BLOCK); + LASSERTF(LLOG_ORIGIN_HANDLE_READ_HEADER == 503, " found %lld\n", + (long long)LLOG_ORIGIN_HANDLE_READ_HEADER); + LASSERTF(LLOG_ORIGIN_HANDLE_WRITE_REC == 504, " found %lld\n", + (long long)LLOG_ORIGIN_HANDLE_WRITE_REC); + LASSERTF(LLOG_ORIGIN_HANDLE_CLOSE == 505, " found %lld\n", + (long long)LLOG_ORIGIN_HANDLE_CLOSE); + LASSERTF(LLOG_ORIGIN_CONNECT == 506, " found %lld\n", + (long long)LLOG_ORIGIN_CONNECT); + LASSERTF(LLOG_CATINFO == 507, " found %lld\n", + (long long)LLOG_CATINFO); /* Checks for struct llogd_conn_body */ - LASSERT((int)sizeof(struct llogd_conn_body) == 40); - LASSERT(offsetof(struct llogd_conn_body, lgdc_gen) == 0); - LASSERT((int)sizeof(((struct llogd_conn_body *)0)->lgdc_gen) == 16); - LASSERT(offsetof(struct llogd_conn_body, lgdc_logid) == 16); - LASSERT((int)sizeof(((struct llogd_conn_body *)0)->lgdc_logid) == 20); - LASSERT(offsetof(struct llogd_conn_body, lgdc_ctxt_idx) == 36); - LASSERT((int)sizeof(((struct llogd_conn_body *)0)->lgdc_ctxt_idx) == 4); -} -#else -void lustre_assert_wire_constants(void) -{ - return; + LASSERTF((int)sizeof(struct llogd_conn_body) == 40, " found %lld\n", + (long long)(int)sizeof(struct llogd_conn_body)); + LASSERTF(offsetof(struct llogd_conn_body, lgdc_gen) == 0, " found %lld\n", + (long long)offsetof(struct llogd_conn_body, lgdc_gen)); + LASSERTF((int)sizeof(((struct llogd_conn_body *)0)->lgdc_gen) == 16, " found %lld\n", + (long long)(int)sizeof(((struct llogd_conn_body *)0)->lgdc_gen)); + LASSERTF(offsetof(struct llogd_conn_body, lgdc_logid) == 16, " found %lld\n", + (long long)offsetof(struct llogd_conn_body, lgdc_logid)); + LASSERTF((int)sizeof(((struct llogd_conn_body *)0)->lgdc_logid) == 20, " found %lld\n", + (long long)(int)sizeof(((struct llogd_conn_body *)0)->lgdc_logid)); + LASSERTF(offsetof(struct llogd_conn_body, lgdc_ctxt_idx) == 36, " found %lld\n", + (long long)offsetof(struct llogd_conn_body, lgdc_ctxt_idx)); + LASSERTF((int)sizeof(((struct llogd_conn_body *)0)->lgdc_ctxt_idx) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llogd_conn_body *)0)->lgdc_ctxt_idx)); } -#endif + diff --git a/lustre/ptlrpc/pinger.c b/lustre/ptlrpc/pinger.c index 1198683..ad1d502 100644 --- a/lustre/ptlrpc/pinger.c +++ b/lustre/ptlrpc/pinger.c @@ -41,6 +41,32 @@ static struct list_head pinger_imports = LIST_HEAD_INIT(pinger_imports); #ifdef __KERNEL__ static struct ptlrpc_thread *pinger_thread = NULL; +int ptlrpc_ping(struct obd_import *imp) +{ + struct ptlrpc_request *req; + int rc = 0; + ENTRY; + + req = ptlrpc_prep_req(imp, OBD_PING, 0, NULL, + NULL); + if (req) { + DEBUG_REQ(D_HA, req, "pinging %s->%s", + imp->imp_obd->obd_uuid.uuid, + imp->imp_target_uuid.uuid); + req->rq_no_resend = req->rq_no_delay = 1; + req->rq_replen = lustre_msg_size(0, + NULL); + ptlrpcd_add_req(req); + } else { + CERROR("OOM trying to ping %s->%s\n", + imp->imp_obd->obd_uuid.uuid, + imp->imp_target_uuid.uuid); + rc = -ENOMEM; + } + + RETURN(rc); +} + static int ptlrpc_pinger_main(void *arg) { struct ptlrpc_svc_data *data = (struct ptlrpc_svc_data *)arg; @@ -69,112 +95,53 @@ static int ptlrpc_pinger_main(void *arg) long time_to_next_ping; struct l_wait_info lwi = LWI_TIMEOUT(obd_timeout * HZ, NULL, NULL); - struct ptlrpc_request_set *set; - struct ptlrpc_request *req; struct list_head *iter; - wait_queue_t set_wait; - int rc; - set = ptlrpc_prep_set(); down(&pinger_sem); list_for_each(iter, &pinger_imports) { struct obd_import *imp = list_entry(iter, struct obd_import, imp_pinger_chain); - int generation, level; + int force, level; unsigned long flags; - if (imp->imp_next_ping <= this_ping) { - /* Add a ping. */ - spin_lock_irqsave(&imp->imp_lock, flags); - generation = imp->imp_generation; - level = imp->imp_state; - spin_unlock_irqrestore(&imp->imp_lock, flags); - - if (level != LUSTRE_IMP_FULL) { - CDEBUG(D_HA, - "not pinging %s (in recovery)\n", - imp->imp_target_uuid.uuid); - continue; - } - - req = ptlrpc_prep_req(imp, OBD_PING, 0, NULL, - NULL); - if (!req) { - CERROR("OOM trying to ping\n"); - break; - } - req->rq_no_resend = 1; - req->rq_replen = lustre_msg_size(0, NULL); - req->rq_send_state = LUSTRE_IMP_FULL; - req->rq_phase = RQ_PHASE_RPC; - req->rq_import_generation = generation; - ptlrpc_set_add_req(set, req); - } else { - CDEBUG(D_HA, "don't need to ping %s (%lu > " - "%lu)\n", imp->imp_target_uuid.uuid, - imp->imp_next_ping, this_ping); - } - } - up(&pinger_sem); - - /* Might be empty, that's OK. */ - if (set->set_remaining == 0) - CDEBUG(D_HA, "nothing to ping\n"); - list_for_each(iter, &set->set_requests) { - struct ptlrpc_request *req = - list_entry(iter, struct ptlrpc_request, - rq_set_chain); - DEBUG_REQ(D_HA, req, "pinging %s->%s", - req->rq_import->imp_obd->obd_uuid.uuid, - req->rq_import->imp_target_uuid.uuid); - (void)ptl_send_rpc(req); - } - - /* Have to wait on both the thread's queue and the set's. */ - init_waitqueue_entry(&set_wait, current); - add_wait_queue(&set->set_waitq, &set_wait); - rc = l_wait_event(thread->t_ctl_waitq, - thread->t_flags & SVC_STOPPING || - ptlrpc_check_set(set), - &lwi); - remove_wait_queue(&set->set_waitq, &set_wait); - CDEBUG(D_HA, "ping complete (%lu)\n", jiffies); - - if (thread->t_flags & SVC_STOPPING) { - thread->t_flags &= ~SVC_STOPPING; - list_for_each(iter, &set->set_requests) { - req = list_entry(iter, struct ptlrpc_request, - rq_set_chain); - if (!req->rq_replied) - ptlrpc_unregister_reply(req); - } - ptlrpc_set_destroy(set); - EXIT; - break; - } - /* Expire all the requests that didn't come back. */ - down(&pinger_sem); - list_for_each(iter, &set->set_requests) { - req = list_entry(iter, struct ptlrpc_request, - rq_set_chain); + spin_lock_irqsave(&imp->imp_lock, flags); + level = imp->imp_state; + force = imp->imp_force_verify; + if (force) + imp->imp_force_verify = 0; + spin_unlock_irqrestore(&imp->imp_lock, flags); - if (req->rq_replied) - continue; + if (imp->imp_next_ping <= this_ping || force) { + if (level == LUSTRE_IMP_DISCON) { + /* wait at least a timeout before + trying recovery again. */ + imp->imp_next_ping = jiffies + + (obd_timeout * HZ); + ptlrpc_initiate_recovery(imp); + } + else if (level != LUSTRE_IMP_FULL || + imp->imp_obd->obd_no_recov) { + CDEBUG(D_HA, + "not pinging %s (in recovery " + " or recovery disabled: %s)\n", + imp->imp_target_uuid.uuid, + ptlrpc_import_state_name(level)); + } + else if (imp->imp_pingable || force) { + ptlrpc_ping(imp); + } - req->rq_phase = RQ_PHASE_COMPLETE; - set->set_remaining--; - /* If it was disconnected, don't sweat it. */ - if (list_empty(&req->rq_import->imp_pinger_chain)) { - ptlrpc_unregister_reply(req); - continue; + } else { + if (imp->imp_pingable) + CDEBUG(D_HA, "don't need to ping %s " + "(%lu > %lu)\n", + imp->imp_target_uuid.uuid, + imp->imp_next_ping, this_ping); } - - ptlrpc_expire_one_request(req); } up(&pinger_sem); - ptlrpc_set_destroy(set); /* Wait until the next ping time, or until we're stopped. */ time_to_next_ping = this_ping + (obd_timeout * HZ) - jiffies; @@ -283,10 +250,7 @@ int ptlrpc_pinger_add_import(struct obd_import *imp) list_add_tail(&imp->imp_pinger_chain, &pinger_imports); class_import_get(imp); -#ifdef ENABLE_PINGER - pinger_thread->t_flags |= SVC_EVENT; - wake_up(&pinger_thread->t_ctl_waitq); -#endif + ptlrpc_pinger_wake_up(); up(&pinger_sem); RETURN(0); @@ -307,6 +271,14 @@ int ptlrpc_pinger_del_import(struct obd_import *imp) RETURN(0); } +void ptlrpc_pinger_wake_up() +{ +#ifdef ENABLE_PINGER + pinger_thread->t_flags |= SVC_EVENT; + wake_up(&pinger_thread->t_ctl_waitq); +#endif +} + #else /* XXX * the current implementation of pinger in liblustre is not optimized @@ -521,4 +493,10 @@ int ptlrpc_pinger_del_import(struct obd_import *imp) RETURN(0); } +void ptlrpc_pinger_wake_up() +{ +#ifdef ENABLE_PINGER + /* XXX force pinger to run, if needed */ +#endif +} #endif /* !__KERNEL__ */ diff --git a/lustre/ptlrpc/ptlrpc_internal.h b/lustre/ptlrpc/ptlrpc_internal.h index a78cd0d..021fb0f 100644 --- a/lustre/ptlrpc/ptlrpc_internal.h +++ b/lustre/ptlrpc/ptlrpc_internal.h @@ -40,6 +40,7 @@ int ptlrpc_import_in_recovery(struct obd_import *imp); int ptlrpc_set_import_discon(struct obd_import *imp); void ptlrpc_handle_failed_import(struct obd_import *imp); int ptlrpc_replay_next(struct obd_import *imp, int *inflight); +void ptlrpc_initiate_recovery(struct obd_import *imp); #ifdef __KERNEL__ @@ -111,5 +112,6 @@ int ptlrpc_expire_one_request(struct ptlrpc_request *req); int ptlrpc_start_pinger(void); int ptlrpc_stop_pinger(void); void ptlrpc_pinger_sending_on_import(struct obd_import *imp); +void ptlrpc_pinger_wake_up(void); #endif /* PTLRPC_INTERNAL_H */ diff --git a/lustre/ptlrpc/ptlrpc_module.c b/lustre/ptlrpc/ptlrpc_module.c index 87b385d..dfb9635 100644 --- a/lustre/ptlrpc/ptlrpc_module.c +++ b/lustre/ptlrpc/ptlrpc_module.c @@ -181,6 +181,7 @@ EXPORT_SYMBOL(ptlrpc_disconnect_import); EXPORT_SYMBOL(ptlrpc_resend); EXPORT_SYMBOL(ptlrpc_wake_delayed); EXPORT_SYMBOL(ptlrpc_set_import_active); +EXPORT_SYMBOL(ptlrpc_invalidate_import); EXPORT_SYMBOL(ptlrpc_fail_import); EXPORT_SYMBOL(ptlrpc_fail_export); EXPORT_SYMBOL(ptlrpc_recover_import); diff --git a/lustre/ptlrpc/recov_thread.c b/lustre/ptlrpc/recov_thread.c index d28b0b6..3d66eae 100644 --- a/lustre/ptlrpc/recov_thread.c +++ b/lustre/ptlrpc/recov_thread.c @@ -143,6 +143,11 @@ int llog_obd_repl_cancel(struct llog_ctxt *ctxt, LASSERT(ctxt); + if (ctxt->loc_imp == NULL) { + CWARN("no import for ctxt %p\n", ctxt); + RETURN(0); + } + if (count == 0 || cookies == NULL) { down(&ctxt->loc_sem); if (ctxt->loc_llcd == NULL || !(flags & OBD_LLOG_FL_SENDNOW)) @@ -561,7 +566,8 @@ static int llog_recovery_generic(struct llog_ctxt *ctxt, void *handle,void *arg) } int llog_repl_connect(struct llog_ctxt *ctxt, int count, - struct llog_logid *logid, struct llog_gen *gen) + struct llog_logid *logid, struct llog_gen *gen, + struct obd_uuid *uuid) { struct llog_canceld_ctxt *llcd; int rc; diff --git a/lustre/ptlrpc/recover.c b/lustre/ptlrpc/recover.c index 7eea191..1ff5f30 100644 --- a/lustre/ptlrpc/recover.c +++ b/lustre/ptlrpc/recover.c @@ -121,6 +121,32 @@ void ptlrpc_run_failed_import_upcall(struct obd_import* imp) #endif } +/* This might block waiting for the upcall to start, so it should + * not be called from a thread that shouldn't block. (Like ptlrpcd) */ +void ptlrpc_initiate_recovery(struct obd_import *imp) +{ + ENTRY; + + LASSERT (obd_lustre_upcall != NULL); + + if (strcmp(obd_lustre_upcall, "DEFAULT") == 0) { + CDEBUG(D_ERROR, "%s: starting recovery without upcall\n", + imp->imp_target_uuid.uuid); + ptlrpc_connect_import(imp, NULL); + } + else if (strcmp(obd_lustre_upcall, "NONE") == 0) { + CDEBUG(D_ERROR, "%s: recovery diabled\n", + imp->imp_target_uuid.uuid); + } + else { + CDEBUG(D_ERROR, "%s: calling upcall to start recovery\n", + imp->imp_target_uuid.uuid); + ptlrpc_run_failed_import_upcall(imp); + } + + EXIT; +} + int ptlrpc_replay_next(struct obd_import *imp, int *inflight) { int rc = 0; @@ -220,35 +246,6 @@ void ptlrpc_wake_delayed(struct obd_import *imp) spin_unlock_irqrestore(&imp->imp_lock, flags); } -inline void ptlrpc_invalidate_import_state(struct obd_import *imp) -{ - struct obd_device *obd = imp->imp_obd; - struct ldlm_namespace *ns = obd->obd_namespace; - - ptlrpc_abort_inflight(imp); - - obd_invalidate_import(obd, imp); - - ldlm_namespace_cleanup(ns, LDLM_FL_LOCAL_ONLY); -} - -void ptlrpc_handle_failed_import(struct obd_import *imp) -{ - ENTRY; - - if (!imp->imp_replayable) { - CDEBUG(D_HA, - "import %s@%s for %s not replayable, deactivating\n", - imp->imp_target_uuid.uuid, - imp->imp_connection->c_remote_uuid.uuid, - imp->imp_obd->obd_name); - ptlrpc_set_import_active(imp, 0); - } - - ptlrpc_run_failed_import_upcall(imp); - EXIT; -} - void ptlrpc_request_handle_notconn(struct ptlrpc_request *failed_req) { int rc; @@ -275,43 +272,41 @@ void ptlrpc_request_handle_notconn(struct ptlrpc_request *failed_req) EXIT; } +/* + * This should only be called by the ioctl interface, currently + * with the lctl deactivate and activate commands. + */ int ptlrpc_set_import_active(struct obd_import *imp, int active) { struct obd_device *obd = imp->imp_obd; unsigned long flags; + int rc = 0; LASSERT(obd); /* When deactivating, mark import invalid, and abort in-flight * requests. */ if (!active) { - spin_lock_irqsave(&imp->imp_lock, flags); - /* This is a bit of a hack, but invalidating replayable - * imports makes a temporary reconnect failure into a much more - * ugly -- and hard to remedy -- situation. */ - if (!imp->imp_replayable) { - CDEBUG(D_HA, "setting import %s INVALID\n", - imp->imp_target_uuid.uuid); - imp->imp_invalid = 1; - } - imp->imp_generation++; - spin_unlock_irqrestore(&imp->imp_lock, flags); - ptlrpc_invalidate_import_state(imp); - } + ptlrpc_invalidate_import(imp); + } - /* When activating, mark import valid */ + /* When activating, mark import valid, and attempt recovery */ if (active) { CDEBUG(D_HA, "setting import %s VALID\n", imp->imp_target_uuid.uuid); spin_lock_irqsave(&imp->imp_lock, flags); imp->imp_invalid = 0; spin_unlock_irqrestore(&imp->imp_lock, flags); - } - if (obd->obd_observer) - RETURN(obd_notify(obd->obd_observer, obd, active)); + rc = ptlrpc_recover_import(imp, NULL); + if (rc) { + spin_lock_irqsave(&imp->imp_lock, flags); + imp->imp_invalid = 1; + spin_unlock_irqrestore(&imp->imp_lock, flags); + } + } - RETURN(0); + RETURN(rc); } int ptlrpc_recover_import(struct obd_import *imp, char *new_uuid) diff --git a/lustre/ptlrpc/service.c b/lustre/ptlrpc/service.c index e07cae9..2307d20 100644 --- a/lustre/ptlrpc/service.c +++ b/lustre/ptlrpc/service.c @@ -91,7 +91,7 @@ ptlrpc_alloc_rqbd (struct ptlrpc_srv_ni *srv_ni) } spin_lock_irqsave (&svc->srv_lock, flags); - list_add(&rqbd->rqbd_list, &srv_ni->sni_rqbds); + list_add(&rqbd->rqbd_list, &svc->srv_idle_rqbds); svc->srv_nbufs++; spin_unlock_irqrestore (&svc->srv_lock, flags); @@ -191,6 +191,56 @@ timeval_sub(struct timeval *large, struct timeval *small) (large->tv_usec - small->tv_usec); } +static int +ptlrpc_server_post_idle_rqbds (struct ptlrpc_service *svc) +{ + struct ptlrpc_srv_ni *srv_ni; + struct ptlrpc_request_buffer_desc *rqbd; + unsigned long flags; + int rc; + + spin_lock_irqsave(&svc->srv_lock, flags); + if (list_empty (&svc->srv_idle_rqbds)) { + spin_unlock_irqrestore(&svc->srv_lock, flags); + return (0); + } + + rqbd = list_entry(svc->srv_idle_rqbds.next, + struct ptlrpc_request_buffer_desc, + rqbd_list); + list_del (&rqbd->rqbd_list); + + /* assume we will post successfully */ + srv_ni = rqbd->rqbd_srv_ni; + srv_ni->sni_nrqbd_receiving++; + list_add (&rqbd->rqbd_list, &srv_ni->sni_active_rqbds); + + spin_unlock_irqrestore(&svc->srv_lock, flags); + + rc = ptlrpc_register_rqbd(rqbd); + if (rc == 0) + return (1); + + spin_lock_irqsave(&svc->srv_lock, flags); + + srv_ni->sni_nrqbd_receiving--; + list_del(&rqbd->rqbd_list); + list_add_tail(&rqbd->rqbd_list, &svc->srv_idle_rqbds); + + if (srv_ni->sni_nrqbd_receiving == 0) { + /* This service is off-air on this interface because all + * its request buffers are busy. Portals will have started + * dropping incoming requests until more buffers get + * posted */ + CERROR("All %s %s request buffers busy\n", + svc->srv_name, srv_ni->sni_ni->pni_name); + } + + spin_unlock_irqrestore (&svc->srv_lock, flags); + + return (-1); +} + struct ptlrpc_service * ptlrpc_init_svc(int nbufs, int bufsize, int max_req_size, int req_portal, int rep_portal, @@ -227,6 +277,7 @@ ptlrpc_init_svc(int nbufs, int bufsize, int max_req_size, service->srv_handler = handler; INIT_LIST_HEAD(&service->srv_request_queue); + INIT_LIST_HEAD(&service->srv_idle_rqbds); INIT_LIST_HEAD(&service->srv_reply_queue); /* First initialise enough for early teardown */ @@ -235,7 +286,7 @@ ptlrpc_init_svc(int nbufs, int bufsize, int max_req_size, srv_ni->sni_service = service; srv_ni->sni_ni = &ptlrpc_interfaces[i]; - INIT_LIST_HEAD(&srv_ni->sni_rqbds); + INIT_LIST_HEAD(&srv_ni->sni_active_rqbds); INIT_LIST_HEAD(&srv_ni->sni_active_replies); } @@ -259,7 +310,12 @@ ptlrpc_init_svc(int nbufs, int bufsize, int max_req_size, srv_ni->sni_ni->pni_name); GOTO(failed, NULL); } - ptlrpc_register_rqbd (rqbd); + + /* We shouldn't be under memory pressure at + * startup, so fail if we can't post all our + * buffers at this time. */ + if (ptlrpc_server_post_idle_rqbds(service) <= 0) + GOTO(failed, NULL); } } @@ -275,6 +331,26 @@ failed: return NULL; } +static void +ptlrpc_server_free_request(struct ptlrpc_service *svc, struct ptlrpc_request *req) +{ + unsigned long flags; + int refcount; + + spin_lock_irqsave(&svc->srv_lock, flags); + svc->srv_n_active_reqs--; + refcount = --(req->rq_rqbd->rqbd_refcount); + if (refcount == 0) { + /* request buffer is now idle */ + list_del(&req->rq_rqbd->rqbd_list); + list_add_tail(&req->rq_rqbd->rqbd_list, + &svc->srv_idle_rqbds); + } + spin_unlock_irqrestore(&svc->srv_lock, flags); + + ptlrpc_free_server_req(req); +} + static int ptlrpc_server_handle_request (struct ptlrpc_service *svc) { @@ -283,7 +359,6 @@ ptlrpc_server_handle_request (struct ptlrpc_service *svc) struct timeval work_start; struct timeval work_end; long timediff; - int refcount; int rc; ENTRY; @@ -413,18 +488,8 @@ put_conn: } } - spin_lock_irqsave(&svc->srv_lock, flags); - svc->srv_n_active_reqs--; - refcount = --(request->rq_rqbd->rqbd_refcount); - spin_unlock_irqrestore(&svc->srv_lock, flags); - - if (refcount == 0) { - /* rqbd now idle: repost */ - ptlrpc_register_rqbd(request->rq_rqbd); - } - - ptlrpc_free_server_req(request); - + ptlrpc_server_free_request(svc, request); + RETURN(1); } @@ -529,6 +594,7 @@ int liblustre_check_services (void *arg) { int did_something = 0; + int rc; struct list_head *tmp, *nxt; ENTRY; @@ -548,12 +614,13 @@ liblustre_check_services (void *arg) svc->srv_nthreads++; - while (ptlrpc_server_handle_reply (svc)) - did_something++; - - while (ptlrpc_server_handle_request (svc)) - did_something++; - + do { + rc = ptlrpc_server_handle_reply(svc); + rc |= ptlrpc_server_handle_request(svc); + rc |= (ptlrpc_server_post_idle_rqbds(svc) > 0); + did_something |= rc; + } while (rc); + svc->srv_nthreads--; } @@ -571,6 +638,15 @@ void ptlrpc_daemonize(void) reparent_to_init(); } +static int +ptlrpc_retry_rqbds(void *arg) +{ + struct ptlrpc_service *svc = (struct ptlrpc_service *)arg; + + svc->srv_rqbd_timeout = 0; + return (-ETIMEDOUT); +} + static int ptlrpc_main(void *arg) { struct ptlrpc_svc_data *data = (struct ptlrpc_svc_data *)arg; @@ -603,10 +679,14 @@ static int ptlrpc_main(void *arg) while ((thread->t_flags & SVC_STOPPING) == 0 || svc->srv_n_difficult_replies != 0) { /* Don't exit while there are replies to be handled */ - struct l_wait_info lwi = { 0 }; - + struct l_wait_info lwi = LWI_TIMEOUT(svc->srv_rqbd_timeout, + ptlrpc_retry_rqbds, svc); + l_wait_event_exclusive (svc->srv_waitq, - (thread->t_flags & SVC_STOPPING) != 0 || + ((thread->t_flags & SVC_STOPPING) != 0 && + svc->srv_n_difficult_replies == 0) || + (!list_empty(&svc->srv_idle_rqbds) && + svc->srv_rqbd_timeout == 0) || !list_empty (&svc->srv_reply_queue) || (!list_empty (&svc->srv_request_queue) && (svc->srv_n_difficult_replies == 0 || @@ -624,6 +704,14 @@ static int ptlrpc_main(void *arg) (svc->srv_n_difficult_replies == 0 || svc->srv_n_active_reqs < (svc->srv_nthreads - 1))) ptlrpc_server_handle_request (svc); + + if (!list_empty(&svc->srv_idle_rqbds) && + ptlrpc_server_post_idle_rqbds(svc) < 0) { + /* I just failed to repost request buffers. Wait + * for a timeout (unless something else happens) + * before I try again */ + svc->srv_rqbd_timeout = HZ/10; + } } spin_lock_irqsave(&svc->srv_lock, flags); @@ -756,8 +844,8 @@ int ptlrpc_unregister_service(struct ptlrpc_service *service) service->srv_name, srv_ni->sni_ni->pni_name); /* Unlink all the request buffers. This forces a 'final' - * event with its 'unlink' flag set for each rqbd */ - list_for_each(tmp, &srv_ni->sni_rqbds) { + * event with its 'unlink' flag set for each posted rqbd */ + list_for_each(tmp, &srv_ni->sni_active_rqbds) { struct ptlrpc_request_buffer_desc *rqbd = list_entry(tmp, struct ptlrpc_request_buffer_desc, rqbd_list); @@ -812,25 +900,27 @@ int ptlrpc_unregister_service(struct ptlrpc_service *service) list_del(&req->rq_list); service->srv_n_queued_reqs--; - req->rq_rqbd->rqbd_refcount--; - - ptlrpc_free_server_req(req); + service->srv_n_active_reqs++; + + ptlrpc_server_free_request(service, req); } LASSERT(service->srv_n_queued_reqs == 0); + LASSERT(service->srv_n_active_reqs == 0); - /* Now free all the request buffers since nothing references them - * any more... */ for (i = 0; i < ptlrpc_ninterfaces; i++) { srv_ni = &service->srv_interfaces[i]; + LASSERT(list_empty(&srv_ni->sni_active_rqbds)); + } - while (!list_empty(&srv_ni->sni_rqbds)) { - struct ptlrpc_request_buffer_desc *rqbd = - list_entry(srv_ni->sni_rqbds.next, - struct ptlrpc_request_buffer_desc, - rqbd_list); + /* Now free all the request buffers since nothing references them + * any more... */ + while (!list_empty(&service->srv_idle_rqbds)) { + struct ptlrpc_request_buffer_desc *rqbd = + list_entry(service->srv_idle_rqbds.next, + struct ptlrpc_request_buffer_desc, + rqbd_list); - ptlrpc_free_rqbd(rqbd); - } + ptlrpc_free_rqbd(rqbd); } /* wait for all outstanding replies to complete (they were diff --git a/lustre/scripts/branch.sh b/lustre/scripts/branch.sh new file mode 100755 index 0000000..875c71d --- /dev/null +++ b/lustre/scripts/branch.sh @@ -0,0 +1,39 @@ +#!/bin/sh -e +CVS=${CVS:-cvs} + +if [ $# != 2 ]; then + echo "This creates a new branch in CVS. Usage: $0 parent child" + exit +fi + +parent=$1 +child=$2 +CHILD=`echo $child | sed -e "s/^b_//" | tr "[a-z]" "[A-Z]"` +module=lustre + +case $parent in + HEAD) : ;; + b_*|b1*) : ;; + *) parent="b_$parent" ;; +esac +case $child in + HEAD) : ;; + b_*|b1*) : ;; + *) child="b_$child" +esac + +if [ "$parent" != "HEAD" -a "`cat CVS/Tag`" != "T$parent" ]; then + echo "This script must be run within the $parent branch" + exit 1 +fi + +echo parent: $parent CHILD: $CHILD child: $child date: $date + +echo -n "tagging $parent as '${CHILD}_BASE' ...." +$CVS rtag -r $parent ${CHILD}_BASE $module +echo "done" +echo -n "branching $child at ${CHILD}_BASE' ...." +$CVS rtag -b -r ${CHILD}_BASE $child $module +echo -n "updating to $child ...." +$CVS update -r $child +echo "done" diff --git a/lustre/scripts/land1.sh b/lustre/scripts/land1.sh index 0c07803..16f6b20 100755 --- a/lustre/scripts/land1.sh +++ b/lustre/scripts/land1.sh @@ -25,6 +25,17 @@ CHILD=`echo $child | sed -e "s/^b_//" | tr "[a-z]" "[A-Z]"` date=`date +%Y%m%d_%H%M` module=lustre +case $parent in + HEAD) : ;; + b_*|b1*) : ;; + *) parent="b_$parent" ;; +esac +case $child in + HEAD) : ;; + b_*|b1*) : ;; + *) child="b_$child" +esac + if [ "$parent" != "HEAD" -a "`cat CVS/Tag`" != "T$parent" ]; then echo "This script must be run within the $parent branch" exit 1 @@ -32,13 +43,6 @@ fi dir=$3 -if [ $parent != "HEAD" ]; then - parent="b_$parent" -fi -if [ $child != "HEAD" ]; then - child="b_$child" -fi - cat << EOF > .mergeinfo parent=$parent PARENT=$PARENT @@ -90,4 +94,3 @@ fi echo "done" echo "Test, commit and then run land2.sh (no arguments)" - diff --git a/lustre/tests/acceptance-small.sh b/lustre/tests/acceptance-small.sh index 31bb8ad..6a32076 100755 --- a/lustre/tests/acceptance-small.sh +++ b/lustre/tests/acceptance-small.sh @@ -156,3 +156,11 @@ fi if [ "$CONF_SANITY" != "no" ]; then sh conf-sanity.sh fi + +if [ "$REPLAY_OST_SINGLE" != "no" ]; then + sh replay-ost-single.sh +fi + +if [ "$RECOVERY_SMALL" != "no" ]; then + sh recovery-small.sh +fi diff --git a/lustre/tests/conf-sanity.sh b/lustre/tests/conf-sanity.sh index 9380a2d..69979fe 100644 --- a/lustre/tests/conf-sanity.sh +++ b/lustre/tests/conf-sanity.sh @@ -14,6 +14,7 @@ PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH LUSTRE=${LUSTRE:-`dirname $0`/..} RLUSTRE=${RLUSTRE:-$LUSTRE} +MOUNTLUSTRE=${MOUNTLUSTRE:-/sbin/mount.lustre} . $LUSTRE/tests/test-framework.sh @@ -47,7 +48,7 @@ start_mds() { } stop_mds() { echo "stop mds service on `facet_active_host mds`" - stop mds $@ || return 97 + stop mds $@ || return 97 } start_ost() { @@ -57,7 +58,7 @@ start_ost() { stop_ost() { echo "stop ost service on `facet_active_host ost`" - stop ost $@ || return 98 + stop ost $@ || return 98 } mount_client() { @@ -80,7 +81,7 @@ manual_umount_client(){ setup() { start_ost start_mds - mount_client $MOUNT + mount_client $MOUNT } cleanup() { @@ -88,7 +89,7 @@ cleanup() { stop_mds || return 201 stop_ost || return 202 # catch case where these return just fine, but modules are still not unloaded - /sbin/lsmod | grep -q portals + /sbin/lsmod | grep -q portals if [ 1 -ne $? ]; then echo "modules still loaded..." return 203 @@ -119,7 +120,7 @@ gen_config test_0() { start_ost start_mds - mount_client $MOUNT + mount_client $MOUNT check_mount || return 41 cleanup || return $? } @@ -128,7 +129,7 @@ run_test 0 "single mount setup" test_1() { start_ost echo "start ost second time..." - start ost --reformat $OSTLCONFARGS + start ost --reformat $OSTLCONFARGS start_mds mount_client $MOUNT check_mount || return 42 @@ -140,16 +141,16 @@ test_2() { start_ost start_mds echo "start mds second time.." - start mds --reformat $MDSLCONFARGS + start mds --reformat $MDSLCONFARGS - mount_client $MOUNT + mount_client $MOUNT check_mount || return 43 cleanup || return $? } run_test 2 "start up mds twice" test_3() { - setup + setup mount_client $MOUNT check_mount || return 44 @@ -163,7 +164,7 @@ test_4() { setup touch $DIR/$tfile || return 85 stop_ost --force - cleanup + cleanup eno=$? # ok for ost to fail shutdown if [ 202 -ne $eno ]; then @@ -178,8 +179,8 @@ test_5() { touch $DIR/$tfile || return 1 stop_mds --force || return 2 - # cleanup may return an error from the failed - # disconnects; for now I'll consider this successful + # cleanup may return an error from the failed + # disconnects; for now I'll consider this successful # if all the modules have unloaded. umount $MOUNT & UMOUNT_PID=$! @@ -187,10 +188,10 @@ test_5() { echo "killing umount" kill -TERM $UMOUNT_PID echo "waiting for umount to finish" - wait $UMOUNT_PID + wait $UMOUNT_PID # cleanup client modules - $LCONF --cleanup --nosetup --node client_facet $XMLCONFIG > /dev/null + $LCONF --cleanup --nosetup --node client_facet $XMLCONFIG > /dev/null # stop_mds is a no-op here, and should not fail stop_mds || return 4 @@ -207,11 +208,11 @@ test_5b() { stop_mds [ -d $MOUNT ] || mkdir -p $MOUNT - $LCONF --nosetup --node client_facet $XMLCONFIG > /dev/null + $LCONF --nosetup --node client_facet $XMLCONFIG > /dev/null llmount $mds_HOST://mds_svc/client_facet $MOUNT && exit 1 # cleanup client modules - $LCONF --cleanup --nosetup --node client_facet $XMLCONFIG > /dev/null + $LCONF --cleanup --nosetup --node client_facet $XMLCONFIG > /dev/null # stop_mds is a no-op here, and should not fail stop_mds || return 2 @@ -228,11 +229,11 @@ test_5c() { start_mds [ -d $MOUNT ] || mkdir -p $MOUNT - $LCONF --nosetup --node client_facet $XMLCONFIG > /dev/null + $LCONF --nosetup --node client_facet $XMLCONFIG > /dev/null llmount $mds_HOST://wrong_mds_svc/client_facet $MOUNT && exit 1 # cleanup client modules - $LCONF --cleanup --nosetup --node client_facet $XMLCONFIG > /dev/null + $LCONF --cleanup --nosetup --node client_facet $XMLCONFIG > /dev/null stop_mds || return 2 stop_ost || return 3 @@ -263,12 +264,12 @@ test_8() { start_ost start_mds - mount_client $MOUNT - mount_client $MOUNT2 + mount_client $MOUNT + mount_client $MOUNT2 check_mount2 || return 45 umount $MOUNT - umount_client $MOUNT2 + umount_client $MOUNT2 stop_mds stop_ost @@ -279,7 +280,7 @@ test_9() { # backup the old values of PTLDEBUG and SUBSYSTEM OLDPTLDEBUG=$PTLDEBUG OLDSUBSYSTEM=$SUBSYSTEM - + # generate new configuration file with lmc --ptldebug and --subsystem PTLDEBUG="trace" SUBSYSTEM="mdc" @@ -364,7 +365,7 @@ test_11() { add_ost ost --dev $OSTDEV --size $OSTSIZE add_client client mds --path $MOUNT --ost ost_svc || return $? echo "Default lov config success!" - + [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG add_mds mds --dev $MDSDEV --size $MDSSIZE add_ost ost --dev $OSTDEV --size $OSTSIZE @@ -394,7 +395,7 @@ test_12() { else echo "matched double quote fail" return 1 - fi + fi rm -f $XMLCONFIG rm -f $BATCHFILE echo "--add net --node localhost --nid localhost.localdomain --nettype tcp" > $BATCHFILE @@ -507,11 +508,11 @@ test_14() { add_lov lov1 mds --stripe_sz $STRIPE_BYTES\ --stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0 add_ost ost --lov lov1 --dev $OSTDEV --size $OSTSIZE \ - --mkfsoptions "-Llabel_conf_15" + --mkfsoptions "-Llabel_conf_14" add_client client mds --lov lov1 --path $MOUNT FOUNDSTRING=`awk -F"<" '//{print $2}' $XMLCONFIG` - EXPECTEDSTRING="mkfsoptions>-Llabel_conf_15" + EXPECTEDSTRING="mkfsoptions>-Llabel_conf_14" if [ $EXPECTEDSTRING != $FOUNDSTRING ]; then echo "Error: expected: $EXPECTEDSTRING; found: $FOUNDSTRING" return 1 @@ -523,7 +524,7 @@ test_14() { start_ost start_mds mount_client $MOUNT || return $? - if [ -z "`dumpe2fs -h $OSTDEV | grep label_conf_15`" ]; then + if [ -z "`dumpe2fs -h $OSTDEV | grep label_conf_14`" ]; then echo "Error: the mkoptions not applied to mke2fs of ost." return 1 fi @@ -534,4 +535,99 @@ test_14() { } run_test 14 "test mkfsoptions of ost for lmc and lconf" +cleanup_15() { + trap 0 + [ -f $MOUNTLUSTRE ] && echo "remove $MOUNTLUSTRE" && rm -f $MOUNTLUSTRE + if [ -f $MOUNTLUSTRE.sav ]; then + echo "return original $MOUNTLUSTRE.sav to $MOUNTLUSTRE" + mv $MOUNTLUSTRE.sav $MOUNTLUSTRE + fi +} + +test_15() { + start_ost + start_mds + echo "mount lustre on ${MOUNT} with $MOUNTLUSTRE....." + if [ -f "$MOUNTLUSTRE" ]; then + echo "save $MOUNTLUSTRE to $MOUNTLUSTRE.sav" + mv $MOUNTLUSTRE $MOUNTLUSTRE.sav + fi + [ -f "$MOUNTLUSTRE" ] && echo "can't move $MOUNTLUSTRE" && return 40 + trap cleanup_15 EXIT INT + [ ! `cp $LUSTRE/utils/llmount $MOUNTLUSTRE` ] || return $? + do_node `hostname` mkdir -p $MOUNT 2> /dev/null + # load llite module on the client if it isn't in /lib/modules + do_node `hostname` lconf --nosetup --node client_facet $XMLCONFIG + do_node `hostname` mount -t lustre -o nettype=$NETTYPE \ + `facet_active_host mds`:/mds_svc/client_facet $MOUNT ||return $? + echo "mount lustre on $MOUNT with $MOUNTLUSTRE: success" + [ -d /r ] && $LCTL modules > /r/tmp/ogdb-`hostname` + check_mount || return 41 + do_node `hostname` umount $MOUNT + + [ -f "$MOUNTLUSTRE" ] && rm -f $MOUNTLUSTRE + echo "mount lustre on ${MOUNT} without $MOUNTLUSTRE....." + do_node `hostname` mount -t lustre -o nettype=$NETTYPE \ + `facet_active_host mds`:/mds_svc/client_facet $MOUNT &&return $? + echo "mount lustre on $MOUNT without $MOUNTLUSTRE failed as expected" + cleanup || return $? + cleanup_15 +} +run_test 15 "zconf-mount without /sbin/mount.lustre (should return error)" + +test_16() { + TMPMTPT="/mnt/conf16" + + if [ ! -f "$MDSDEV" ]; then + echo "no $MDSDEV existing, so mount Lustre to create one" + start_ost + start_mds + mount_client $MOUNT + check_mount || return 41 + cleanup || return $? + fi + + echo "change the mode of $MDSDEV/OBJECTS,LOGS,PENDING to 555" + [ -d $TMPMTPT ] || mkdir -p $TMPMTPT + mount -o loop -t ext3 $MDSDEV $TMPMTPT || return $? + chmod 555 $TMPMTPT/OBJECTS || return $? + chmod 555 $TMPMTPT/LOGS || return $? + chmod 555 $TMPMTPT/PENDING || return $? + umount $TMPMTPT || return $? + + echo "mount Lustre to change the mode of OBJECTS/LOGS/PENDING, then umount Lustre" + start_ost + start_mds + mount_client $MOUNT + check_mount || return 41 + cleanup || return $? + + echo "read the mode of OBJECTS/LOGS/PENDING and check if they has been changed properly" + EXPECTEDOBJECTSMODE=`debugfs -R "stat OBJECTS" $MDSDEV 2> /dev/null | awk '/Mode: /{print $6}'` + EXPECTEDLOGSMODE=`debugfs -R "stat LOGS" $MDSDEV 2> /dev/null | awk '/Mode: /{print $6}'` + EXPECTEDPENDINGMODE=`debugfs -R "stat PENDING" $MDSDEV 2> /dev/null | awk '/Mode: /{print $6}'` + + if [ $EXPECTEDOBJECTSMODE = "0777" ]; then + echo "Success:Lustre change the mode of OBJECTS correctly" + else + echo "Error: Lustre does not change the mode of OBJECTS properly" + return 1 + fi + + if [ $EXPECTEDLOGSMODE = "0777" ]; then + echo "Success:Lustre change the mode of LOGS correctly" + else + echo "Error: Lustre does not change the mode of LOGS properly" + return 1 + fi + + if [ $EXPECTEDPENDINGMODE = "0777" ]; then + echo "Success:Lustre change the mode of PENDING correctly" + else + echo "Error: Lustre does not change the mode of PENDING properly" + return 1 + fi +} +run_test 16 "verify that lustre will correct the mode of OBJECTS/LOGS/PENDING" + equals_msg "Done" diff --git a/lustre/tests/recovery-small.sh b/lustre/tests/recovery-small.sh index 1d4d976..5cd1e62 100755 --- a/lustre/tests/recovery-small.sh +++ b/lustre/tests/recovery-small.sh @@ -91,6 +91,7 @@ run_test 4 "open: drop req, drop rep" test_5() { drop_request "mv $MOUNT/resolv.conf $MOUNT/renamed" || return 1 drop_reply "mv $MOUNT/renamed $MOUNT/renamed-again" || return 2 + do_facet client "checkstat -v $MOUNT/renamed-again" || return 3 } run_test 5 "rename: drop req, drop rep" @@ -155,11 +156,12 @@ run_test 11 "wake up a thead waiting for completion after eviction (b=2460)" #b=2494 test_12(){ $LCTL mark multiop $MOUNT/$tfile OS_c + do_facet mds "sysctl -w lustre.fail_loc=0x115" + clear_failloc mds $((TIMEOUT * 2)) & multiop $MOUNT/$tfile OS_c & PID=$! #define OBD_FAIL_MDS_CLOSE_NET 0x115 - do_facet mds "sysctl -w lustre.fail_loc=0x115" - clear_failloc mds $((TIMEOUT * 2)) & + sleep 2 kill -USR1 $PID echo "waiting for multiop $PID" wait $PID || return 2 diff --git a/lustre/tests/replay-dual.sh b/lustre/tests/replay-dual.sh index f6395a4..8e10631 100755 --- a/lustre/tests/replay-dual.sh +++ b/lustre/tests/replay-dual.sh @@ -175,7 +175,6 @@ test_6() { } run_test 6 "open1, open2, unlink |X| close1 [fail mds] close2" - if [ "$ONLY" != "setup" ]; then equals_msg test complete, cleaning up cleanup diff --git a/lustre/tests/replay-ost-single.sh b/lustre/tests/replay-ost-single.sh index 0861045..bd109b9 100755 --- a/lustre/tests/replay-ost-single.sh +++ b/lustre/tests/replay-ost-single.sh @@ -47,23 +47,28 @@ fi build_test_filter -rm -f ostactive +SETUP=${SETUP:-"setup"} +CLEANUP=${CLEANUP:-"cleanup"} -gen_config +setup() { + gen_config -start ost --reformat $OSTLCONFARGS - -[ "$DAEMONFILE" ] && $LCTL debug_daemon start $DAEMONFILE $DAEMONSIZE -start mds --reformat $MDSLCONFARGS -zconf_mount `hostname` $MOUNT + start ost --reformat $OSTLCONFARGS + [ "$DAEMONFILE" ] && $LCTL debug_daemon start $DAEMONFILE $DAEMONSIZE + start mds --reformat $MDSLCONFARGS + zconf_mount `hostname` $MOUNT +} mkdir -p $DIR +$SETUP + test_0() { fail ost cp /etc/profile $DIR/$tfile sync diff /etc/profile $DIR/$tfile + rm -f $DIR/$tfile } run_test 0 "empty replay" @@ -71,6 +76,7 @@ test_1() { date > $DIR/$tfile fail ost $CHECKSTAT -t file $DIR/$tfile || return 1 + rm -f $DIR/$tfile } run_test 1 "touch" @@ -82,6 +88,7 @@ test_2() { for i in `seq 10`; do grep -q "tag-$i" $DIR/$tfile-$i || error "f2-$i" done + rm -f $DIR/$tfile-* } run_test 2 "|x| 10 open(O_CREAT)s" @@ -120,8 +127,56 @@ test_5() { sleep 10 fail ost wait $PID || return 1 + rm -f $DIR/$tfile } run_test 5 "Fail OST during iozone" +kbytesfree() { + cat /proc/fs/lustre/osc/OSC_*MNT*/kbytesfree | awk '{total+=$1} END {print total}' +} + +test_6() { + f=$DIR/$tfile + before=`kbytesfree` + dd if=/dev/urandom bs=1024 count=5120 of=$f +#define OBD_FAIL_MDS_REINT_NET_REP 0x119 + do_facet mds "sysctl -w lustre.fail_loc=0x80000119" + sync + after_dd=`kbytesfree` + echo "before: $before after_dd: $after_dd" + (( before > after_dd )) || return 1 + rm -f $f + fail ost + $CHECKSTAT -t file $f && return 2 || true + sync + # let the delete happen + sleep 2 + after=`kbytesfree` + echo "before: $before after: $after" + (( before == after )) || return 3 +} +run_test 6 "Fail OST before obd_destroy" + +test_7() { + f=$DIR/$tfile + before=`kbytesfree` + dd if=/dev/urandom bs=1024 count=5120 of=$f + sync + after_dd=`kbytesfree` + echo "before: $before after_dd: $after_dd" + (( before > after_dd )) || return 1 + replay_barrier ost + rm -f $f + fail ost + $CHECKSTAT -t file $f && return 2 || true + sync + # let the delete happen + sleep 2 + after=`kbytesfree` + echo "before: $before after: $after" + (( before == after )) || return 3 +} +run_test 7 "Fail OST before obd_destroy" + equals_msg test complete, cleaning up -cleanup +$CLEANUP diff --git a/lustre/tests/replay-single.sh b/lustre/tests/replay-single.sh index 9030789..67595fc 100755 --- a/lustre/tests/replay-single.sh +++ b/lustre/tests/replay-single.sh @@ -797,6 +797,47 @@ test_40(){ } run_test 40 "cause recovery in ptlrpc, ensure IO continues" + +#b=2814 +# make sure that a read to one osc doesn't try to double-unlock its page just +# because another osc is invalid. trigger_group_io used to mistakenly return +# an error if any oscs were invalid even after having successfully put rpcs +# on valid oscs. This was fatal if the caller was ll_readpage who unlocked +# the page, guarnateeing that the unlock from the RPC completion would +# assert on trying to unlock the unlocked page. +test_41() { + local f=$MOUNT/$tfile + # make sure the start of the file is ost1 + lfs setstripe $f $((128 * 1024)) 0 0 + do_facet client dd if=/dev/zero of=$f bs=4k count=1 || return 3 + cancel_lru_locks OSC + # fail ost2 and read from ost1 + local osc2_dev=`$LCTL device_list | \ + awk '(/ost2.*client_facet/){print $4}' ` + $LCTL --device %$osc2_dev deactivate + do_facet client dd if=$f of=/dev/null bs=4k count=1 || return 3 + $LCTL --device %$osc2_dev activate + return 0 +} +run_test 41 "read from a valid osc while other oscs are invalid" + +# test MDS recovery after ost failure +test_42() { + createmany -o $DIR/$tfile-%d 800 + replay_barrier ost + unlinkmany $DIR/$tfile-%d 0 400 + facet_failover ost + + # osc is evicted after + df $MOUNT && return 1 + df $MOUNT || return 2 + echo wait for MDS to timeout and recover + sleep $((TIMEOUT * 2)) + unlinkmany $DIR/$tfile-%d 400 400 + $CHECKSTAT -t file $DIR/$tfile-* && return 1 || true +} +run_test 42 "recoery after ost failure" + equals_msg test complete, cleaning up $CLEANUP diff --git a/lustre/tests/runslabinfo b/lustre/tests/runslabinfo index eba407d..070a186 100755 --- a/lustre/tests/runslabinfo +++ b/lustre/tests/runslabinfo @@ -2,4 +2,5 @@ while sleep 1 ; do echo '-----------------------' egrep "ll_|ldlm|filp|dentry|inode|portals|size-[0-9]* " /proc/slabinfo + cat /proc/meminfo done diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index ea4810e..84b645a 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -697,7 +697,7 @@ run_test 26e "unlink multiple component recursive symlink ======" test_27a() { echo '== stripe sanity ==============================================' mkdir $DIR/d27 - $LSTRIPE $DIR/d27/f0 8192 0 1 || error + $LSTRIPE $DIR/d27/f0 65536 0 1 || error $CHECKSTAT -t file $DIR/d27/f0 || error pass log "== test_27b: write to one stripe file =========================" @@ -710,7 +710,7 @@ test_27c() { if [ ! -d $DIR/d27 ]; then mkdir $DIR/d27 fi - $LSTRIPE $DIR/d27/f01 8192 0 2 || error + $LSTRIPE $DIR/d27/f01 65536 0 2 || error [ `$LFIND $DIR/d27/f01 | grep -A 10 obdidx | wc -l` -eq 4 ] || error "two-stripe file doesn't have two stripes" pass @@ -733,8 +733,8 @@ test_27e() { if [ ! -d $DIR/d27 ]; then mkdir $DIR/d27 fi - $LSTRIPE $DIR/d27/f12 8192 0 2 || error - $LSTRIPE $DIR/d27/f12 8192 0 2 && error + $LSTRIPE $DIR/d27/f12 65536 0 2 || error + $LSTRIPE $DIR/d27/f12 65536 0 2 && error $CHECKSTAT -t file $DIR/d27/f12 || error } run_test 27e "lstripe existing file (should return error) ======" @@ -768,10 +768,23 @@ test_27j() { if [ ! -d $DIR/d27 ]; then mkdir $DIR/d27 fi - $LSTRIPE $DIR/d27/f27j 8192 $STRIPECOUNT 1 && error || true + $LSTRIPE $DIR/d27/f27j 65536 $STRIPECOUNT 1 && error || true } run_test 27j "lstripe with bad stripe offset (should return error)" +test_27k() { # bug 2844 + FILE=$DIR/d27/f27k + LL_MAX_BLKSIZE=$((4 * 1024 * 1024)) + [ ! -d $DIR/d27 ] && mkdir -p $DIR/d27 + $LSTRIPE $FILE 67108864 -1 0 || error "lstripe failed" + BLKSIZE=`stat $FILE | awk '/IO Block:/ { print $7 }'` + [ $BLKSIZE -le $LL_MAX_BLKSIZE ] || error "$BLKSIZE > $LL_MAX_BLKSIZE" + dd if=/dev/zero of=$FILE bs=4k count=1 + BLKSIZE=`stat $FILE | awk '/IO Block:/ { print $7 }'` + [ $BLKSIZE -le $LL_MAX_BLKSIZE ] || error "$BLKSIZE > $LL_MAX_BLKSIZE" +} +run_test 27k "limit i_blksize for broken user apps =============" + test_28() { mkdir $DIR/d28 $CREATETEST $DIR/d28/ct || error diff --git a/lustre/tests/sanityN.sh b/lustre/tests/sanityN.sh index 6c8172b..b15e2bf 100644 --- a/lustre/tests/sanityN.sh +++ b/lustre/tests/sanityN.sh @@ -3,8 +3,8 @@ set -e ONLY=${ONLY:-"$*"} -# bug number for skipped test: 1557 -ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-"8"} +# bug number for skipped test: 1768 1557 +ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-"4 8 14b"} # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT! [ "$ALWAYS_EXCEPT$EXCEPT" ] && echo "Skipping tests: $ALWAYS_EXCEPT $EXCEPT" @@ -214,7 +214,7 @@ test_9() { [ "$MTPT" -eq 1 ] && MTPT=2 || MTPT=1 done [ "`cat $DIR1/f9`" = "abcdefghijkl" ] || \ - error "`od -a $DIR1/f10` != abcdefghijkl" + error "`od -a $DIR1/f9` != abcdefghijkl" } run_test 9 "append of file with sub-page size on multiple mounts" diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index 4b054d5..b493c9c 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -454,6 +454,7 @@ cancel_lru_locks() { # Test interface error() { echo "${TESTSUITE}: **** FAIL:" $@ + log "FAIL: $@" exit 1 } @@ -514,6 +515,11 @@ equals_msg() { printf '===== %s %.*s\n' "$msg" $suffixlen $EQUALS } +log() { + echo "$*" + lctl mark "$*" 2> /dev/null || true +} + run_one() { testnum=$1 message=$2 @@ -523,6 +529,7 @@ run_one() { # Pretty tests run faster. equals_msg $testnum: $message + log "== test $1: $2" test_${testnum} || error "test_$testnum failed with $?" } diff --git a/lustre/utils/llmount.c b/lustre/utils/llmount.c index 2f35ded..ce28e09 100644 --- a/lustre/utils/llmount.c +++ b/lustre/utils/llmount.c @@ -70,6 +70,7 @@ int init_options(struct lustre_mount_data *lmd) { memset(lmd, 0, sizeof(lmd)); + lmd->lmd_magic = LMD_MAGIC; lmd->lmd_server_nid = PTL_NID_ANY; lmd->lmd_local_nid = PTL_NID_ANY; lmd->lmd_port = 988; /* XXX define LUSTRE_DEFAULT_PORT */ @@ -98,7 +99,7 @@ parse_options(char * options, struct lustre_mount_data *lmd) int val; char *opt; char * opteq; - + /* parsing ideas here taken from util-linux/mount/nfsmount.c */ for (opt = strtok(options, ","); opt; opt = strtok(NULL, ",")) { if ((opteq = strchr(opt, '='))) { @@ -178,31 +179,25 @@ set_local(struct lustre_mount_data *lmd) return rc; } } else if (lmd->lmd_nal == QSWNAL) { -#if MULTIRAIL_EKC char *pfiles[] = {"/proc/qsnet/elan3/device0/position", "/proc/qsnet/elan4/device0/position", + "/proc/elan/device0/position", NULL}; -#else - char *pfiles[] = {"/proc/elan/device0/position", - NULL}; -#endif int i = 0; do { rc = get_local_elan_id(pfiles[i], buf); - } while (rc != 0 && - pfiles[++i] != NULL); - + } while (rc != 0 && pfiles[++i] != NULL); + if (rc != 0) { - fprintf(stderr, "mount: can't read elan ID" - " from /proc\n"); + fprintf(stderr, + "mount: can't read Elan ID from /proc\n"); return -1; } } if (ptl_parse_nid (&nid, buf) != 0) { - fprintf (stderr, "mount: can't parse NID %s\n", - buf); + fprintf (stderr, "mount: can't parse NID %s\n", buf); return (-1); } @@ -261,6 +256,9 @@ build_data(char *source, char *options, struct lustre_mount_data *lmd) char *s; int rc; + if (lmd_bad_magic(lmd)) + return -EINVAL; + if (strlen(source) > sizeof(target) + 1) { fprintf(stderr, "mount: " "exessively long host:/mds/profile argument\n"); @@ -315,7 +313,6 @@ build_data(char *source, char *options, struct lustre_mount_data *lmd) } strcpy(lmd->lmd_profile, profile); - if (verbose) print_options(lmd); return 0; diff --git a/lustre/utils/wirecheck.c b/lustre/utils/wirecheck.c index 8445ce9..8fb5d2e 100644 --- a/lustre/utils/wirecheck.c +++ b/lustre/utils/wirecheck.c @@ -22,12 +22,16 @@ do { \ #define CHECK_DEFINE(a) \ do { \ - printf(" LASSERT("#a" == "STRINGIFY(a)");\n"); \ + printf(" LASSERTF("#a" == "STRINGIFY(a) \ + ",\" found %%lld\\n\",\n " \ + "(long long)"#a");\n"); \ } while(0) #define CHECK_VALUE(a) \ do { \ - printf(" LASSERT("#a" == %d);\n", a); \ + printf(" LASSERTF("#a \ + " == %d, \" found %%lld\\n\",\n "\ + "(long long)"#a");\n",a);\ } while(0) #define CHECK_MEMBER_OFFSET(s,m) \ @@ -468,6 +472,18 @@ check_ldlm_reply(void) } void +check_ldlm_lvb(void) +{ + BLANK_LINE(); + CHECK_STRUCT(ost_lvb); + CHECK_MEMBER(ost_lvb, lvb_size); + CHECK_MEMBER(ost_lvb, lvb_mtime); + CHECK_MEMBER(ost_lvb, lvb_atime); + CHECK_MEMBER(ost_lvb, lvb_ctime); + CHECK_MEMBER(ost_lvb, lvb_blocks); +} + +void check_ptlbd_op(void) { BLANK_LINE(); @@ -519,6 +535,14 @@ check_llog_logid(void) } void +check_llog_catid(void) +{ + BLANK_LINE(); + CHECK_STRUCT(llog_catid); + CHECK_MEMBER(llog_catid, lci_logid); +} + +void check_llog_rec_hdr(void) { BLANK_LINE(); @@ -870,10 +894,12 @@ main(int argc, char **argv) check_ldlm_lock_desc(); check_ldlm_request(); check_ldlm_reply(); + check_ldlm_lvb(); check_ptlbd_op(); check_ptlbd_niob(); check_ptlbd_rsp(); check_llog_logid(); + check_llog_catid(); check_llog_rec_hdr(); check_llog_rec_tail(); check_llog_logid_rec(); diff --git a/lustre/utils/wirehdr.c b/lustre/utils/wirehdr.c index c245ff3..b513d58 100644 --- a/lustre/utils/wirehdr.c +++ b/lustre/utils/wirehdr.c @@ -4,7 +4,9 @@ #include #undef LASSERT +#undef LASSERTF #define LASSERT(cond) if (!(cond)) { printf("failed " #cond "\n"); ret = 1; } +#define LASSERTF(cond, fmt, arg) if (!(cond)) { printf("failed '" #cond "'" fmt, arg);ret = 1;} int ret; diff --git a/lustre/utils/wiretest.c b/lustre/utils/wiretest.c index e426715..849b0f0 100644 --- a/lustre/utils/wiretest.c +++ b/lustre/utils/wiretest.c @@ -4,7 +4,9 @@ #include #undef LASSERT +#undef LASSERTF #define LASSERT(cond) if (!(cond)) { printf("failed " #cond "\n"); ret = 1; } +#define LASSERTF(cond, fmt, arg) if (!(cond)) { printf("failed '" #cond "'" fmt, arg);ret = 1;} int ret; @@ -23,769 +25,1472 @@ int main() void lustre_assert_wire_constants(void) { /* Wire protocol assertions generated by 'wirecheck' - * running on Linux adevi 2.4.18-p4smp-10pre1 #1 SMP Thu Feb 5 14:52:15 PST 2004 i686 unknown - * with gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-113) */ + * running on Linux schnapps.adilger.int 2.4.22-l32 #4 Thu Jan 8 14:32:57 MST 2004 i686 i686 + * with gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5) */ /* Constants... */ - LASSERT(PTLRPC_MSG_MAGIC == 0x0BD00BD0); - LASSERT(PTLRPC_MSG_VERSION == 0x00000003); - LASSERT(PTL_RPC_MSG_REQUEST == 4711); - LASSERT(PTL_RPC_MSG_ERR == 4712); - LASSERT(PTL_RPC_MSG_REPLY == 4713); - LASSERT(MSG_LAST_REPLAY == 1); - LASSERT(MSG_RESENT == 2); - LASSERT(MSG_REPLAY == 4); - LASSERT(MSG_CONNECT_RECOVERING == 1); - LASSERT(MSG_CONNECT_RECONNECT == 2); - LASSERT(MSG_CONNECT_REPLAYABLE == 4); - LASSERT(OST_REPLY == 0); - LASSERT(OST_GETATTR == 1); - LASSERT(OST_SETATTR == 2); - LASSERT(OST_READ == 3); - LASSERT(OST_WRITE == 4); - LASSERT(OST_CREATE == 5); - LASSERT(OST_DESTROY == 6); - LASSERT(OST_GET_INFO == 7); - LASSERT(OST_CONNECT == 8); - LASSERT(OST_DISCONNECT == 9); - LASSERT(OST_PUNCH == 10); - LASSERT(OST_OPEN == 11); - LASSERT(OST_CLOSE == 12); - LASSERT(OST_STATFS == 13); - LASSERT(OST_SAN_READ == 14); - LASSERT(OST_SAN_WRITE == 15); - LASSERT(OST_SYNC == 16); - LASSERT(OST_LAST_OPC == 18); - LASSERT(OBD_OBJECT_EOF == 0xffffffffffffffffULL); - LASSERT(OST_REQ_HAS_OA1 == 1); - LASSERT(MDS_GETATTR == 33); - LASSERT(MDS_GETATTR_NAME == 34); - LASSERT(MDS_CLOSE == 35); - LASSERT(MDS_REINT == 36); - LASSERT(MDS_READPAGE == 37); - LASSERT(MDS_CONNECT == 38); - LASSERT(MDS_DISCONNECT == 39); - LASSERT(MDS_GETSTATUS == 40); - LASSERT(MDS_STATFS == 41); - LASSERT(MDS_PIN == 42); - LASSERT(MDS_UNPIN == 43); - LASSERT(MDS_SYNC == 44); - LASSERT(MDS_DONE_WRITING == 45); - LASSERT(MDS_LAST_OPC == 46); - LASSERT(REINT_SETATTR == 1); - LASSERT(REINT_CREATE == 2); - LASSERT(REINT_LINK == 3); - LASSERT(REINT_UNLINK == 4); - LASSERT(REINT_RENAME == 5); - LASSERT(REINT_OPEN == 6); - LASSERT(REINT_MAX == 6); - LASSERT(DISP_IT_EXECD == 1); - LASSERT(DISP_LOOKUP_EXECD == 2); - LASSERT(DISP_LOOKUP_NEG == 4); - LASSERT(DISP_LOOKUP_POS == 8); - LASSERT(DISP_OPEN_CREATE == 16); - LASSERT(DISP_OPEN_OPEN == 32); - LASSERT(MDS_STATUS_CONN == 1); - LASSERT(MDS_STATUS_LOV == 2); - LASSERT(MDS_OPEN_HAS_EA == 1073741824); - LASSERT(LDLM_ENQUEUE == 101); - LASSERT(LDLM_CONVERT == 102); - LASSERT(LDLM_CANCEL == 103); - LASSERT(LDLM_BL_CALLBACK == 104); - LASSERT(LDLM_CP_CALLBACK == 105); - LASSERT(LDLM_LAST_OPC == 107); - LASSERT(LCK_EX == 1); - LASSERT(LCK_PW == 2); - LASSERT(LCK_PR == 3); - LASSERT(LCK_CW == 4); - LASSERT(LCK_CR == 5); - LASSERT(LCK_NL == 6); - LASSERT(PTLBD_QUERY == 200); - LASSERT(PTLBD_READ == 201); - LASSERT(PTLBD_WRITE == 202); - LASSERT(PTLBD_FLUSH == 203); - LASSERT(PTLBD_CONNECT == 204); - LASSERT(PTLBD_DISCONNECT == 205); - LASSERT(PTLBD_LAST_OPC == 206); - LASSERT(MGMT_CONNECT == 250); - LASSERT(MGMT_DISCONNECT == 251); - LASSERT(MGMT_EXCEPTION == 252); - LASSERT(OBD_PING == 400); - LASSERT(OBD_LOG_CANCEL == 401); - LASSERT(OBD_LAST_OPC == 402); + LASSERTF(PTLRPC_MSG_MAGIC == 0x0BD00BD0," found %lld\n", + (long long)PTLRPC_MSG_MAGIC); + LASSERTF(PTLRPC_MSG_VERSION == 0x00000003," found %lld\n", + (long long)PTLRPC_MSG_VERSION); + LASSERTF(PTL_RPC_MSG_REQUEST == 4711, " found %lld\n", + (long long)PTL_RPC_MSG_REQUEST); + LASSERTF(PTL_RPC_MSG_ERR == 4712, " found %lld\n", + (long long)PTL_RPC_MSG_ERR); + LASSERTF(PTL_RPC_MSG_REPLY == 4713, " found %lld\n", + (long long)PTL_RPC_MSG_REPLY); + LASSERTF(MSG_LAST_REPLAY == 1, " found %lld\n", + (long long)MSG_LAST_REPLAY); + LASSERTF(MSG_RESENT == 2, " found %lld\n", + (long long)MSG_RESENT); + LASSERTF(MSG_REPLAY == 4, " found %lld\n", + (long long)MSG_REPLAY); + LASSERTF(MSG_CONNECT_RECOVERING == 1, " found %lld\n", + (long long)MSG_CONNECT_RECOVERING); + LASSERTF(MSG_CONNECT_RECONNECT == 2, " found %lld\n", + (long long)MSG_CONNECT_RECONNECT); + LASSERTF(MSG_CONNECT_REPLAYABLE == 4, " found %lld\n", + (long long)MSG_CONNECT_REPLAYABLE); + LASSERTF(OST_REPLY == 0, " found %lld\n", + (long long)OST_REPLY); + LASSERTF(OST_GETATTR == 1, " found %lld\n", + (long long)OST_GETATTR); + LASSERTF(OST_SETATTR == 2, " found %lld\n", + (long long)OST_SETATTR); + LASSERTF(OST_READ == 3, " found %lld\n", + (long long)OST_READ); + LASSERTF(OST_WRITE == 4, " found %lld\n", + (long long)OST_WRITE); + LASSERTF(OST_CREATE == 5, " found %lld\n", + (long long)OST_CREATE); + LASSERTF(OST_DESTROY == 6, " found %lld\n", + (long long)OST_DESTROY); + LASSERTF(OST_GET_INFO == 7, " found %lld\n", + (long long)OST_GET_INFO); + LASSERTF(OST_CONNECT == 8, " found %lld\n", + (long long)OST_CONNECT); + LASSERTF(OST_DISCONNECT == 9, " found %lld\n", + (long long)OST_DISCONNECT); + LASSERTF(OST_PUNCH == 10, " found %lld\n", + (long long)OST_PUNCH); + LASSERTF(OST_OPEN == 11, " found %lld\n", + (long long)OST_OPEN); + LASSERTF(OST_CLOSE == 12, " found %lld\n", + (long long)OST_CLOSE); + LASSERTF(OST_STATFS == 13, " found %lld\n", + (long long)OST_STATFS); + LASSERTF(OST_SAN_READ == 14, " found %lld\n", + (long long)OST_SAN_READ); + LASSERTF(OST_SAN_WRITE == 15, " found %lld\n", + (long long)OST_SAN_WRITE); + LASSERTF(OST_SYNC == 16, " found %lld\n", + (long long)OST_SYNC); + LASSERTF(OST_LAST_OPC == 18, " found %lld\n", + (long long)OST_LAST_OPC); + LASSERTF(OBD_OBJECT_EOF == 0xffffffffffffffffULL," found %lld\n", + (long long)OBD_OBJECT_EOF); + LASSERTF(OST_REQ_HAS_OA1 == 1, " found %lld\n", + (long long)OST_REQ_HAS_OA1); + LASSERTF(MDS_GETATTR == 33, " found %lld\n", + (long long)MDS_GETATTR); + LASSERTF(MDS_GETATTR_NAME == 34, " found %lld\n", + (long long)MDS_GETATTR_NAME); + LASSERTF(MDS_CLOSE == 35, " found %lld\n", + (long long)MDS_CLOSE); + LASSERTF(MDS_REINT == 36, " found %lld\n", + (long long)MDS_REINT); + LASSERTF(MDS_READPAGE == 37, " found %lld\n", + (long long)MDS_READPAGE); + LASSERTF(MDS_CONNECT == 38, " found %lld\n", + (long long)MDS_CONNECT); + LASSERTF(MDS_DISCONNECT == 39, " found %lld\n", + (long long)MDS_DISCONNECT); + LASSERTF(MDS_GETSTATUS == 40, " found %lld\n", + (long long)MDS_GETSTATUS); + LASSERTF(MDS_STATFS == 41, " found %lld\n", + (long long)MDS_STATFS); + LASSERTF(MDS_PIN == 42, " found %lld\n", + (long long)MDS_PIN); + LASSERTF(MDS_UNPIN == 43, " found %lld\n", + (long long)MDS_UNPIN); + LASSERTF(MDS_SYNC == 44, " found %lld\n", + (long long)MDS_SYNC); + LASSERTF(MDS_DONE_WRITING == 45, " found %lld\n", + (long long)MDS_DONE_WRITING); + LASSERTF(MDS_LAST_OPC == 46, " found %lld\n", + (long long)MDS_LAST_OPC); + LASSERTF(REINT_SETATTR == 1, " found %lld\n", + (long long)REINT_SETATTR); + LASSERTF(REINT_CREATE == 2, " found %lld\n", + (long long)REINT_CREATE); + LASSERTF(REINT_LINK == 3, " found %lld\n", + (long long)REINT_LINK); + LASSERTF(REINT_UNLINK == 4, " found %lld\n", + (long long)REINT_UNLINK); + LASSERTF(REINT_RENAME == 5, " found %lld\n", + (long long)REINT_RENAME); + LASSERTF(REINT_OPEN == 6, " found %lld\n", + (long long)REINT_OPEN); + LASSERTF(REINT_MAX == 6, " found %lld\n", + (long long)REINT_MAX); + LASSERTF(DISP_IT_EXECD == 1, " found %lld\n", + (long long)DISP_IT_EXECD); + LASSERTF(DISP_LOOKUP_EXECD == 2, " found %lld\n", + (long long)DISP_LOOKUP_EXECD); + LASSERTF(DISP_LOOKUP_NEG == 4, " found %lld\n", + (long long)DISP_LOOKUP_NEG); + LASSERTF(DISP_LOOKUP_POS == 8, " found %lld\n", + (long long)DISP_LOOKUP_POS); + LASSERTF(DISP_OPEN_CREATE == 16, " found %lld\n", + (long long)DISP_OPEN_CREATE); + LASSERTF(DISP_OPEN_OPEN == 32, " found %lld\n", + (long long)DISP_OPEN_OPEN); + LASSERTF(MDS_STATUS_CONN == 1, " found %lld\n", + (long long)MDS_STATUS_CONN); + LASSERTF(MDS_STATUS_LOV == 2, " found %lld\n", + (long long)MDS_STATUS_LOV); + LASSERTF(MDS_OPEN_HAS_EA == 1073741824, " found %lld\n", + (long long)MDS_OPEN_HAS_EA); + LASSERTF(LDLM_ENQUEUE == 101, " found %lld\n", + (long long)LDLM_ENQUEUE); + LASSERTF(LDLM_CONVERT == 102, " found %lld\n", + (long long)LDLM_CONVERT); + LASSERTF(LDLM_CANCEL == 103, " found %lld\n", + (long long)LDLM_CANCEL); + LASSERTF(LDLM_BL_CALLBACK == 104, " found %lld\n", + (long long)LDLM_BL_CALLBACK); + LASSERTF(LDLM_CP_CALLBACK == 105, " found %lld\n", + (long long)LDLM_CP_CALLBACK); + LASSERTF(LDLM_LAST_OPC == 107, " found %lld\n", + (long long)LDLM_LAST_OPC); + LASSERTF(LCK_EX == 1, " found %lld\n", + (long long)LCK_EX); + LASSERTF(LCK_PW == 2, " found %lld\n", + (long long)LCK_PW); + LASSERTF(LCK_PR == 4, " found %lld\n", + (long long)LCK_PR); + LASSERTF(LCK_CW == 8, " found %lld\n", + (long long)LCK_CW); + LASSERTF(LCK_CR == 16, " found %lld\n", + (long long)LCK_CR); + LASSERTF(LCK_NL == 32, " found %lld\n", + (long long)LCK_NL); + LASSERTF(PTLBD_QUERY == 200, " found %lld\n", + (long long)PTLBD_QUERY); + LASSERTF(PTLBD_READ == 201, " found %lld\n", + (long long)PTLBD_READ); + LASSERTF(PTLBD_WRITE == 202, " found %lld\n", + (long long)PTLBD_WRITE); + LASSERTF(PTLBD_FLUSH == 203, " found %lld\n", + (long long)PTLBD_FLUSH); + LASSERTF(PTLBD_CONNECT == 204, " found %lld\n", + (long long)PTLBD_CONNECT); + LASSERTF(PTLBD_DISCONNECT == 205, " found %lld\n", + (long long)PTLBD_DISCONNECT); + LASSERTF(PTLBD_LAST_OPC == 206, " found %lld\n", + (long long)PTLBD_LAST_OPC); + LASSERTF(MGMT_CONNECT == 250, " found %lld\n", + (long long)MGMT_CONNECT); + LASSERTF(MGMT_DISCONNECT == 251, " found %lld\n", + (long long)MGMT_DISCONNECT); + LASSERTF(MGMT_EXCEPTION == 252, " found %lld\n", + (long long)MGMT_EXCEPTION); + LASSERTF(OBD_PING == 400, " found %lld\n", + (long long)OBD_PING); + LASSERTF(OBD_LOG_CANCEL == 401, " found %lld\n", + (long long)OBD_LOG_CANCEL); + LASSERTF(OBD_LAST_OPC == 402, " found %lld\n", + (long long)OBD_LAST_OPC); /* Sizes and Offsets */ /* Checks for struct lustre_handle */ - LASSERT((int)sizeof(struct lustre_handle) == 8); - LASSERT(offsetof(struct lustre_handle, cookie) == 0); - LASSERT((int)sizeof(((struct lustre_handle *)0)->cookie) == 8); + LASSERTF((int)sizeof(struct lustre_handle) == 8, " found %lld\n", + (long long)(int)sizeof(struct lustre_handle)); + LASSERTF(offsetof(struct lustre_handle, cookie) == 0, " found %lld\n", + (long long)offsetof(struct lustre_handle, cookie)); + LASSERTF((int)sizeof(((struct lustre_handle *)0)->cookie) == 8, " found %lld\n", + (long long)(int)sizeof(((struct lustre_handle *)0)->cookie)); /* Checks for struct lustre_msg */ - LASSERT((int)sizeof(struct lustre_msg) == 64); - LASSERT(offsetof(struct lustre_msg, handle) == 0); - LASSERT((int)sizeof(((struct lustre_msg *)0)->handle) == 8); - LASSERT(offsetof(struct lustre_msg, magic) == 8); - LASSERT((int)sizeof(((struct lustre_msg *)0)->magic) == 4); - LASSERT(offsetof(struct lustre_msg, type) == 12); - LASSERT((int)sizeof(((struct lustre_msg *)0)->type) == 4); - LASSERT(offsetof(struct lustre_msg, version) == 16); - LASSERT((int)sizeof(((struct lustre_msg *)0)->version) == 4); - LASSERT(offsetof(struct lustre_msg, opc) == 20); - LASSERT((int)sizeof(((struct lustre_msg *)0)->opc) == 4); - LASSERT(offsetof(struct lustre_msg, last_xid) == 24); - LASSERT((int)sizeof(((struct lustre_msg *)0)->last_xid) == 8); - LASSERT(offsetof(struct lustre_msg, last_committed) == 32); - LASSERT((int)sizeof(((struct lustre_msg *)0)->last_committed) == 8); - LASSERT(offsetof(struct lustre_msg, transno) == 40); - LASSERT((int)sizeof(((struct lustre_msg *)0)->transno) == 8); - LASSERT(offsetof(struct lustre_msg, status) == 48); - LASSERT((int)sizeof(((struct lustre_msg *)0)->status) == 4); - LASSERT(offsetof(struct lustre_msg, flags) == 52); - LASSERT((int)sizeof(((struct lustre_msg *)0)->flags) == 4); - LASSERT(offsetof(struct lustre_msg, bufcount) == 60); - LASSERT((int)sizeof(((struct lustre_msg *)0)->bufcount) == 4); - LASSERT(offsetof(struct lustre_msg, buflens[7]) == 92); - LASSERT((int)sizeof(((struct lustre_msg *)0)->buflens[7]) == 4); + LASSERTF((int)sizeof(struct lustre_msg) == 64, " found %lld\n", + (long long)(int)sizeof(struct lustre_msg)); + LASSERTF(offsetof(struct lustre_msg, handle) == 0, " found %lld\n", + (long long)offsetof(struct lustre_msg, handle)); + LASSERTF((int)sizeof(((struct lustre_msg *)0)->handle) == 8, " found %lld\n", + (long long)(int)sizeof(((struct lustre_msg *)0)->handle)); + LASSERTF(offsetof(struct lustre_msg, magic) == 8, " found %lld\n", + (long long)offsetof(struct lustre_msg, magic)); + LASSERTF((int)sizeof(((struct lustre_msg *)0)->magic) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lustre_msg *)0)->magic)); + LASSERTF(offsetof(struct lustre_msg, type) == 12, " found %lld\n", + (long long)offsetof(struct lustre_msg, type)); + LASSERTF((int)sizeof(((struct lustre_msg *)0)->type) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lustre_msg *)0)->type)); + LASSERTF(offsetof(struct lustre_msg, version) == 16, " found %lld\n", + (long long)offsetof(struct lustre_msg, version)); + LASSERTF((int)sizeof(((struct lustre_msg *)0)->version) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lustre_msg *)0)->version)); + LASSERTF(offsetof(struct lustre_msg, opc) == 20, " found %lld\n", + (long long)offsetof(struct lustre_msg, opc)); + LASSERTF((int)sizeof(((struct lustre_msg *)0)->opc) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lustre_msg *)0)->opc)); + LASSERTF(offsetof(struct lustre_msg, last_xid) == 24, " found %lld\n", + (long long)offsetof(struct lustre_msg, last_xid)); + LASSERTF((int)sizeof(((struct lustre_msg *)0)->last_xid) == 8, " found %lld\n", + (long long)(int)sizeof(((struct lustre_msg *)0)->last_xid)); + LASSERTF(offsetof(struct lustre_msg, last_committed) == 32, " found %lld\n", + (long long)offsetof(struct lustre_msg, last_committed)); + LASSERTF((int)sizeof(((struct lustre_msg *)0)->last_committed) == 8, " found %lld\n", + (long long)(int)sizeof(((struct lustre_msg *)0)->last_committed)); + LASSERTF(offsetof(struct lustre_msg, transno) == 40, " found %lld\n", + (long long)offsetof(struct lustre_msg, transno)); + LASSERTF((int)sizeof(((struct lustre_msg *)0)->transno) == 8, " found %lld\n", + (long long)(int)sizeof(((struct lustre_msg *)0)->transno)); + LASSERTF(offsetof(struct lustre_msg, status) == 48, " found %lld\n", + (long long)offsetof(struct lustre_msg, status)); + LASSERTF((int)sizeof(((struct lustre_msg *)0)->status) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lustre_msg *)0)->status)); + LASSERTF(offsetof(struct lustre_msg, flags) == 52, " found %lld\n", + (long long)offsetof(struct lustre_msg, flags)); + LASSERTF((int)sizeof(((struct lustre_msg *)0)->flags) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lustre_msg *)0)->flags)); + LASSERTF(offsetof(struct lustre_msg, bufcount) == 60, " found %lld\n", + (long long)offsetof(struct lustre_msg, bufcount)); + LASSERTF((int)sizeof(((struct lustre_msg *)0)->bufcount) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lustre_msg *)0)->bufcount)); + LASSERTF(offsetof(struct lustre_msg, buflens[7]) == 92, " found %lld\n", + (long long)offsetof(struct lustre_msg, buflens[7])); + LASSERTF((int)sizeof(((struct lustre_msg *)0)->buflens[7]) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lustre_msg *)0)->buflens[7])); /* Checks for struct obdo */ - LASSERT((int)sizeof(struct obdo) == 168); - LASSERT(offsetof(struct obdo, o_id) == 0); - LASSERT((int)sizeof(((struct obdo *)0)->o_id) == 8); - LASSERT(offsetof(struct obdo, o_gr) == 8); - LASSERT((int)sizeof(((struct obdo *)0)->o_gr) == 8); - LASSERT(offsetof(struct obdo, o_atime) == 16); - LASSERT((int)sizeof(((struct obdo *)0)->o_atime) == 8); - LASSERT(offsetof(struct obdo, o_mtime) == 24); - LASSERT((int)sizeof(((struct obdo *)0)->o_mtime) == 8); - LASSERT(offsetof(struct obdo, o_ctime) == 32); - LASSERT((int)sizeof(((struct obdo *)0)->o_ctime) == 8); - LASSERT(offsetof(struct obdo, o_size) == 40); - LASSERT((int)sizeof(((struct obdo *)0)->o_size) == 8); - LASSERT(offsetof(struct obdo, o_blocks) == 48); - LASSERT((int)sizeof(((struct obdo *)0)->o_blocks) == 8); - LASSERT(offsetof(struct obdo, o_grant) == 56); - LASSERT((int)sizeof(((struct obdo *)0)->o_grant) == 8); - LASSERT(offsetof(struct obdo, o_blksize) == 64); - LASSERT((int)sizeof(((struct obdo *)0)->o_blksize) == 4); - LASSERT(offsetof(struct obdo, o_mode) == 68); - LASSERT((int)sizeof(((struct obdo *)0)->o_mode) == 4); - LASSERT(offsetof(struct obdo, o_uid) == 72); - LASSERT((int)sizeof(((struct obdo *)0)->o_uid) == 4); - LASSERT(offsetof(struct obdo, o_gid) == 76); - LASSERT((int)sizeof(((struct obdo *)0)->o_gid) == 4); - LASSERT(offsetof(struct obdo, o_flags) == 80); - LASSERT((int)sizeof(((struct obdo *)0)->o_flags) == 4); - LASSERT(offsetof(struct obdo, o_nlink) == 84); - LASSERT((int)sizeof(((struct obdo *)0)->o_nlink) == 4); - LASSERT(offsetof(struct obdo, o_generation) == 88); - LASSERT((int)sizeof(((struct obdo *)0)->o_generation) == 4); - LASSERT(offsetof(struct obdo, o_valid) == 92); - LASSERT((int)sizeof(((struct obdo *)0)->o_valid) == 4); - LASSERT(offsetof(struct obdo, o_misc) == 96); - LASSERT((int)sizeof(((struct obdo *)0)->o_misc) == 4); - LASSERT(offsetof(struct obdo, o_easize) == 100); - LASSERT((int)sizeof(((struct obdo *)0)->o_easize) == 4); - LASSERT(offsetof(struct obdo, o_inline) == 104); - LASSERT((int)sizeof(((struct obdo *)0)->o_inline) == 64); - LASSERT(OBD_MD_FLID == 1); - LASSERT(OBD_MD_FLATIME == 2); - LASSERT(OBD_MD_FLMTIME == 4); - LASSERT(OBD_MD_FLCTIME == 8); - LASSERT(OBD_MD_FLSIZE == 16); - LASSERT(OBD_MD_FLBLOCKS == 32); - LASSERT(OBD_MD_FLBLKSZ == 64); - LASSERT(OBD_MD_FLMODE == 128); - LASSERT(OBD_MD_FLTYPE == 256); - LASSERT(OBD_MD_FLUID == 512); - LASSERT(OBD_MD_FLGID == 1024); - LASSERT(OBD_MD_FLFLAGS == 2048); - LASSERT(OBD_MD_FLNLINK == 8192); - LASSERT(OBD_MD_FLGENER == 16384); - LASSERT(OBD_MD_FLINLINE == 32768); - LASSERT(OBD_MD_FLRDEV == 65536); - LASSERT(OBD_MD_FLEASIZE == 131072); - LASSERT(OBD_MD_LINKNAME == 262144); - LASSERT(OBD_MD_FLHANDLE == 524288); - LASSERT(OBD_MD_FLCKSUM == 1048576); - LASSERT(OBD_MD_FLQOS == 2097152); - LASSERT(OBD_MD_FLOSCOPQ == 4194304); - LASSERT(OBD_MD_FLCOOKIE == 8388608); - LASSERT(OBD_MD_FLGROUP == 16777216); - LASSERT(OBD_FL_INLINEDATA == 1); - LASSERT(OBD_FL_OBDMDEXISTS == 2); - LASSERT(OBD_FL_DELORPHAN == 4); - LASSERT(OBD_FL_NORPC == 8); - LASSERT(OBD_FL_IDONLY == 16); - LASSERT(OBD_FL_RECREATE_OBJS == 32); + LASSERTF((int)sizeof(struct obdo) == 168, " found %lld\n", + (long long)(int)sizeof(struct obdo)); + LASSERTF(offsetof(struct obdo, o_id) == 0, " found %lld\n", + (long long)offsetof(struct obdo, o_id)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_id) == 8, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_id)); + LASSERTF(offsetof(struct obdo, o_gr) == 8, " found %lld\n", + (long long)offsetof(struct obdo, o_gr)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_gr) == 8, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_gr)); + LASSERTF(offsetof(struct obdo, o_atime) == 16, " found %lld\n", + (long long)offsetof(struct obdo, o_atime)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_atime) == 8, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_atime)); + LASSERTF(offsetof(struct obdo, o_mtime) == 24, " found %lld\n", + (long long)offsetof(struct obdo, o_mtime)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_mtime) == 8, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_mtime)); + LASSERTF(offsetof(struct obdo, o_ctime) == 32, " found %lld\n", + (long long)offsetof(struct obdo, o_ctime)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_ctime) == 8, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_ctime)); + LASSERTF(offsetof(struct obdo, o_size) == 40, " found %lld\n", + (long long)offsetof(struct obdo, o_size)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_size) == 8, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_size)); + LASSERTF(offsetof(struct obdo, o_blocks) == 48, " found %lld\n", + (long long)offsetof(struct obdo, o_blocks)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_blocks) == 8, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_blocks)); + LASSERTF(offsetof(struct obdo, o_grant) == 56, " found %lld\n", + (long long)offsetof(struct obdo, o_grant)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_grant) == 8, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_grant)); + LASSERTF(offsetof(struct obdo, o_blksize) == 64, " found %lld\n", + (long long)offsetof(struct obdo, o_blksize)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_blksize) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_blksize)); + LASSERTF(offsetof(struct obdo, o_mode) == 68, " found %lld\n", + (long long)offsetof(struct obdo, o_mode)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_mode) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_mode)); + LASSERTF(offsetof(struct obdo, o_uid) == 72, " found %lld\n", + (long long)offsetof(struct obdo, o_uid)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_uid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_uid)); + LASSERTF(offsetof(struct obdo, o_gid) == 76, " found %lld\n", + (long long)offsetof(struct obdo, o_gid)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_gid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_gid)); + LASSERTF(offsetof(struct obdo, o_flags) == 80, " found %lld\n", + (long long)offsetof(struct obdo, o_flags)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_flags) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_flags)); + LASSERTF(offsetof(struct obdo, o_nlink) == 84, " found %lld\n", + (long long)offsetof(struct obdo, o_nlink)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_nlink) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_nlink)); + LASSERTF(offsetof(struct obdo, o_generation) == 88, " found %lld\n", + (long long)offsetof(struct obdo, o_generation)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_generation) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_generation)); + LASSERTF(offsetof(struct obdo, o_valid) == 92, " found %lld\n", + (long long)offsetof(struct obdo, o_valid)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_valid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_valid)); + LASSERTF(offsetof(struct obdo, o_misc) == 96, " found %lld\n", + (long long)offsetof(struct obdo, o_misc)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_misc) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_misc)); + LASSERTF(offsetof(struct obdo, o_easize) == 100, " found %lld\n", + (long long)offsetof(struct obdo, o_easize)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_easize) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_easize)); + LASSERTF(offsetof(struct obdo, o_inline) == 104, " found %lld\n", + (long long)offsetof(struct obdo, o_inline)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_inline) == 64, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_inline)); + LASSERTF(OBD_MD_FLID == 1, " found %lld\n", + (long long)OBD_MD_FLID); + LASSERTF(OBD_MD_FLATIME == 2, " found %lld\n", + (long long)OBD_MD_FLATIME); + LASSERTF(OBD_MD_FLMTIME == 4, " found %lld\n", + (long long)OBD_MD_FLMTIME); + LASSERTF(OBD_MD_FLCTIME == 8, " found %lld\n", + (long long)OBD_MD_FLCTIME); + LASSERTF(OBD_MD_FLSIZE == 16, " found %lld\n", + (long long)OBD_MD_FLSIZE); + LASSERTF(OBD_MD_FLBLOCKS == 32, " found %lld\n", + (long long)OBD_MD_FLBLOCKS); + LASSERTF(OBD_MD_FLBLKSZ == 64, " found %lld\n", + (long long)OBD_MD_FLBLKSZ); + LASSERTF(OBD_MD_FLMODE == 128, " found %lld\n", + (long long)OBD_MD_FLMODE); + LASSERTF(OBD_MD_FLTYPE == 256, " found %lld\n", + (long long)OBD_MD_FLTYPE); + LASSERTF(OBD_MD_FLUID == 512, " found %lld\n", + (long long)OBD_MD_FLUID); + LASSERTF(OBD_MD_FLGID == 1024, " found %lld\n", + (long long)OBD_MD_FLGID); + LASSERTF(OBD_MD_FLFLAGS == 2048, " found %lld\n", + (long long)OBD_MD_FLFLAGS); + LASSERTF(OBD_MD_FLNLINK == 8192, " found %lld\n", + (long long)OBD_MD_FLNLINK); + LASSERTF(OBD_MD_FLGENER == 16384, " found %lld\n", + (long long)OBD_MD_FLGENER); + LASSERTF(OBD_MD_FLINLINE == 32768, " found %lld\n", + (long long)OBD_MD_FLINLINE); + LASSERTF(OBD_MD_FLRDEV == 65536, " found %lld\n", + (long long)OBD_MD_FLRDEV); + LASSERTF(OBD_MD_FLEASIZE == 131072, " found %lld\n", + (long long)OBD_MD_FLEASIZE); + LASSERTF(OBD_MD_LINKNAME == 262144, " found %lld\n", + (long long)OBD_MD_LINKNAME); + LASSERTF(OBD_MD_FLHANDLE == 524288, " found %lld\n", + (long long)OBD_MD_FLHANDLE); + LASSERTF(OBD_MD_FLCKSUM == 1048576, " found %lld\n", + (long long)OBD_MD_FLCKSUM); + LASSERTF(OBD_MD_FLQOS == 2097152, " found %lld\n", + (long long)OBD_MD_FLQOS); + LASSERTF(OBD_MD_FLOSCOPQ == 4194304, " found %lld\n", + (long long)OBD_MD_FLOSCOPQ); + LASSERTF(OBD_MD_FLCOOKIE == 8388608, " found %lld\n", + (long long)OBD_MD_FLCOOKIE); + LASSERTF(OBD_MD_FLGROUP == 16777216, " found %lld\n", + (long long)OBD_MD_FLGROUP); + LASSERTF(OBD_FL_INLINEDATA == 1, " found %lld\n", + (long long)OBD_FL_INLINEDATA); + LASSERTF(OBD_FL_OBDMDEXISTS == 2, " found %lld\n", + (long long)OBD_FL_OBDMDEXISTS); + LASSERTF(OBD_FL_DELORPHAN == 4, " found %lld\n", + (long long)OBD_FL_DELORPHAN); + LASSERTF(OBD_FL_NORPC == 8, " found %lld\n", + (long long)OBD_FL_NORPC); + LASSERTF(OBD_FL_IDONLY == 16, " found %lld\n", + (long long)OBD_FL_IDONLY); + LASSERTF(OBD_FL_RECREATE_OBJS == 32, " found %lld\n", + (long long)OBD_FL_RECREATE_OBJS); /* Checks for struct lov_mds_md_v1 */ - LASSERT((int)sizeof(struct lov_mds_md_v1) == 32); - LASSERT(offsetof(struct lov_mds_md_v1, lmm_magic) == 0); - LASSERT((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_magic) == 4); - LASSERT(offsetof(struct lov_mds_md_v1, lmm_pattern) == 4); - LASSERT((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_pattern) == 4); - LASSERT(offsetof(struct lov_mds_md_v1, lmm_object_id) == 8); - LASSERT((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_object_id) == 8); - LASSERT(offsetof(struct lov_mds_md_v1, lmm_object_gr) == 16); - LASSERT((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_object_gr) == 8); - LASSERT(offsetof(struct lov_mds_md_v1, lmm_stripe_size) == 24); - LASSERT((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_stripe_size) == 4); - LASSERT(offsetof(struct lov_mds_md_v1, lmm_stripe_count) == 28); - LASSERT((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_stripe_count) == 4); - LASSERT(offsetof(struct lov_mds_md_v1, lmm_objects) == 32); - LASSERT((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_objects) == 0); + LASSERTF((int)sizeof(struct lov_mds_md_v1) == 32, " found %lld\n", + (long long)(int)sizeof(struct lov_mds_md_v1)); + LASSERTF(offsetof(struct lov_mds_md_v1, lmm_magic) == 0, " found %lld\n", + (long long)offsetof(struct lov_mds_md_v1, lmm_magic)); + LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_magic) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_magic)); + LASSERTF(offsetof(struct lov_mds_md_v1, lmm_pattern) == 4, " found %lld\n", + (long long)offsetof(struct lov_mds_md_v1, lmm_pattern)); + LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_pattern) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_pattern)); + LASSERTF(offsetof(struct lov_mds_md_v1, lmm_object_id) == 8, " found %lld\n", + (long long)offsetof(struct lov_mds_md_v1, lmm_object_id)); + LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_object_id) == 8, " found %lld\n", + (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_object_id)); + LASSERTF(offsetof(struct lov_mds_md_v1, lmm_object_gr) == 16, " found %lld\n", + (long long)offsetof(struct lov_mds_md_v1, lmm_object_gr)); + LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_object_gr) == 8, " found %lld\n", + (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_object_gr)); + LASSERTF(offsetof(struct lov_mds_md_v1, lmm_stripe_size) == 24, " found %lld\n", + (long long)offsetof(struct lov_mds_md_v1, lmm_stripe_size)); + LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_stripe_size) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_stripe_size)); + LASSERTF(offsetof(struct lov_mds_md_v1, lmm_stripe_count) == 28, " found %lld\n", + (long long)offsetof(struct lov_mds_md_v1, lmm_stripe_count)); + LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_stripe_count) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_stripe_count)); + LASSERTF(offsetof(struct lov_mds_md_v1, lmm_objects) == 32, " found %lld\n", + (long long)offsetof(struct lov_mds_md_v1, lmm_objects)); + LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_objects) == 0, " found %lld\n", + (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_objects)); /* Checks for struct lov_ost_data_v1 */ - LASSERT((int)sizeof(struct lov_ost_data_v1) == 24); - LASSERT(offsetof(struct lov_ost_data_v1, l_object_id) == 0); - LASSERT((int)sizeof(((struct lov_ost_data_v1 *)0)->l_object_id) == 8); - LASSERT(offsetof(struct lov_ost_data_v1, l_object_gr) == 8); - LASSERT((int)sizeof(((struct lov_ost_data_v1 *)0)->l_object_gr) == 8); - LASSERT(offsetof(struct lov_ost_data_v1, l_ost_gen) == 16); - LASSERT((int)sizeof(((struct lov_ost_data_v1 *)0)->l_ost_gen) == 4); - LASSERT(offsetof(struct lov_ost_data_v1, l_ost_idx) == 20); - LASSERT((int)sizeof(((struct lov_ost_data_v1 *)0)->l_ost_idx) == 4); - LASSERT(LOV_MAGIC_V0 == 198183888); - LASSERT(LOV_MAGIC_V1 == 198249424); - LASSERT(LOV_PATTERN_RAID0 == 1); - LASSERT(LOV_PATTERN_RAID1 == 2); + LASSERTF((int)sizeof(struct lov_ost_data_v1) == 24, " found %lld\n", + (long long)(int)sizeof(struct lov_ost_data_v1)); + LASSERTF(offsetof(struct lov_ost_data_v1, l_object_id) == 0, " found %lld\n", + (long long)offsetof(struct lov_ost_data_v1, l_object_id)); + LASSERTF((int)sizeof(((struct lov_ost_data_v1 *)0)->l_object_id) == 8, " found %lld\n", + (long long)(int)sizeof(((struct lov_ost_data_v1 *)0)->l_object_id)); + LASSERTF(offsetof(struct lov_ost_data_v1, l_object_gr) == 8, " found %lld\n", + (long long)offsetof(struct lov_ost_data_v1, l_object_gr)); + LASSERTF((int)sizeof(((struct lov_ost_data_v1 *)0)->l_object_gr) == 8, " found %lld\n", + (long long)(int)sizeof(((struct lov_ost_data_v1 *)0)->l_object_gr)); + LASSERTF(offsetof(struct lov_ost_data_v1, l_ost_gen) == 16, " found %lld\n", + (long long)offsetof(struct lov_ost_data_v1, l_ost_gen)); + LASSERTF((int)sizeof(((struct lov_ost_data_v1 *)0)->l_ost_gen) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lov_ost_data_v1 *)0)->l_ost_gen)); + LASSERTF(offsetof(struct lov_ost_data_v1, l_ost_idx) == 20, " found %lld\n", + (long long)offsetof(struct lov_ost_data_v1, l_ost_idx)); + LASSERTF((int)sizeof(((struct lov_ost_data_v1 *)0)->l_ost_idx) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lov_ost_data_v1 *)0)->l_ost_idx)); + LASSERTF(LOV_MAGIC_V0 == 198183888, " found %lld\n", + (long long)LOV_MAGIC_V0); + LASSERTF(LOV_MAGIC_V1 == 198249424, " found %lld\n", + (long long)LOV_MAGIC_V1); + LASSERTF(LOV_PATTERN_RAID0 == 1, " found %lld\n", + (long long)LOV_PATTERN_RAID0); + LASSERTF(LOV_PATTERN_RAID1 == 2, " found %lld\n", + (long long)LOV_PATTERN_RAID1); /* Checks for struct obd_statfs */ - LASSERT((int)sizeof(struct obd_statfs) == 144); - LASSERT(offsetof(struct obd_statfs, os_type) == 0); - LASSERT((int)sizeof(((struct obd_statfs *)0)->os_type) == 8); - LASSERT(offsetof(struct obd_statfs, os_blocks) == 8); - LASSERT((int)sizeof(((struct obd_statfs *)0)->os_blocks) == 8); - LASSERT(offsetof(struct obd_statfs, os_bfree) == 16); - LASSERT((int)sizeof(((struct obd_statfs *)0)->os_bfree) == 8); - LASSERT(offsetof(struct obd_statfs, os_bavail) == 24); - LASSERT((int)sizeof(((struct obd_statfs *)0)->os_bavail) == 8); - LASSERT(offsetof(struct obd_statfs, os_ffree) == 40); - LASSERT((int)sizeof(((struct obd_statfs *)0)->os_ffree) == 8); - LASSERT(offsetof(struct obd_statfs, os_fsid) == 48); - LASSERT((int)sizeof(((struct obd_statfs *)0)->os_fsid) == 40); - LASSERT(offsetof(struct obd_statfs, os_bsize) == 88); - LASSERT((int)sizeof(((struct obd_statfs *)0)->os_bsize) == 4); - LASSERT(offsetof(struct obd_statfs, os_namelen) == 92); - LASSERT((int)sizeof(((struct obd_statfs *)0)->os_namelen) == 4); - LASSERT(offsetof(struct obd_statfs, os_spare) == 104); - LASSERT((int)sizeof(((struct obd_statfs *)0)->os_spare) == 40); + LASSERTF((int)sizeof(struct obd_statfs) == 144, " found %lld\n", + (long long)(int)sizeof(struct obd_statfs)); + LASSERTF(offsetof(struct obd_statfs, os_type) == 0, " found %lld\n", + (long long)offsetof(struct obd_statfs, os_type)); + LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_type) == 8, " found %lld\n", + (long long)(int)sizeof(((struct obd_statfs *)0)->os_type)); + LASSERTF(offsetof(struct obd_statfs, os_blocks) == 8, " found %lld\n", + (long long)offsetof(struct obd_statfs, os_blocks)); + LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_blocks) == 8, " found %lld\n", + (long long)(int)sizeof(((struct obd_statfs *)0)->os_blocks)); + LASSERTF(offsetof(struct obd_statfs, os_bfree) == 16, " found %lld\n", + (long long)offsetof(struct obd_statfs, os_bfree)); + LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_bfree) == 8, " found %lld\n", + (long long)(int)sizeof(((struct obd_statfs *)0)->os_bfree)); + LASSERTF(offsetof(struct obd_statfs, os_bavail) == 24, " found %lld\n", + (long long)offsetof(struct obd_statfs, os_bavail)); + LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_bavail) == 8, " found %lld\n", + (long long)(int)sizeof(((struct obd_statfs *)0)->os_bavail)); + LASSERTF(offsetof(struct obd_statfs, os_ffree) == 40, " found %lld\n", + (long long)offsetof(struct obd_statfs, os_ffree)); + LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_ffree) == 8, " found %lld\n", + (long long)(int)sizeof(((struct obd_statfs *)0)->os_ffree)); + LASSERTF(offsetof(struct obd_statfs, os_fsid) == 48, " found %lld\n", + (long long)offsetof(struct obd_statfs, os_fsid)); + LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_fsid) == 40, " found %lld\n", + (long long)(int)sizeof(((struct obd_statfs *)0)->os_fsid)); + LASSERTF(offsetof(struct obd_statfs, os_bsize) == 88, " found %lld\n", + (long long)offsetof(struct obd_statfs, os_bsize)); + LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_bsize) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obd_statfs *)0)->os_bsize)); + LASSERTF(offsetof(struct obd_statfs, os_namelen) == 92, " found %lld\n", + (long long)offsetof(struct obd_statfs, os_namelen)); + LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_namelen) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obd_statfs *)0)->os_namelen)); + LASSERTF(offsetof(struct obd_statfs, os_spare) == 104, " found %lld\n", + (long long)offsetof(struct obd_statfs, os_spare)); + LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_spare) == 40, " found %lld\n", + (long long)(int)sizeof(((struct obd_statfs *)0)->os_spare)); /* Checks for struct obd_ioobj */ - LASSERT((int)sizeof(struct obd_ioobj) == 24); - LASSERT(offsetof(struct obd_ioobj, ioo_id) == 0); - LASSERT((int)sizeof(((struct obd_ioobj *)0)->ioo_id) == 8); - LASSERT(offsetof(struct obd_ioobj, ioo_gr) == 8); - LASSERT((int)sizeof(((struct obd_ioobj *)0)->ioo_gr) == 8); - LASSERT(offsetof(struct obd_ioobj, ioo_type) == 16); - LASSERT((int)sizeof(((struct obd_ioobj *)0)->ioo_type) == 4); - LASSERT(offsetof(struct obd_ioobj, ioo_bufcnt) == 20); - LASSERT((int)sizeof(((struct obd_ioobj *)0)->ioo_bufcnt) == 4); + LASSERTF((int)sizeof(struct obd_ioobj) == 24, " found %lld\n", + (long long)(int)sizeof(struct obd_ioobj)); + LASSERTF(offsetof(struct obd_ioobj, ioo_id) == 0, " found %lld\n", + (long long)offsetof(struct obd_ioobj, ioo_id)); + LASSERTF((int)sizeof(((struct obd_ioobj *)0)->ioo_id) == 8, " found %lld\n", + (long long)(int)sizeof(((struct obd_ioobj *)0)->ioo_id)); + LASSERTF(offsetof(struct obd_ioobj, ioo_gr) == 8, " found %lld\n", + (long long)offsetof(struct obd_ioobj, ioo_gr)); + LASSERTF((int)sizeof(((struct obd_ioobj *)0)->ioo_gr) == 8, " found %lld\n", + (long long)(int)sizeof(((struct obd_ioobj *)0)->ioo_gr)); + LASSERTF(offsetof(struct obd_ioobj, ioo_type) == 16, " found %lld\n", + (long long)offsetof(struct obd_ioobj, ioo_type)); + LASSERTF((int)sizeof(((struct obd_ioobj *)0)->ioo_type) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obd_ioobj *)0)->ioo_type)); + LASSERTF(offsetof(struct obd_ioobj, ioo_bufcnt) == 20, " found %lld\n", + (long long)offsetof(struct obd_ioobj, ioo_bufcnt)); + LASSERTF((int)sizeof(((struct obd_ioobj *)0)->ioo_bufcnt) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obd_ioobj *)0)->ioo_bufcnt)); /* Checks for struct niobuf_remote */ - LASSERT((int)sizeof(struct niobuf_remote) == 16); - LASSERT(offsetof(struct niobuf_remote, offset) == 0); - LASSERT((int)sizeof(((struct niobuf_remote *)0)->offset) == 8); - LASSERT(offsetof(struct niobuf_remote, len) == 8); - LASSERT((int)sizeof(((struct niobuf_remote *)0)->len) == 4); - LASSERT(offsetof(struct niobuf_remote, flags) == 12); - LASSERT((int)sizeof(((struct niobuf_remote *)0)->flags) == 4); - LASSERT(OBD_BRW_READ == 1); - LASSERT(OBD_BRW_WRITE == 2); - LASSERT(OBD_BRW_SYNC == 8); - LASSERT(OBD_BRW_FROM_GRANT == 32); + LASSERTF((int)sizeof(struct niobuf_remote) == 16, " found %lld\n", + (long long)(int)sizeof(struct niobuf_remote)); + LASSERTF(offsetof(struct niobuf_remote, offset) == 0, " found %lld\n", + (long long)offsetof(struct niobuf_remote, offset)); + LASSERTF((int)sizeof(((struct niobuf_remote *)0)->offset) == 8, " found %lld\n", + (long long)(int)sizeof(((struct niobuf_remote *)0)->offset)); + LASSERTF(offsetof(struct niobuf_remote, len) == 8, " found %lld\n", + (long long)offsetof(struct niobuf_remote, len)); + LASSERTF((int)sizeof(((struct niobuf_remote *)0)->len) == 4, " found %lld\n", + (long long)(int)sizeof(((struct niobuf_remote *)0)->len)); + LASSERTF(offsetof(struct niobuf_remote, flags) == 12, " found %lld\n", + (long long)offsetof(struct niobuf_remote, flags)); + LASSERTF((int)sizeof(((struct niobuf_remote *)0)->flags) == 4, " found %lld\n", + (long long)(int)sizeof(((struct niobuf_remote *)0)->flags)); + LASSERTF(OBD_BRW_READ == 1, " found %lld\n", + (long long)OBD_BRW_READ); + LASSERTF(OBD_BRW_WRITE == 2, " found %lld\n", + (long long)OBD_BRW_WRITE); + LASSERTF(OBD_BRW_SYNC == 8, " found %lld\n", + (long long)OBD_BRW_SYNC); + LASSERTF(OBD_BRW_FROM_GRANT == 32, " found %lld\n", + (long long)OBD_BRW_FROM_GRANT); /* Checks for struct ost_body */ - LASSERT((int)sizeof(struct ost_body) == 168); - LASSERT(offsetof(struct ost_body, oa) == 0); - LASSERT((int)sizeof(((struct ost_body *)0)->oa) == 168); + LASSERTF((int)sizeof(struct ost_body) == 168, " found %lld\n", + (long long)(int)sizeof(struct ost_body)); + LASSERTF(offsetof(struct ost_body, oa) == 0, " found %lld\n", + (long long)offsetof(struct ost_body, oa)); + LASSERTF((int)sizeof(((struct ost_body *)0)->oa) == 168, " found %lld\n", + (long long)(int)sizeof(((struct ost_body *)0)->oa)); /* Checks for struct ll_fid */ - LASSERT((int)sizeof(struct ll_fid) == 16); - LASSERT(offsetof(struct ll_fid, id) == 0); - LASSERT((int)sizeof(((struct ll_fid *)0)->id) == 8); - LASSERT(offsetof(struct ll_fid, generation) == 8); - LASSERT((int)sizeof(((struct ll_fid *)0)->generation) == 4); - LASSERT(offsetof(struct ll_fid, f_type) == 12); - LASSERT((int)sizeof(((struct ll_fid *)0)->f_type) == 4); + LASSERTF((int)sizeof(struct ll_fid) == 16, " found %lld\n", + (long long)(int)sizeof(struct ll_fid)); + LASSERTF(offsetof(struct ll_fid, id) == 0, " found %lld\n", + (long long)offsetof(struct ll_fid, id)); + LASSERTF((int)sizeof(((struct ll_fid *)0)->id) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ll_fid *)0)->id)); + LASSERTF(offsetof(struct ll_fid, generation) == 8, " found %lld\n", + (long long)offsetof(struct ll_fid, generation)); + LASSERTF((int)sizeof(((struct ll_fid *)0)->generation) == 4, " found %lld\n", + (long long)(int)sizeof(((struct ll_fid *)0)->generation)); + LASSERTF(offsetof(struct ll_fid, f_type) == 12, " found %lld\n", + (long long)offsetof(struct ll_fid, f_type)); + LASSERTF((int)sizeof(((struct ll_fid *)0)->f_type) == 4, " found %lld\n", + (long long)(int)sizeof(((struct ll_fid *)0)->f_type)); /* Checks for struct mds_status_req */ - LASSERT((int)sizeof(struct mds_status_req) == 8); - LASSERT(offsetof(struct mds_status_req, flags) == 0); - LASSERT((int)sizeof(((struct mds_status_req *)0)->flags) == 4); - LASSERT(offsetof(struct mds_status_req, repbuf) == 4); - LASSERT((int)sizeof(((struct mds_status_req *)0)->repbuf) == 4); + LASSERTF((int)sizeof(struct mds_status_req) == 8, " found %lld\n", + (long long)(int)sizeof(struct mds_status_req)); + LASSERTF(offsetof(struct mds_status_req, flags) == 0, " found %lld\n", + (long long)offsetof(struct mds_status_req, flags)); + LASSERTF((int)sizeof(((struct mds_status_req *)0)->flags) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_status_req *)0)->flags)); + LASSERTF(offsetof(struct mds_status_req, repbuf) == 4, " found %lld\n", + (long long)offsetof(struct mds_status_req, repbuf)); + LASSERTF((int)sizeof(((struct mds_status_req *)0)->repbuf) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_status_req *)0)->repbuf)); /* Checks for struct mds_body */ - LASSERT((int)sizeof(struct mds_body) == 136); - LASSERT(offsetof(struct mds_body, fid1) == 0); - LASSERT((int)sizeof(((struct mds_body *)0)->fid1) == 16); - LASSERT(offsetof(struct mds_body, fid2) == 16); - LASSERT((int)sizeof(((struct mds_body *)0)->fid2) == 16); - LASSERT(offsetof(struct mds_body, handle) == 32); - LASSERT((int)sizeof(((struct mds_body *)0)->handle) == 8); - LASSERT(offsetof(struct mds_body, size) == 40); - LASSERT((int)sizeof(((struct mds_body *)0)->size) == 8); - LASSERT(offsetof(struct mds_body, blocks) == 48); - LASSERT((int)sizeof(((struct mds_body *)0)->blocks) == 8); - LASSERT(offsetof(struct mds_body, io_epoch) == 56); - LASSERT((int)sizeof(((struct mds_body *)0)->io_epoch) == 8); - LASSERT(offsetof(struct mds_body, ino) == 64); - LASSERT((int)sizeof(((struct mds_body *)0)->ino) == 4); - LASSERT(offsetof(struct mds_body, valid) == 68); - LASSERT((int)sizeof(((struct mds_body *)0)->valid) == 4); - LASSERT(offsetof(struct mds_body, fsuid) == 72); - LASSERT((int)sizeof(((struct mds_body *)0)->fsuid) == 4); - LASSERT(offsetof(struct mds_body, fsgid) == 76); - LASSERT((int)sizeof(((struct mds_body *)0)->fsgid) == 4); - LASSERT(offsetof(struct mds_body, capability) == 80); - LASSERT((int)sizeof(((struct mds_body *)0)->capability) == 4); - LASSERT(offsetof(struct mds_body, mode) == 84); - LASSERT((int)sizeof(((struct mds_body *)0)->mode) == 4); - LASSERT(offsetof(struct mds_body, uid) == 88); - LASSERT((int)sizeof(((struct mds_body *)0)->uid) == 4); - LASSERT(offsetof(struct mds_body, gid) == 92); - LASSERT((int)sizeof(((struct mds_body *)0)->gid) == 4); - LASSERT(offsetof(struct mds_body, mtime) == 96); - LASSERT((int)sizeof(((struct mds_body *)0)->mtime) == 4); - LASSERT(offsetof(struct mds_body, ctime) == 100); - LASSERT((int)sizeof(((struct mds_body *)0)->ctime) == 4); - LASSERT(offsetof(struct mds_body, atime) == 104); - LASSERT((int)sizeof(((struct mds_body *)0)->atime) == 4); - LASSERT(offsetof(struct mds_body, flags) == 108); - LASSERT((int)sizeof(((struct mds_body *)0)->flags) == 4); - LASSERT(offsetof(struct mds_body, rdev) == 112); - LASSERT((int)sizeof(((struct mds_body *)0)->rdev) == 4); - LASSERT(offsetof(struct mds_body, nlink) == 116); - LASSERT((int)sizeof(((struct mds_body *)0)->nlink) == 4); - LASSERT(offsetof(struct mds_body, generation) == 120); - LASSERT((int)sizeof(((struct mds_body *)0)->generation) == 4); - LASSERT(offsetof(struct mds_body, suppgid) == 124); - LASSERT((int)sizeof(((struct mds_body *)0)->suppgid) == 4); - LASSERT(offsetof(struct mds_body, eadatasize) == 128); - LASSERT((int)sizeof(((struct mds_body *)0)->eadatasize) == 4); - LASSERT(FMODE_READ == 1); - LASSERT(FMODE_WRITE == 2); - LASSERT(FMODE_EXEC == 4); - LASSERT(MDS_OPEN_CREAT == 64); - LASSERT(MDS_OPEN_EXCL == 128); - LASSERT(MDS_OPEN_TRUNC == 512); - LASSERT(MDS_OPEN_APPEND == 1024); - LASSERT(MDS_OPEN_SYNC == 4096); - LASSERT(MDS_OPEN_DIRECTORY == 65536); - LASSERT(MDS_OPEN_DELAY_CREATE == 16777216); - LASSERT(MDS_OPEN_HAS_EA == 1073741824); + LASSERTF((int)sizeof(struct mds_body) == 136, " found %lld\n", + (long long)(int)sizeof(struct mds_body)); + LASSERTF(offsetof(struct mds_body, fid1) == 0, " found %lld\n", + (long long)offsetof(struct mds_body, fid1)); + LASSERTF((int)sizeof(((struct mds_body *)0)->fid1) == 16, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->fid1)); + LASSERTF(offsetof(struct mds_body, fid2) == 16, " found %lld\n", + (long long)offsetof(struct mds_body, fid2)); + LASSERTF((int)sizeof(((struct mds_body *)0)->fid2) == 16, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->fid2)); + LASSERTF(offsetof(struct mds_body, handle) == 32, " found %lld\n", + (long long)offsetof(struct mds_body, handle)); + LASSERTF((int)sizeof(((struct mds_body *)0)->handle) == 8, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->handle)); + LASSERTF(offsetof(struct mds_body, size) == 40, " found %lld\n", + (long long)offsetof(struct mds_body, size)); + LASSERTF((int)sizeof(((struct mds_body *)0)->size) == 8, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->size)); + LASSERTF(offsetof(struct mds_body, blocks) == 48, " found %lld\n", + (long long)offsetof(struct mds_body, blocks)); + LASSERTF((int)sizeof(((struct mds_body *)0)->blocks) == 8, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->blocks)); + LASSERTF(offsetof(struct mds_body, io_epoch) == 56, " found %lld\n", + (long long)offsetof(struct mds_body, io_epoch)); + LASSERTF((int)sizeof(((struct mds_body *)0)->io_epoch) == 8, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->io_epoch)); + LASSERTF(offsetof(struct mds_body, ino) == 64, " found %lld\n", + (long long)offsetof(struct mds_body, ino)); + LASSERTF((int)sizeof(((struct mds_body *)0)->ino) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->ino)); + LASSERTF(offsetof(struct mds_body, valid) == 68, " found %lld\n", + (long long)offsetof(struct mds_body, valid)); + LASSERTF((int)sizeof(((struct mds_body *)0)->valid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->valid)); + LASSERTF(offsetof(struct mds_body, fsuid) == 72, " found %lld\n", + (long long)offsetof(struct mds_body, fsuid)); + LASSERTF((int)sizeof(((struct mds_body *)0)->fsuid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->fsuid)); + LASSERTF(offsetof(struct mds_body, fsgid) == 76, " found %lld\n", + (long long)offsetof(struct mds_body, fsgid)); + LASSERTF((int)sizeof(((struct mds_body *)0)->fsgid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->fsgid)); + LASSERTF(offsetof(struct mds_body, capability) == 80, " found %lld\n", + (long long)offsetof(struct mds_body, capability)); + LASSERTF((int)sizeof(((struct mds_body *)0)->capability) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->capability)); + LASSERTF(offsetof(struct mds_body, mode) == 84, " found %lld\n", + (long long)offsetof(struct mds_body, mode)); + LASSERTF((int)sizeof(((struct mds_body *)0)->mode) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->mode)); + LASSERTF(offsetof(struct mds_body, uid) == 88, " found %lld\n", + (long long)offsetof(struct mds_body, uid)); + LASSERTF((int)sizeof(((struct mds_body *)0)->uid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->uid)); + LASSERTF(offsetof(struct mds_body, gid) == 92, " found %lld\n", + (long long)offsetof(struct mds_body, gid)); + LASSERTF((int)sizeof(((struct mds_body *)0)->gid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->gid)); + LASSERTF(offsetof(struct mds_body, mtime) == 96, " found %lld\n", + (long long)offsetof(struct mds_body, mtime)); + LASSERTF((int)sizeof(((struct mds_body *)0)->mtime) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->mtime)); + LASSERTF(offsetof(struct mds_body, ctime) == 100, " found %lld\n", + (long long)offsetof(struct mds_body, ctime)); + LASSERTF((int)sizeof(((struct mds_body *)0)->ctime) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->ctime)); + LASSERTF(offsetof(struct mds_body, atime) == 104, " found %lld\n", + (long long)offsetof(struct mds_body, atime)); + LASSERTF((int)sizeof(((struct mds_body *)0)->atime) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->atime)); + LASSERTF(offsetof(struct mds_body, flags) == 108, " found %lld\n", + (long long)offsetof(struct mds_body, flags)); + LASSERTF((int)sizeof(((struct mds_body *)0)->flags) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->flags)); + LASSERTF(offsetof(struct mds_body, rdev) == 112, " found %lld\n", + (long long)offsetof(struct mds_body, rdev)); + LASSERTF((int)sizeof(((struct mds_body *)0)->rdev) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->rdev)); + LASSERTF(offsetof(struct mds_body, nlink) == 116, " found %lld\n", + (long long)offsetof(struct mds_body, nlink)); + LASSERTF((int)sizeof(((struct mds_body *)0)->nlink) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->nlink)); + LASSERTF(offsetof(struct mds_body, generation) == 120, " found %lld\n", + (long long)offsetof(struct mds_body, generation)); + LASSERTF((int)sizeof(((struct mds_body *)0)->generation) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->generation)); + LASSERTF(offsetof(struct mds_body, suppgid) == 124, " found %lld\n", + (long long)offsetof(struct mds_body, suppgid)); + LASSERTF((int)sizeof(((struct mds_body *)0)->suppgid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->suppgid)); + LASSERTF(offsetof(struct mds_body, eadatasize) == 128, " found %lld\n", + (long long)offsetof(struct mds_body, eadatasize)); + LASSERTF((int)sizeof(((struct mds_body *)0)->eadatasize) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->eadatasize)); + LASSERTF(FMODE_READ == 1, " found %lld\n", + (long long)FMODE_READ); + LASSERTF(FMODE_WRITE == 2, " found %lld\n", + (long long)FMODE_WRITE); + LASSERTF(FMODE_EXEC == 4, " found %lld\n", + (long long)FMODE_EXEC); + LASSERTF(MDS_OPEN_CREAT == 64, " found %lld\n", + (long long)MDS_OPEN_CREAT); + LASSERTF(MDS_OPEN_EXCL == 128, " found %lld\n", + (long long)MDS_OPEN_EXCL); + LASSERTF(MDS_OPEN_TRUNC == 512, " found %lld\n", + (long long)MDS_OPEN_TRUNC); + LASSERTF(MDS_OPEN_APPEND == 1024, " found %lld\n", + (long long)MDS_OPEN_APPEND); + LASSERTF(MDS_OPEN_SYNC == 4096, " found %lld\n", + (long long)MDS_OPEN_SYNC); + LASSERTF(MDS_OPEN_DIRECTORY == 65536, " found %lld\n", + (long long)MDS_OPEN_DIRECTORY); + LASSERTF(MDS_OPEN_DELAY_CREATE == 16777216, " found %lld\n", + (long long)MDS_OPEN_DELAY_CREATE); + LASSERTF(MDS_OPEN_HAS_EA == 1073741824, " found %lld\n", + (long long)MDS_OPEN_HAS_EA); /* Checks for struct mds_rec_setattr */ - LASSERT((int)sizeof(struct mds_rec_setattr) == 88); - LASSERT(offsetof(struct mds_rec_setattr, sa_opcode) == 0); - LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_opcode) == 4); - LASSERT(offsetof(struct mds_rec_setattr, sa_fsuid) == 4); - LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_fsuid) == 4); - LASSERT(offsetof(struct mds_rec_setattr, sa_fsgid) == 8); - LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_fsgid) == 4); - LASSERT(offsetof(struct mds_rec_setattr, sa_cap) == 12); - LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_cap) == 4); - LASSERT(offsetof(struct mds_rec_setattr, sa_suppgid) == 16); - LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_suppgid) == 4); - LASSERT(offsetof(struct mds_rec_setattr, sa_valid) == 20); - LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_valid) == 4); - LASSERT(offsetof(struct mds_rec_setattr, sa_fid) == 24); - LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_fid) == 16); - LASSERT(offsetof(struct mds_rec_setattr, sa_mode) == 40); - LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_mode) == 4); - LASSERT(offsetof(struct mds_rec_setattr, sa_uid) == 44); - LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_uid) == 4); - LASSERT(offsetof(struct mds_rec_setattr, sa_gid) == 48); - LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_gid) == 4); - LASSERT(offsetof(struct mds_rec_setattr, sa_attr_flags) == 52); - LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_attr_flags) == 4); - LASSERT(offsetof(struct mds_rec_setattr, sa_size) == 56); - LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_size) == 8); - LASSERT(offsetof(struct mds_rec_setattr, sa_atime) == 64); - LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_atime) == 8); - LASSERT(offsetof(struct mds_rec_setattr, sa_mtime) == 72); - LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_mtime) == 8); - LASSERT(offsetof(struct mds_rec_setattr, sa_ctime) == 80); - LASSERT((int)sizeof(((struct mds_rec_setattr *)0)->sa_ctime) == 8); + LASSERTF((int)sizeof(struct mds_rec_setattr) == 88, " found %lld\n", + (long long)(int)sizeof(struct mds_rec_setattr)); + LASSERTF(offsetof(struct mds_rec_setattr, sa_opcode) == 0, " found %lld\n", + (long long)offsetof(struct mds_rec_setattr, sa_opcode)); + LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_opcode) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_opcode)); + LASSERTF(offsetof(struct mds_rec_setattr, sa_fsuid) == 4, " found %lld\n", + (long long)offsetof(struct mds_rec_setattr, sa_fsuid)); + LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_fsuid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_fsuid)); + LASSERTF(offsetof(struct mds_rec_setattr, sa_fsgid) == 8, " found %lld\n", + (long long)offsetof(struct mds_rec_setattr, sa_fsgid)); + LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_fsgid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_fsgid)); + LASSERTF(offsetof(struct mds_rec_setattr, sa_cap) == 12, " found %lld\n", + (long long)offsetof(struct mds_rec_setattr, sa_cap)); + LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_cap) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_cap)); + LASSERTF(offsetof(struct mds_rec_setattr, sa_suppgid) == 16, " found %lld\n", + (long long)offsetof(struct mds_rec_setattr, sa_suppgid)); + LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_suppgid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_suppgid)); + LASSERTF(offsetof(struct mds_rec_setattr, sa_valid) == 20, " found %lld\n", + (long long)offsetof(struct mds_rec_setattr, sa_valid)); + LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_valid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_valid)); + LASSERTF(offsetof(struct mds_rec_setattr, sa_fid) == 24, " found %lld\n", + (long long)offsetof(struct mds_rec_setattr, sa_fid)); + LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_fid) == 16, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_fid)); + LASSERTF(offsetof(struct mds_rec_setattr, sa_mode) == 40, " found %lld\n", + (long long)offsetof(struct mds_rec_setattr, sa_mode)); + LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_mode) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_mode)); + LASSERTF(offsetof(struct mds_rec_setattr, sa_uid) == 44, " found %lld\n", + (long long)offsetof(struct mds_rec_setattr, sa_uid)); + LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_uid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_uid)); + LASSERTF(offsetof(struct mds_rec_setattr, sa_gid) == 48, " found %lld\n", + (long long)offsetof(struct mds_rec_setattr, sa_gid)); + LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_gid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_gid)); + LASSERTF(offsetof(struct mds_rec_setattr, sa_attr_flags) == 52, " found %lld\n", + (long long)offsetof(struct mds_rec_setattr, sa_attr_flags)); + LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_attr_flags) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_attr_flags)); + LASSERTF(offsetof(struct mds_rec_setattr, sa_size) == 56, " found %lld\n", + (long long)offsetof(struct mds_rec_setattr, sa_size)); + LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_size) == 8, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_size)); + LASSERTF(offsetof(struct mds_rec_setattr, sa_atime) == 64, " found %lld\n", + (long long)offsetof(struct mds_rec_setattr, sa_atime)); + LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_atime) == 8, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_atime)); + LASSERTF(offsetof(struct mds_rec_setattr, sa_mtime) == 72, " found %lld\n", + (long long)offsetof(struct mds_rec_setattr, sa_mtime)); + LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_mtime) == 8, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_mtime)); + LASSERTF(offsetof(struct mds_rec_setattr, sa_ctime) == 80, " found %lld\n", + (long long)offsetof(struct mds_rec_setattr, sa_ctime)); + LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_ctime) == 8, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_ctime)); /* Checks for struct mds_rec_create */ - LASSERT((int)sizeof(struct mds_rec_create) == 80); - LASSERT(offsetof(struct mds_rec_create, cr_opcode) == 0); - LASSERT((int)sizeof(((struct mds_rec_create *)0)->cr_opcode) == 4); - LASSERT(offsetof(struct mds_rec_create, cr_fsuid) == 4); - LASSERT((int)sizeof(((struct mds_rec_create *)0)->cr_fsuid) == 4); - LASSERT(offsetof(struct mds_rec_create, cr_fsgid) == 8); - LASSERT((int)sizeof(((struct mds_rec_create *)0)->cr_fsgid) == 4); - LASSERT(offsetof(struct mds_rec_create, cr_cap) == 12); - LASSERT((int)sizeof(((struct mds_rec_create *)0)->cr_cap) == 4); - LASSERT(offsetof(struct mds_rec_create, cr_flags) == 16); - LASSERT((int)sizeof(((struct mds_rec_create *)0)->cr_flags) == 4); - LASSERT(offsetof(struct mds_rec_create, cr_mode) == 20); - LASSERT((int)sizeof(((struct mds_rec_create *)0)->cr_mode) == 4); - LASSERT(offsetof(struct mds_rec_create, cr_fid) == 24); - LASSERT((int)sizeof(((struct mds_rec_create *)0)->cr_fid) == 16); - LASSERT(offsetof(struct mds_rec_create, cr_replayfid) == 40); - LASSERT((int)sizeof(((struct mds_rec_create *)0)->cr_replayfid) == 16); - LASSERT(offsetof(struct mds_rec_create, cr_time) == 56); - LASSERT((int)sizeof(((struct mds_rec_create *)0)->cr_time) == 8); - LASSERT(offsetof(struct mds_rec_create, cr_rdev) == 64); - LASSERT((int)sizeof(((struct mds_rec_create *)0)->cr_rdev) == 8); - LASSERT(offsetof(struct mds_rec_create, cr_suppgid) == 72); - LASSERT((int)sizeof(((struct mds_rec_create *)0)->cr_suppgid) == 4); + LASSERTF((int)sizeof(struct mds_rec_create) == 80, " found %lld\n", + (long long)(int)sizeof(struct mds_rec_create)); + LASSERTF(offsetof(struct mds_rec_create, cr_opcode) == 0, " found %lld\n", + (long long)offsetof(struct mds_rec_create, cr_opcode)); + LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_opcode) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_opcode)); + LASSERTF(offsetof(struct mds_rec_create, cr_fsuid) == 4, " found %lld\n", + (long long)offsetof(struct mds_rec_create, cr_fsuid)); + LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_fsuid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_fsuid)); + LASSERTF(offsetof(struct mds_rec_create, cr_fsgid) == 8, " found %lld\n", + (long long)offsetof(struct mds_rec_create, cr_fsgid)); + LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_fsgid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_fsgid)); + LASSERTF(offsetof(struct mds_rec_create, cr_cap) == 12, " found %lld\n", + (long long)offsetof(struct mds_rec_create, cr_cap)); + LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_cap) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_cap)); + LASSERTF(offsetof(struct mds_rec_create, cr_flags) == 16, " found %lld\n", + (long long)offsetof(struct mds_rec_create, cr_flags)); + LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_flags) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_flags)); + LASSERTF(offsetof(struct mds_rec_create, cr_mode) == 20, " found %lld\n", + (long long)offsetof(struct mds_rec_create, cr_mode)); + LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_mode) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_mode)); + LASSERTF(offsetof(struct mds_rec_create, cr_fid) == 24, " found %lld\n", + (long long)offsetof(struct mds_rec_create, cr_fid)); + LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_fid) == 16, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_fid)); + LASSERTF(offsetof(struct mds_rec_create, cr_replayfid) == 40, " found %lld\n", + (long long)offsetof(struct mds_rec_create, cr_replayfid)); + LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_replayfid) == 16, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_replayfid)); + LASSERTF(offsetof(struct mds_rec_create, cr_time) == 56, " found %lld\n", + (long long)offsetof(struct mds_rec_create, cr_time)); + LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_time) == 8, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_time)); + LASSERTF(offsetof(struct mds_rec_create, cr_rdev) == 64, " found %lld\n", + (long long)offsetof(struct mds_rec_create, cr_rdev)); + LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_rdev) == 8, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_rdev)); + LASSERTF(offsetof(struct mds_rec_create, cr_suppgid) == 72, " found %lld\n", + (long long)offsetof(struct mds_rec_create, cr_suppgid)); + LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_suppgid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_suppgid)); /* Checks for struct mds_rec_link */ - LASSERT((int)sizeof(struct mds_rec_link) == 64); - LASSERT(offsetof(struct mds_rec_link, lk_opcode) == 0); - LASSERT((int)sizeof(((struct mds_rec_link *)0)->lk_opcode) == 4); - LASSERT(offsetof(struct mds_rec_link, lk_fsuid) == 4); - LASSERT((int)sizeof(((struct mds_rec_link *)0)->lk_fsuid) == 4); - LASSERT(offsetof(struct mds_rec_link, lk_fsgid) == 8); - LASSERT((int)sizeof(((struct mds_rec_link *)0)->lk_fsgid) == 4); - LASSERT(offsetof(struct mds_rec_link, lk_cap) == 12); - LASSERT((int)sizeof(((struct mds_rec_link *)0)->lk_cap) == 4); - LASSERT(offsetof(struct mds_rec_link, lk_suppgid1) == 16); - LASSERT((int)sizeof(((struct mds_rec_link *)0)->lk_suppgid1) == 4); - LASSERT(offsetof(struct mds_rec_link, lk_suppgid2) == 20); - LASSERT((int)sizeof(((struct mds_rec_link *)0)->lk_suppgid2) == 4); - LASSERT(offsetof(struct mds_rec_link, lk_fid1) == 24); - LASSERT((int)sizeof(((struct mds_rec_link *)0)->lk_fid1) == 16); - LASSERT(offsetof(struct mds_rec_link, lk_fid2) == 40); - LASSERT((int)sizeof(((struct mds_rec_link *)0)->lk_fid2) == 16); - LASSERT(offsetof(struct mds_rec_link, lk_time) == 56); - LASSERT((int)sizeof(((struct mds_rec_link *)0)->lk_time) == 8); + LASSERTF((int)sizeof(struct mds_rec_link) == 64, " found %lld\n", + (long long)(int)sizeof(struct mds_rec_link)); + LASSERTF(offsetof(struct mds_rec_link, lk_opcode) == 0, " found %lld\n", + (long long)offsetof(struct mds_rec_link, lk_opcode)); + LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_opcode) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_opcode)); + LASSERTF(offsetof(struct mds_rec_link, lk_fsuid) == 4, " found %lld\n", + (long long)offsetof(struct mds_rec_link, lk_fsuid)); + LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_fsuid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_fsuid)); + LASSERTF(offsetof(struct mds_rec_link, lk_fsgid) == 8, " found %lld\n", + (long long)offsetof(struct mds_rec_link, lk_fsgid)); + LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_fsgid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_fsgid)); + LASSERTF(offsetof(struct mds_rec_link, lk_cap) == 12, " found %lld\n", + (long long)offsetof(struct mds_rec_link, lk_cap)); + LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_cap) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_cap)); + LASSERTF(offsetof(struct mds_rec_link, lk_suppgid1) == 16, " found %lld\n", + (long long)offsetof(struct mds_rec_link, lk_suppgid1)); + LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_suppgid1) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_suppgid1)); + LASSERTF(offsetof(struct mds_rec_link, lk_suppgid2) == 20, " found %lld\n", + (long long)offsetof(struct mds_rec_link, lk_suppgid2)); + LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_suppgid2) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_suppgid2)); + LASSERTF(offsetof(struct mds_rec_link, lk_fid1) == 24, " found %lld\n", + (long long)offsetof(struct mds_rec_link, lk_fid1)); + LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_fid1) == 16, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_fid1)); + LASSERTF(offsetof(struct mds_rec_link, lk_fid2) == 40, " found %lld\n", + (long long)offsetof(struct mds_rec_link, lk_fid2)); + LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_fid2) == 16, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_fid2)); + LASSERTF(offsetof(struct mds_rec_link, lk_time) == 56, " found %lld\n", + (long long)offsetof(struct mds_rec_link, lk_time)); + LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_time) == 8, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_time)); /* Checks for struct mds_rec_unlink */ - LASSERT((int)sizeof(struct mds_rec_unlink) == 64); - LASSERT(offsetof(struct mds_rec_unlink, ul_opcode) == 0); - LASSERT((int)sizeof(((struct mds_rec_unlink *)0)->ul_opcode) == 4); - LASSERT(offsetof(struct mds_rec_unlink, ul_fsuid) == 4); - LASSERT((int)sizeof(((struct mds_rec_unlink *)0)->ul_fsuid) == 4); - LASSERT(offsetof(struct mds_rec_unlink, ul_fsgid) == 8); - LASSERT((int)sizeof(((struct mds_rec_unlink *)0)->ul_fsgid) == 4); - LASSERT(offsetof(struct mds_rec_unlink, ul_cap) == 12); - LASSERT((int)sizeof(((struct mds_rec_unlink *)0)->ul_cap) == 4); - LASSERT(offsetof(struct mds_rec_unlink, ul_suppgid) == 16); - LASSERT((int)sizeof(((struct mds_rec_unlink *)0)->ul_suppgid) == 4); - LASSERT(offsetof(struct mds_rec_unlink, ul_mode) == 20); - LASSERT((int)sizeof(((struct mds_rec_unlink *)0)->ul_mode) == 4); - LASSERT(offsetof(struct mds_rec_unlink, ul_fid1) == 24); - LASSERT((int)sizeof(((struct mds_rec_unlink *)0)->ul_fid1) == 16); - LASSERT(offsetof(struct mds_rec_unlink, ul_fid2) == 40); - LASSERT((int)sizeof(((struct mds_rec_unlink *)0)->ul_fid2) == 16); - LASSERT(offsetof(struct mds_rec_unlink, ul_time) == 56); - LASSERT((int)sizeof(((struct mds_rec_unlink *)0)->ul_time) == 8); + LASSERTF((int)sizeof(struct mds_rec_unlink) == 64, " found %lld\n", + (long long)(int)sizeof(struct mds_rec_unlink)); + LASSERTF(offsetof(struct mds_rec_unlink, ul_opcode) == 0, " found %lld\n", + (long long)offsetof(struct mds_rec_unlink, ul_opcode)); + LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_opcode) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_opcode)); + LASSERTF(offsetof(struct mds_rec_unlink, ul_fsuid) == 4, " found %lld\n", + (long long)offsetof(struct mds_rec_unlink, ul_fsuid)); + LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_fsuid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_fsuid)); + LASSERTF(offsetof(struct mds_rec_unlink, ul_fsgid) == 8, " found %lld\n", + (long long)offsetof(struct mds_rec_unlink, ul_fsgid)); + LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_fsgid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_fsgid)); + LASSERTF(offsetof(struct mds_rec_unlink, ul_cap) == 12, " found %lld\n", + (long long)offsetof(struct mds_rec_unlink, ul_cap)); + LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_cap) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_cap)); + LASSERTF(offsetof(struct mds_rec_unlink, ul_suppgid) == 16, " found %lld\n", + (long long)offsetof(struct mds_rec_unlink, ul_suppgid)); + LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_suppgid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_suppgid)); + LASSERTF(offsetof(struct mds_rec_unlink, ul_mode) == 20, " found %lld\n", + (long long)offsetof(struct mds_rec_unlink, ul_mode)); + LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_mode) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_mode)); + LASSERTF(offsetof(struct mds_rec_unlink, ul_fid1) == 24, " found %lld\n", + (long long)offsetof(struct mds_rec_unlink, ul_fid1)); + LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_fid1) == 16, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_fid1)); + LASSERTF(offsetof(struct mds_rec_unlink, ul_fid2) == 40, " found %lld\n", + (long long)offsetof(struct mds_rec_unlink, ul_fid2)); + LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_fid2) == 16, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_fid2)); + LASSERTF(offsetof(struct mds_rec_unlink, ul_time) == 56, " found %lld\n", + (long long)offsetof(struct mds_rec_unlink, ul_time)); + LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_time) == 8, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_time)); /* Checks for struct mds_rec_rename */ - LASSERT((int)sizeof(struct mds_rec_rename) == 64); - LASSERT(offsetof(struct mds_rec_rename, rn_opcode) == 0); - LASSERT((int)sizeof(((struct mds_rec_rename *)0)->rn_opcode) == 4); - LASSERT(offsetof(struct mds_rec_rename, rn_fsuid) == 4); - LASSERT((int)sizeof(((struct mds_rec_rename *)0)->rn_fsuid) == 4); - LASSERT(offsetof(struct mds_rec_rename, rn_fsgid) == 8); - LASSERT((int)sizeof(((struct mds_rec_rename *)0)->rn_fsgid) == 4); - LASSERT(offsetof(struct mds_rec_rename, rn_cap) == 12); - LASSERT((int)sizeof(((struct mds_rec_rename *)0)->rn_cap) == 4); - LASSERT(offsetof(struct mds_rec_rename, rn_suppgid1) == 16); - LASSERT((int)sizeof(((struct mds_rec_rename *)0)->rn_suppgid1) == 4); - LASSERT(offsetof(struct mds_rec_rename, rn_suppgid2) == 20); - LASSERT((int)sizeof(((struct mds_rec_rename *)0)->rn_suppgid2) == 4); - LASSERT(offsetof(struct mds_rec_rename, rn_fid1) == 24); - LASSERT((int)sizeof(((struct mds_rec_rename *)0)->rn_fid1) == 16); - LASSERT(offsetof(struct mds_rec_rename, rn_fid2) == 40); - LASSERT((int)sizeof(((struct mds_rec_rename *)0)->rn_fid2) == 16); - LASSERT(offsetof(struct mds_rec_rename, rn_time) == 56); - LASSERT((int)sizeof(((struct mds_rec_rename *)0)->rn_time) == 8); + LASSERTF((int)sizeof(struct mds_rec_rename) == 64, " found %lld\n", + (long long)(int)sizeof(struct mds_rec_rename)); + LASSERTF(offsetof(struct mds_rec_rename, rn_opcode) == 0, " found %lld\n", + (long long)offsetof(struct mds_rec_rename, rn_opcode)); + LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_opcode) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_opcode)); + LASSERTF(offsetof(struct mds_rec_rename, rn_fsuid) == 4, " found %lld\n", + (long long)offsetof(struct mds_rec_rename, rn_fsuid)); + LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_fsuid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_fsuid)); + LASSERTF(offsetof(struct mds_rec_rename, rn_fsgid) == 8, " found %lld\n", + (long long)offsetof(struct mds_rec_rename, rn_fsgid)); + LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_fsgid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_fsgid)); + LASSERTF(offsetof(struct mds_rec_rename, rn_cap) == 12, " found %lld\n", + (long long)offsetof(struct mds_rec_rename, rn_cap)); + LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_cap) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_cap)); + LASSERTF(offsetof(struct mds_rec_rename, rn_suppgid1) == 16, " found %lld\n", + (long long)offsetof(struct mds_rec_rename, rn_suppgid1)); + LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_suppgid1) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_suppgid1)); + LASSERTF(offsetof(struct mds_rec_rename, rn_suppgid2) == 20, " found %lld\n", + (long long)offsetof(struct mds_rec_rename, rn_suppgid2)); + LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_suppgid2) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_suppgid2)); + LASSERTF(offsetof(struct mds_rec_rename, rn_fid1) == 24, " found %lld\n", + (long long)offsetof(struct mds_rec_rename, rn_fid1)); + LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_fid1) == 16, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_fid1)); + LASSERTF(offsetof(struct mds_rec_rename, rn_fid2) == 40, " found %lld\n", + (long long)offsetof(struct mds_rec_rename, rn_fid2)); + LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_fid2) == 16, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_fid2)); + LASSERTF(offsetof(struct mds_rec_rename, rn_time) == 56, " found %lld\n", + (long long)offsetof(struct mds_rec_rename, rn_time)); + LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_time) == 8, " found %lld\n", + (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_time)); /* Checks for struct lov_desc */ - LASSERT((int)sizeof(struct lov_desc) == 72); - LASSERT(offsetof(struct lov_desc, ld_tgt_count) == 0); - LASSERT((int)sizeof(((struct lov_desc *)0)->ld_tgt_count) == 4); - LASSERT(offsetof(struct lov_desc, ld_active_tgt_count) == 4); - LASSERT((int)sizeof(((struct lov_desc *)0)->ld_active_tgt_count) == 4); - LASSERT(offsetof(struct lov_desc, ld_default_stripe_count) == 8); - LASSERT((int)sizeof(((struct lov_desc *)0)->ld_default_stripe_count) == 4); - LASSERT(offsetof(struct lov_desc, ld_pattern) == 12); - LASSERT((int)sizeof(((struct lov_desc *)0)->ld_pattern) == 4); - LASSERT(offsetof(struct lov_desc, ld_default_stripe_size) == 16); - LASSERT((int)sizeof(((struct lov_desc *)0)->ld_default_stripe_size) == 8); - LASSERT(offsetof(struct lov_desc, ld_default_stripe_offset) == 24); - LASSERT((int)sizeof(((struct lov_desc *)0)->ld_default_stripe_offset) == 8); - LASSERT(offsetof(struct lov_desc, ld_uuid) == 32); - LASSERT((int)sizeof(((struct lov_desc *)0)->ld_uuid) == 40); + LASSERTF((int)sizeof(struct lov_desc) == 72, " found %lld\n", + (long long)(int)sizeof(struct lov_desc)); + LASSERTF(offsetof(struct lov_desc, ld_tgt_count) == 0, " found %lld\n", + (long long)offsetof(struct lov_desc, ld_tgt_count)); + LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_tgt_count) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lov_desc *)0)->ld_tgt_count)); + LASSERTF(offsetof(struct lov_desc, ld_active_tgt_count) == 4, " found %lld\n", + (long long)offsetof(struct lov_desc, ld_active_tgt_count)); + LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_active_tgt_count) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lov_desc *)0)->ld_active_tgt_count)); + LASSERTF(offsetof(struct lov_desc, ld_default_stripe_count) == 8, " found %lld\n", + (long long)offsetof(struct lov_desc, ld_default_stripe_count)); + LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_default_stripe_count) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lov_desc *)0)->ld_default_stripe_count)); + LASSERTF(offsetof(struct lov_desc, ld_pattern) == 12, " found %lld\n", + (long long)offsetof(struct lov_desc, ld_pattern)); + LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_pattern) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lov_desc *)0)->ld_pattern)); + LASSERTF(offsetof(struct lov_desc, ld_default_stripe_size) == 16, " found %lld\n", + (long long)offsetof(struct lov_desc, ld_default_stripe_size)); + LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_default_stripe_size) == 8, " found %lld\n", + (long long)(int)sizeof(((struct lov_desc *)0)->ld_default_stripe_size)); + LASSERTF(offsetof(struct lov_desc, ld_default_stripe_offset) == 24, " found %lld\n", + (long long)offsetof(struct lov_desc, ld_default_stripe_offset)); + LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_default_stripe_offset) == 8, " found %lld\n", + (long long)(int)sizeof(((struct lov_desc *)0)->ld_default_stripe_offset)); + LASSERTF(offsetof(struct lov_desc, ld_uuid) == 32, " found %lld\n", + (long long)offsetof(struct lov_desc, ld_uuid)); + LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_uuid) == 40, " found %lld\n", + (long long)(int)sizeof(((struct lov_desc *)0)->ld_uuid)); /* Checks for struct ldlm_res_id */ - LASSERT((int)sizeof(struct ldlm_res_id) == 32); - LASSERT(offsetof(struct ldlm_res_id, name[4]) == 32); - LASSERT((int)sizeof(((struct ldlm_res_id *)0)->name[4]) == 8); + LASSERTF((int)sizeof(struct ldlm_res_id) == 32, " found %lld\n", + (long long)(int)sizeof(struct ldlm_res_id)); + LASSERTF(offsetof(struct ldlm_res_id, name[4]) == 32, " found %lld\n", + (long long)offsetof(struct ldlm_res_id, name[4])); + LASSERTF((int)sizeof(((struct ldlm_res_id *)0)->name[4]) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_res_id *)0)->name[4])); /* Checks for struct ldlm_extent */ - LASSERT((int)sizeof(struct ldlm_extent) == 16); - LASSERT(offsetof(struct ldlm_extent, start) == 0); - LASSERT((int)sizeof(((struct ldlm_extent *)0)->start) == 8); - LASSERT(offsetof(struct ldlm_extent, end) == 8); - LASSERT((int)sizeof(((struct ldlm_extent *)0)->end) == 8); + LASSERTF((int)sizeof(struct ldlm_extent) == 16, " found %lld\n", + (long long)(int)sizeof(struct ldlm_extent)); + LASSERTF(offsetof(struct ldlm_extent, start) == 0, " found %lld\n", + (long long)offsetof(struct ldlm_extent, start)); + LASSERTF((int)sizeof(((struct ldlm_extent *)0)->start) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_extent *)0)->start)); + LASSERTF(offsetof(struct ldlm_extent, end) == 8, " found %lld\n", + (long long)offsetof(struct ldlm_extent, end)); + LASSERTF((int)sizeof(((struct ldlm_extent *)0)->end) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_extent *)0)->end)); /* Checks for struct ldlm_flock */ - LASSERT((int)sizeof(struct ldlm_flock) == 32); - LASSERT(offsetof(struct ldlm_flock, start) == 0); - LASSERT((int)sizeof(((struct ldlm_flock *)0)->start) == 8); - LASSERT(offsetof(struct ldlm_flock, end) == 8); - LASSERT((int)sizeof(((struct ldlm_flock *)0)->end) == 8); - LASSERT(offsetof(struct ldlm_flock, blocking_export) == 16); - LASSERT((int)sizeof(((struct ldlm_flock *)0)->blocking_export) == 8); - LASSERT(offsetof(struct ldlm_flock, blocking_pid) == 24); - LASSERT((int)sizeof(((struct ldlm_flock *)0)->blocking_pid) == 4); - LASSERT(offsetof(struct ldlm_flock, pid) == 28); - LASSERT((int)sizeof(((struct ldlm_flock *)0)->pid) == 4); + LASSERTF((int)sizeof(struct ldlm_flock) == 32, " found %lld\n", + (long long)(int)sizeof(struct ldlm_flock)); + LASSERTF(offsetof(struct ldlm_flock, start) == 0, " found %lld\n", + (long long)offsetof(struct ldlm_flock, start)); + LASSERTF((int)sizeof(((struct ldlm_flock *)0)->start) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_flock *)0)->start)); + LASSERTF(offsetof(struct ldlm_flock, end) == 8, " found %lld\n", + (long long)offsetof(struct ldlm_flock, end)); + LASSERTF((int)sizeof(((struct ldlm_flock *)0)->end) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_flock *)0)->end)); + LASSERTF(offsetof(struct ldlm_flock, blocking_export) == 16, " found %lld\n", + (long long)offsetof(struct ldlm_flock, blocking_export)); + LASSERTF((int)sizeof(((struct ldlm_flock *)0)->blocking_export) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_flock *)0)->blocking_export)); + LASSERTF(offsetof(struct ldlm_flock, blocking_pid) == 24, " found %lld\n", + (long long)offsetof(struct ldlm_flock, blocking_pid)); + LASSERTF((int)sizeof(((struct ldlm_flock *)0)->blocking_pid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_flock *)0)->blocking_pid)); + LASSERTF(offsetof(struct ldlm_flock, pid) == 28, " found %lld\n", + (long long)offsetof(struct ldlm_flock, pid)); + LASSERTF((int)sizeof(((struct ldlm_flock *)0)->pid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_flock *)0)->pid)); /* Checks for struct ldlm_intent */ - LASSERT((int)sizeof(struct ldlm_intent) == 8); - LASSERT(offsetof(struct ldlm_intent, opc) == 0); - LASSERT((int)sizeof(((struct ldlm_intent *)0)->opc) == 8); + LASSERTF((int)sizeof(struct ldlm_intent) == 8, " found %lld\n", + (long long)(int)sizeof(struct ldlm_intent)); + LASSERTF(offsetof(struct ldlm_intent, opc) == 0, " found %lld\n", + (long long)offsetof(struct ldlm_intent, opc)); + LASSERTF((int)sizeof(((struct ldlm_intent *)0)->opc) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_intent *)0)->opc)); /* Checks for struct ldlm_resource_desc */ - LASSERT((int)sizeof(struct ldlm_resource_desc) == 40); - LASSERT(offsetof(struct ldlm_resource_desc, lr_type) == 0); - LASSERT((int)sizeof(((struct ldlm_resource_desc *)0)->lr_type) == 4); - LASSERT(offsetof(struct ldlm_resource_desc, lr_name) == 8); - LASSERT((int)sizeof(((struct ldlm_resource_desc *)0)->lr_name) == 32); + LASSERTF((int)sizeof(struct ldlm_resource_desc) == 40, " found %lld\n", + (long long)(int)sizeof(struct ldlm_resource_desc)); + LASSERTF(offsetof(struct ldlm_resource_desc, lr_type) == 0, " found %lld\n", + (long long)offsetof(struct ldlm_resource_desc, lr_type)); + LASSERTF((int)sizeof(((struct ldlm_resource_desc *)0)->lr_type) == 4, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_resource_desc *)0)->lr_type)); + LASSERTF(offsetof(struct ldlm_resource_desc, lr_name) == 8, " found %lld\n", + (long long)offsetof(struct ldlm_resource_desc, lr_name)); + LASSERTF((int)sizeof(((struct ldlm_resource_desc *)0)->lr_name) == 32, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_resource_desc *)0)->lr_name)); /* Checks for struct ldlm_lock_desc */ - LASSERT((int)sizeof(struct ldlm_lock_desc) == 80); - LASSERT(offsetof(struct ldlm_lock_desc, l_resource) == 0); - LASSERT((int)sizeof(((struct ldlm_lock_desc *)0)->l_resource) == 40); - LASSERT(offsetof(struct ldlm_lock_desc, l_req_mode) == 40); - LASSERT((int)sizeof(((struct ldlm_lock_desc *)0)->l_req_mode) == 4); - LASSERT(offsetof(struct ldlm_lock_desc, l_granted_mode) == 44); - LASSERT((int)sizeof(((struct ldlm_lock_desc *)0)->l_granted_mode) == 4); - LASSERT(offsetof(struct ldlm_lock_desc, l_policy_data) == 48); - LASSERT((int)sizeof(((struct ldlm_lock_desc *)0)->l_policy_data) == 32); + LASSERTF((int)sizeof(struct ldlm_lock_desc) == 80, " found %lld\n", + (long long)(int)sizeof(struct ldlm_lock_desc)); + LASSERTF(offsetof(struct ldlm_lock_desc, l_resource) == 0, " found %lld\n", + (long long)offsetof(struct ldlm_lock_desc, l_resource)); + LASSERTF((int)sizeof(((struct ldlm_lock_desc *)0)->l_resource) == 40, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_lock_desc *)0)->l_resource)); + LASSERTF(offsetof(struct ldlm_lock_desc, l_req_mode) == 40, " found %lld\n", + (long long)offsetof(struct ldlm_lock_desc, l_req_mode)); + LASSERTF((int)sizeof(((struct ldlm_lock_desc *)0)->l_req_mode) == 4, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_lock_desc *)0)->l_req_mode)); + LASSERTF(offsetof(struct ldlm_lock_desc, l_granted_mode) == 44, " found %lld\n", + (long long)offsetof(struct ldlm_lock_desc, l_granted_mode)); + LASSERTF((int)sizeof(((struct ldlm_lock_desc *)0)->l_granted_mode) == 4, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_lock_desc *)0)->l_granted_mode)); + LASSERTF(offsetof(struct ldlm_lock_desc, l_policy_data) == 48, " found %lld\n", + (long long)offsetof(struct ldlm_lock_desc, l_policy_data)); + LASSERTF((int)sizeof(((struct ldlm_lock_desc *)0)->l_policy_data) == 32, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_lock_desc *)0)->l_policy_data)); /* Checks for struct ldlm_request */ - LASSERT((int)sizeof(struct ldlm_request) == 104); - LASSERT(offsetof(struct ldlm_request, lock_flags) == 0); - LASSERT((int)sizeof(((struct ldlm_request *)0)->lock_flags) == 4); - LASSERT(offsetof(struct ldlm_request, lock_desc) == 8); - LASSERT((int)sizeof(((struct ldlm_request *)0)->lock_desc) == 80); - LASSERT(offsetof(struct ldlm_request, lock_handle1) == 88); - LASSERT((int)sizeof(((struct ldlm_request *)0)->lock_handle1) == 8); - LASSERT(offsetof(struct ldlm_request, lock_handle2) == 96); - LASSERT((int)sizeof(((struct ldlm_request *)0)->lock_handle2) == 8); + LASSERTF((int)sizeof(struct ldlm_request) == 104, " found %lld\n", + (long long)(int)sizeof(struct ldlm_request)); + LASSERTF(offsetof(struct ldlm_request, lock_flags) == 0, " found %lld\n", + (long long)offsetof(struct ldlm_request, lock_flags)); + LASSERTF((int)sizeof(((struct ldlm_request *)0)->lock_flags) == 4, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_request *)0)->lock_flags)); + LASSERTF(offsetof(struct ldlm_request, lock_desc) == 8, " found %lld\n", + (long long)offsetof(struct ldlm_request, lock_desc)); + LASSERTF((int)sizeof(((struct ldlm_request *)0)->lock_desc) == 80, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_request *)0)->lock_desc)); + LASSERTF(offsetof(struct ldlm_request, lock_handle1) == 88, " found %lld\n", + (long long)offsetof(struct ldlm_request, lock_handle1)); + LASSERTF((int)sizeof(((struct ldlm_request *)0)->lock_handle1) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_request *)0)->lock_handle1)); + LASSERTF(offsetof(struct ldlm_request, lock_handle2) == 96, " found %lld\n", + (long long)offsetof(struct ldlm_request, lock_handle2)); + LASSERTF((int)sizeof(((struct ldlm_request *)0)->lock_handle2) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_request *)0)->lock_handle2)); /* Checks for struct ldlm_reply */ - LASSERT((int)sizeof(struct ldlm_reply) == 108); - LASSERT(offsetof(struct ldlm_reply, lock_flags) == 0); - LASSERT((int)sizeof(((struct ldlm_reply *)0)->lock_flags) == 4); - LASSERT(offsetof(struct ldlm_request, lock_desc) == 8); - LASSERT((int)sizeof(((struct ldlm_request *)0)->lock_desc) == 80); - LASSERT(offsetof(struct ldlm_reply, lock_handle) == 84); - LASSERT((int)sizeof(((struct ldlm_reply *)0)->lock_handle) == 8); - LASSERT(offsetof(struct ldlm_reply, lock_policy_res1) == 92); - LASSERT((int)sizeof(((struct ldlm_reply *)0)->lock_policy_res1) == 8); - LASSERT(offsetof(struct ldlm_reply, lock_policy_res2) == 100); - LASSERT((int)sizeof(((struct ldlm_reply *)0)->lock_policy_res2) == 8); + LASSERTF((int)sizeof(struct ldlm_reply) == 112, " found %lld\n", + (long long)(int)sizeof(struct ldlm_reply)); + LASSERTF(offsetof(struct ldlm_reply, lock_flags) == 0, " found %lld\n", + (long long)offsetof(struct ldlm_reply, lock_flags)); + LASSERTF((int)sizeof(((struct ldlm_reply *)0)->lock_flags) == 4, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_reply *)0)->lock_flags)); + LASSERTF(offsetof(struct ldlm_request, lock_desc) == 8, " found %lld\n", + (long long)offsetof(struct ldlm_request, lock_desc)); + LASSERTF((int)sizeof(((struct ldlm_request *)0)->lock_desc) == 80, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_request *)0)->lock_desc)); + LASSERTF(offsetof(struct ldlm_reply, lock_handle) == 88, " found %lld\n", + (long long)offsetof(struct ldlm_reply, lock_handle)); + LASSERTF((int)sizeof(((struct ldlm_reply *)0)->lock_handle) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_reply *)0)->lock_handle)); + LASSERTF(offsetof(struct ldlm_reply, lock_policy_res1) == 96, " found %lld\n", + (long long)offsetof(struct ldlm_reply, lock_policy_res1)); + LASSERTF((int)sizeof(((struct ldlm_reply *)0)->lock_policy_res1) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_reply *)0)->lock_policy_res1)); + LASSERTF(offsetof(struct ldlm_reply, lock_policy_res2) == 104, " found %lld\n", + (long long)offsetof(struct ldlm_reply, lock_policy_res2)); + LASSERTF((int)sizeof(((struct ldlm_reply *)0)->lock_policy_res2) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_reply *)0)->lock_policy_res2)); + + /* Checks for struct ost_lvb */ + LASSERTF((int)sizeof(struct ost_lvb) == 40, " found %lld\n", + (long long)(int)sizeof(struct ost_lvb)); + LASSERTF(offsetof(struct ost_lvb, lvb_size) == 0, " found %lld\n", + (long long)offsetof(struct ost_lvb, lvb_size)); + LASSERTF((int)sizeof(((struct ost_lvb *)0)->lvb_size) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ost_lvb *)0)->lvb_size)); + LASSERTF(offsetof(struct ost_lvb, lvb_mtime) == 8, " found %lld\n", + (long long)offsetof(struct ost_lvb, lvb_mtime)); + LASSERTF((int)sizeof(((struct ost_lvb *)0)->lvb_mtime) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ost_lvb *)0)->lvb_mtime)); + LASSERTF(offsetof(struct ost_lvb, lvb_atime) == 16, " found %lld\n", + (long long)offsetof(struct ost_lvb, lvb_atime)); + LASSERTF((int)sizeof(((struct ost_lvb *)0)->lvb_atime) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ost_lvb *)0)->lvb_atime)); + LASSERTF(offsetof(struct ost_lvb, lvb_ctime) == 24, " found %lld\n", + (long long)offsetof(struct ost_lvb, lvb_ctime)); + LASSERTF((int)sizeof(((struct ost_lvb *)0)->lvb_ctime) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ost_lvb *)0)->lvb_ctime)); + LASSERTF(offsetof(struct ost_lvb, lvb_blocks) == 32, " found %lld\n", + (long long)offsetof(struct ost_lvb, lvb_blocks)); + LASSERTF((int)sizeof(((struct ost_lvb *)0)->lvb_blocks) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ost_lvb *)0)->lvb_blocks)); /* Checks for struct ptlbd_op */ - LASSERT((int)sizeof(struct ptlbd_op) == 12); - LASSERT(offsetof(struct ptlbd_op, op_cmd) == 0); - LASSERT((int)sizeof(((struct ptlbd_op *)0)->op_cmd) == 2); - LASSERT(offsetof(struct ptlbd_op, op_lun) == 2); - LASSERT((int)sizeof(((struct ptlbd_op *)0)->op_lun) == 2); - LASSERT(offsetof(struct ptlbd_op, op_niob_cnt) == 4); - LASSERT((int)sizeof(((struct ptlbd_op *)0)->op_niob_cnt) == 2); - LASSERT(offsetof(struct ptlbd_op, op__padding) == 6); - LASSERT((int)sizeof(((struct ptlbd_op *)0)->op__padding) == 2); - LASSERT(offsetof(struct ptlbd_op, op_block_cnt) == 8); - LASSERT((int)sizeof(((struct ptlbd_op *)0)->op_block_cnt) == 4); + LASSERTF((int)sizeof(struct ptlbd_op) == 12, " found %lld\n", + (long long)(int)sizeof(struct ptlbd_op)); + LASSERTF(offsetof(struct ptlbd_op, op_cmd) == 0, " found %lld\n", + (long long)offsetof(struct ptlbd_op, op_cmd)); + LASSERTF((int)sizeof(((struct ptlbd_op *)0)->op_cmd) == 2, " found %lld\n", + (long long)(int)sizeof(((struct ptlbd_op *)0)->op_cmd)); + LASSERTF(offsetof(struct ptlbd_op, op_lun) == 2, " found %lld\n", + (long long)offsetof(struct ptlbd_op, op_lun)); + LASSERTF((int)sizeof(((struct ptlbd_op *)0)->op_lun) == 2, " found %lld\n", + (long long)(int)sizeof(((struct ptlbd_op *)0)->op_lun)); + LASSERTF(offsetof(struct ptlbd_op, op_niob_cnt) == 4, " found %lld\n", + (long long)offsetof(struct ptlbd_op, op_niob_cnt)); + LASSERTF((int)sizeof(((struct ptlbd_op *)0)->op_niob_cnt) == 2, " found %lld\n", + (long long)(int)sizeof(((struct ptlbd_op *)0)->op_niob_cnt)); + LASSERTF(offsetof(struct ptlbd_op, op__padding) == 6, " found %lld\n", + (long long)offsetof(struct ptlbd_op, op__padding)); + LASSERTF((int)sizeof(((struct ptlbd_op *)0)->op__padding) == 2, " found %lld\n", + (long long)(int)sizeof(((struct ptlbd_op *)0)->op__padding)); + LASSERTF(offsetof(struct ptlbd_op, op_block_cnt) == 8, " found %lld\n", + (long long)offsetof(struct ptlbd_op, op_block_cnt)); + LASSERTF((int)sizeof(((struct ptlbd_op *)0)->op_block_cnt) == 4, " found %lld\n", + (long long)(int)sizeof(((struct ptlbd_op *)0)->op_block_cnt)); /* Checks for struct ptlbd_niob */ - LASSERT((int)sizeof(struct ptlbd_niob) == 24); - LASSERT(offsetof(struct ptlbd_niob, n_xid) == 0); - LASSERT((int)sizeof(((struct ptlbd_niob *)0)->n_xid) == 8); - LASSERT(offsetof(struct ptlbd_niob, n_block_nr) == 8); - LASSERT((int)sizeof(((struct ptlbd_niob *)0)->n_block_nr) == 8); - LASSERT(offsetof(struct ptlbd_niob, n_offset) == 16); - LASSERT((int)sizeof(((struct ptlbd_niob *)0)->n_offset) == 4); - LASSERT(offsetof(struct ptlbd_niob, n_length) == 20); - LASSERT((int)sizeof(((struct ptlbd_niob *)0)->n_length) == 4); + LASSERTF((int)sizeof(struct ptlbd_niob) == 24, " found %lld\n", + (long long)(int)sizeof(struct ptlbd_niob)); + LASSERTF(offsetof(struct ptlbd_niob, n_xid) == 0, " found %lld\n", + (long long)offsetof(struct ptlbd_niob, n_xid)); + LASSERTF((int)sizeof(((struct ptlbd_niob *)0)->n_xid) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ptlbd_niob *)0)->n_xid)); + LASSERTF(offsetof(struct ptlbd_niob, n_block_nr) == 8, " found %lld\n", + (long long)offsetof(struct ptlbd_niob, n_block_nr)); + LASSERTF((int)sizeof(((struct ptlbd_niob *)0)->n_block_nr) == 8, " found %lld\n", + (long long)(int)sizeof(((struct ptlbd_niob *)0)->n_block_nr)); + LASSERTF(offsetof(struct ptlbd_niob, n_offset) == 16, " found %lld\n", + (long long)offsetof(struct ptlbd_niob, n_offset)); + LASSERTF((int)sizeof(((struct ptlbd_niob *)0)->n_offset) == 4, " found %lld\n", + (long long)(int)sizeof(((struct ptlbd_niob *)0)->n_offset)); + LASSERTF(offsetof(struct ptlbd_niob, n_length) == 20, " found %lld\n", + (long long)offsetof(struct ptlbd_niob, n_length)); + LASSERTF((int)sizeof(((struct ptlbd_niob *)0)->n_length) == 4, " found %lld\n", + (long long)(int)sizeof(((struct ptlbd_niob *)0)->n_length)); /* Checks for struct ptlbd_rsp */ - LASSERT((int)sizeof(struct ptlbd_rsp) == 4); - LASSERT(offsetof(struct ptlbd_rsp, r_status) == 0); - LASSERT((int)sizeof(((struct ptlbd_rsp *)0)->r_status) == 2); - LASSERT(offsetof(struct ptlbd_rsp, r_error_cnt) == 2); - LASSERT((int)sizeof(((struct ptlbd_rsp *)0)->r_error_cnt) == 2); + LASSERTF((int)sizeof(struct ptlbd_rsp) == 4, " found %lld\n", + (long long)(int)sizeof(struct ptlbd_rsp)); + LASSERTF(offsetof(struct ptlbd_rsp, r_status) == 0, " found %lld\n", + (long long)offsetof(struct ptlbd_rsp, r_status)); + LASSERTF((int)sizeof(((struct ptlbd_rsp *)0)->r_status) == 2, " found %lld\n", + (long long)(int)sizeof(((struct ptlbd_rsp *)0)->r_status)); + LASSERTF(offsetof(struct ptlbd_rsp, r_error_cnt) == 2, " found %lld\n", + (long long)offsetof(struct ptlbd_rsp, r_error_cnt)); + LASSERTF((int)sizeof(((struct ptlbd_rsp *)0)->r_error_cnt) == 2, " found %lld\n", + (long long)(int)sizeof(((struct ptlbd_rsp *)0)->r_error_cnt)); /* Checks for struct llog_logid */ - LASSERT((int)sizeof(struct llog_logid) == 20); - LASSERT(offsetof(struct llog_logid, lgl_oid) == 0); - LASSERT((int)sizeof(((struct llog_logid *)0)->lgl_oid) == 8); - LASSERT(offsetof(struct llog_logid, lgl_ogr) == 8); - LASSERT((int)sizeof(((struct llog_logid *)0)->lgl_ogr) == 8); - LASSERT(offsetof(struct llog_logid, lgl_ogen) == 16); - LASSERT((int)sizeof(((struct llog_logid *)0)->lgl_ogen) == 4); - LASSERT(OST_SZ_REC == 274730752); - LASSERT(OST_RAID1_REC == 274731008); - LASSERT(MDS_UNLINK_REC == 274801668); - LASSERT(OBD_CFG_REC == 274857984); - LASSERT(PTL_CFG_REC == 274923520); - LASSERT(LLOG_GEN_REC == 274989056); - LASSERT(LLOG_HDR_MAGIC == 275010873); - LASSERT(LLOG_LOGID_MAGIC == 275010874); + LASSERTF((int)sizeof(struct llog_logid) == 20, " found %lld\n", + (long long)(int)sizeof(struct llog_logid)); + LASSERTF(offsetof(struct llog_logid, lgl_oid) == 0, " found %lld\n", + (long long)offsetof(struct llog_logid, lgl_oid)); + LASSERTF((int)sizeof(((struct llog_logid *)0)->lgl_oid) == 8, " found %lld\n", + (long long)(int)sizeof(((struct llog_logid *)0)->lgl_oid)); + LASSERTF(offsetof(struct llog_logid, lgl_ogr) == 8, " found %lld\n", + (long long)offsetof(struct llog_logid, lgl_ogr)); + LASSERTF((int)sizeof(((struct llog_logid *)0)->lgl_ogr) == 8, " found %lld\n", + (long long)(int)sizeof(((struct llog_logid *)0)->lgl_ogr)); + LASSERTF(offsetof(struct llog_logid, lgl_ogen) == 16, " found %lld\n", + (long long)offsetof(struct llog_logid, lgl_ogen)); + LASSERTF((int)sizeof(((struct llog_logid *)0)->lgl_ogen) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_logid *)0)->lgl_ogen)); + LASSERTF(OST_SZ_REC == 274730752, " found %lld\n", + (long long)OST_SZ_REC); + LASSERTF(OST_RAID1_REC == 274731008, " found %lld\n", + (long long)OST_RAID1_REC); + LASSERTF(MDS_UNLINK_REC == 274801668, " found %lld\n", + (long long)MDS_UNLINK_REC); + LASSERTF(OBD_CFG_REC == 274857984, " found %lld\n", + (long long)OBD_CFG_REC); + LASSERTF(PTL_CFG_REC == 274923520, " found %lld\n", + (long long)PTL_CFG_REC); + LASSERTF(LLOG_GEN_REC == 274989056, " found %lld\n", + (long long)LLOG_GEN_REC); + LASSERTF(LLOG_HDR_MAGIC == 275010873, " found %lld\n", + (long long)LLOG_HDR_MAGIC); + LASSERTF(LLOG_LOGID_MAGIC == 275010875, " found %lld\n", + (long long)LLOG_LOGID_MAGIC); + + /* Checks for struct llog_catid */ + LASSERTF((int)sizeof(struct llog_catid) == 32, " found %lld\n", + (long long)(int)sizeof(struct llog_catid)); + LASSERTF(offsetof(struct llog_catid, lci_logid) == 0, " found %lld\n", + (long long)offsetof(struct llog_catid, lci_logid)); + LASSERTF((int)sizeof(((struct llog_catid *)0)->lci_logid) == 20, " found %lld\n", + (long long)(int)sizeof(((struct llog_catid *)0)->lci_logid)); /* Checks for struct llog_rec_hdr */ - LASSERT((int)sizeof(struct llog_rec_hdr) == 16); - LASSERT(offsetof(struct llog_rec_hdr, lrh_len) == 0); - LASSERT((int)sizeof(((struct llog_rec_hdr *)0)->lrh_len) == 4); - LASSERT(offsetof(struct llog_rec_hdr, lrh_index) == 4); - LASSERT((int)sizeof(((struct llog_rec_hdr *)0)->lrh_index) == 4); - LASSERT(offsetof(struct llog_rec_hdr, lrh_type) == 8); - LASSERT((int)sizeof(((struct llog_rec_hdr *)0)->lrh_type) == 4); + LASSERTF((int)sizeof(struct llog_rec_hdr) == 16, " found %lld\n", + (long long)(int)sizeof(struct llog_rec_hdr)); + LASSERTF(offsetof(struct llog_rec_hdr, lrh_len) == 0, " found %lld\n", + (long long)offsetof(struct llog_rec_hdr, lrh_len)); + LASSERTF((int)sizeof(((struct llog_rec_hdr *)0)->lrh_len) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_rec_hdr *)0)->lrh_len)); + LASSERTF(offsetof(struct llog_rec_hdr, lrh_index) == 4, " found %lld\n", + (long long)offsetof(struct llog_rec_hdr, lrh_index)); + LASSERTF((int)sizeof(((struct llog_rec_hdr *)0)->lrh_index) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_rec_hdr *)0)->lrh_index)); + LASSERTF(offsetof(struct llog_rec_hdr, lrh_type) == 8, " found %lld\n", + (long long)offsetof(struct llog_rec_hdr, lrh_type)); + LASSERTF((int)sizeof(((struct llog_rec_hdr *)0)->lrh_type) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_rec_hdr *)0)->lrh_type)); /* Checks for struct llog_rec_tail */ - LASSERT((int)sizeof(struct llog_rec_tail) == 8); - LASSERT(offsetof(struct llog_rec_tail, lrt_len) == 0); - LASSERT((int)sizeof(((struct llog_rec_tail *)0)->lrt_len) == 4); - LASSERT(offsetof(struct llog_rec_tail, lrt_index) == 4); - LASSERT((int)sizeof(((struct llog_rec_tail *)0)->lrt_index) == 4); + LASSERTF((int)sizeof(struct llog_rec_tail) == 8, " found %lld\n", + (long long)(int)sizeof(struct llog_rec_tail)); + LASSERTF(offsetof(struct llog_rec_tail, lrt_len) == 0, " found %lld\n", + (long long)offsetof(struct llog_rec_tail, lrt_len)); + LASSERTF((int)sizeof(((struct llog_rec_tail *)0)->lrt_len) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_rec_tail *)0)->lrt_len)); + LASSERTF(offsetof(struct llog_rec_tail, lrt_index) == 4, " found %lld\n", + (long long)offsetof(struct llog_rec_tail, lrt_index)); + LASSERTF((int)sizeof(((struct llog_rec_tail *)0)->lrt_index) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_rec_tail *)0)->lrt_index)); /* Checks for struct llog_logid_rec */ - LASSERT((int)sizeof(struct llog_logid_rec) == 48); - LASSERT(offsetof(struct llog_logid_rec, lid_hdr) == 0); - LASSERT((int)sizeof(((struct llog_logid_rec *)0)->lid_hdr) == 16); - LASSERT(offsetof(struct llog_logid_rec, lid_id) == 16); - LASSERT((int)sizeof(((struct llog_logid_rec *)0)->lid_id) == 20); - LASSERT(offsetof(struct llog_logid_rec, lid_tail) == 40); - LASSERT((int)sizeof(((struct llog_logid_rec *)0)->lid_tail) == 8); + LASSERTF((int)sizeof(struct llog_logid_rec) == 64, " found %lld\n", + (long long)(int)sizeof(struct llog_logid_rec)); + LASSERTF(offsetof(struct llog_logid_rec, lid_hdr) == 0, " found %lld\n", + (long long)offsetof(struct llog_logid_rec, lid_hdr)); + LASSERTF((int)sizeof(((struct llog_logid_rec *)0)->lid_hdr) == 16, " found %lld\n", + (long long)(int)sizeof(((struct llog_logid_rec *)0)->lid_hdr)); + LASSERTF(offsetof(struct llog_logid_rec, lid_id) == 16, " found %lld\n", + (long long)offsetof(struct llog_logid_rec, lid_id)); + LASSERTF((int)sizeof(((struct llog_logid_rec *)0)->lid_id) == 20, " found %lld\n", + (long long)(int)sizeof(((struct llog_logid_rec *)0)->lid_id)); + LASSERTF(offsetof(struct llog_logid_rec, lid_tail) == 56, " found %lld\n", + (long long)offsetof(struct llog_logid_rec, lid_tail)); + LASSERTF((int)sizeof(((struct llog_logid_rec *)0)->lid_tail) == 8, " found %lld\n", + (long long)(int)sizeof(((struct llog_logid_rec *)0)->lid_tail)); /* Checks for struct llog_create_rec */ - LASSERT((int)sizeof(struct llog_create_rec) == 56); - LASSERT(offsetof(struct llog_create_rec, lcr_hdr) == 0); - LASSERT((int)sizeof(((struct llog_create_rec *)0)->lcr_hdr) == 16); - LASSERT(offsetof(struct llog_create_rec, lcr_fid) == 16); - LASSERT((int)sizeof(((struct llog_create_rec *)0)->lcr_fid) == 16); - LASSERT(offsetof(struct llog_create_rec, lcr_oid) == 32); - LASSERT((int)sizeof(((struct llog_create_rec *)0)->lcr_oid) == 8); - LASSERT(offsetof(struct llog_create_rec, lcr_ogen) == 40); - LASSERT((int)sizeof(((struct llog_create_rec *)0)->lcr_ogen) == 4); + LASSERTF((int)sizeof(struct llog_create_rec) == 56, " found %lld\n", + (long long)(int)sizeof(struct llog_create_rec)); + LASSERTF(offsetof(struct llog_create_rec, lcr_hdr) == 0, " found %lld\n", + (long long)offsetof(struct llog_create_rec, lcr_hdr)); + LASSERTF((int)sizeof(((struct llog_create_rec *)0)->lcr_hdr) == 16, " found %lld\n", + (long long)(int)sizeof(((struct llog_create_rec *)0)->lcr_hdr)); + LASSERTF(offsetof(struct llog_create_rec, lcr_fid) == 16, " found %lld\n", + (long long)offsetof(struct llog_create_rec, lcr_fid)); + LASSERTF((int)sizeof(((struct llog_create_rec *)0)->lcr_fid) == 16, " found %lld\n", + (long long)(int)sizeof(((struct llog_create_rec *)0)->lcr_fid)); + LASSERTF(offsetof(struct llog_create_rec, lcr_oid) == 32, " found %lld\n", + (long long)offsetof(struct llog_create_rec, lcr_oid)); + LASSERTF((int)sizeof(((struct llog_create_rec *)0)->lcr_oid) == 8, " found %lld\n", + (long long)(int)sizeof(((struct llog_create_rec *)0)->lcr_oid)); + LASSERTF(offsetof(struct llog_create_rec, lcr_ogen) == 40, " found %lld\n", + (long long)offsetof(struct llog_create_rec, lcr_ogen)); + LASSERTF((int)sizeof(((struct llog_create_rec *)0)->lcr_ogen) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_create_rec *)0)->lcr_ogen)); /* Checks for struct llog_orphan_rec */ - LASSERT((int)sizeof(struct llog_orphan_rec) == 40); - LASSERT(offsetof(struct llog_orphan_rec, lor_hdr) == 0); - LASSERT((int)sizeof(((struct llog_orphan_rec *)0)->lor_hdr) == 16); - LASSERT(offsetof(struct llog_orphan_rec, lor_oid) == 16); - LASSERT((int)sizeof(((struct llog_orphan_rec *)0)->lor_oid) == 8); - LASSERT(offsetof(struct llog_orphan_rec, lor_ogen) == 24); - LASSERT((int)sizeof(((struct llog_orphan_rec *)0)->lor_ogen) == 4); - LASSERT(offsetof(struct llog_orphan_rec, lor_tail) == 32); - LASSERT((int)sizeof(((struct llog_orphan_rec *)0)->lor_tail) == 8); + LASSERTF((int)sizeof(struct llog_orphan_rec) == 40, " found %lld\n", + (long long)(int)sizeof(struct llog_orphan_rec)); + LASSERTF(offsetof(struct llog_orphan_rec, lor_hdr) == 0, " found %lld\n", + (long long)offsetof(struct llog_orphan_rec, lor_hdr)); + LASSERTF((int)sizeof(((struct llog_orphan_rec *)0)->lor_hdr) == 16, " found %lld\n", + (long long)(int)sizeof(((struct llog_orphan_rec *)0)->lor_hdr)); + LASSERTF(offsetof(struct llog_orphan_rec, lor_oid) == 16, " found %lld\n", + (long long)offsetof(struct llog_orphan_rec, lor_oid)); + LASSERTF((int)sizeof(((struct llog_orphan_rec *)0)->lor_oid) == 8, " found %lld\n", + (long long)(int)sizeof(((struct llog_orphan_rec *)0)->lor_oid)); + LASSERTF(offsetof(struct llog_orphan_rec, lor_ogen) == 24, " found %lld\n", + (long long)offsetof(struct llog_orphan_rec, lor_ogen)); + LASSERTF((int)sizeof(((struct llog_orphan_rec *)0)->lor_ogen) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_orphan_rec *)0)->lor_ogen)); + LASSERTF(offsetof(struct llog_orphan_rec, lor_tail) == 32, " found %lld\n", + (long long)offsetof(struct llog_orphan_rec, lor_tail)); + LASSERTF((int)sizeof(((struct llog_orphan_rec *)0)->lor_tail) == 8, " found %lld\n", + (long long)(int)sizeof(((struct llog_orphan_rec *)0)->lor_tail)); /* Checks for struct llog_unlink_rec */ - LASSERT((int)sizeof(struct llog_unlink_rec) == 40); - LASSERT(offsetof(struct llog_unlink_rec, lur_hdr) == 0); - LASSERT((int)sizeof(((struct llog_unlink_rec *)0)->lur_hdr) == 16); - LASSERT(offsetof(struct llog_unlink_rec, lur_oid) == 16); - LASSERT((int)sizeof(((struct llog_unlink_rec *)0)->lur_oid) == 8); - LASSERT(offsetof(struct llog_unlink_rec, lur_ogen) == 24); - LASSERT((int)sizeof(((struct llog_unlink_rec *)0)->lur_ogen) == 4); - LASSERT(offsetof(struct llog_unlink_rec, lur_tail) == 32); - LASSERT((int)sizeof(((struct llog_unlink_rec *)0)->lur_tail) == 8); + LASSERTF((int)sizeof(struct llog_unlink_rec) == 40, " found %lld\n", + (long long)(int)sizeof(struct llog_unlink_rec)); + LASSERTF(offsetof(struct llog_unlink_rec, lur_hdr) == 0, " found %lld\n", + (long long)offsetof(struct llog_unlink_rec, lur_hdr)); + LASSERTF((int)sizeof(((struct llog_unlink_rec *)0)->lur_hdr) == 16, " found %lld\n", + (long long)(int)sizeof(((struct llog_unlink_rec *)0)->lur_hdr)); + LASSERTF(offsetof(struct llog_unlink_rec, lur_oid) == 16, " found %lld\n", + (long long)offsetof(struct llog_unlink_rec, lur_oid)); + LASSERTF((int)sizeof(((struct llog_unlink_rec *)0)->lur_oid) == 8, " found %lld\n", + (long long)(int)sizeof(((struct llog_unlink_rec *)0)->lur_oid)); + LASSERTF(offsetof(struct llog_unlink_rec, lur_ogen) == 24, " found %lld\n", + (long long)offsetof(struct llog_unlink_rec, lur_ogen)); + LASSERTF((int)sizeof(((struct llog_unlink_rec *)0)->lur_ogen) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_unlink_rec *)0)->lur_ogen)); + LASSERTF(offsetof(struct llog_unlink_rec, lur_tail) == 32, " found %lld\n", + (long long)offsetof(struct llog_unlink_rec, lur_tail)); + LASSERTF((int)sizeof(((struct llog_unlink_rec *)0)->lur_tail) == 8, " found %lld\n", + (long long)(int)sizeof(((struct llog_unlink_rec *)0)->lur_tail)); /* Checks for struct llog_size_change_rec */ - LASSERT((int)sizeof(struct llog_size_change_rec) == 48); - LASSERT(offsetof(struct llog_size_change_rec, lsc_hdr) == 0); - LASSERT((int)sizeof(((struct llog_size_change_rec *)0)->lsc_hdr) == 16); - LASSERT(offsetof(struct llog_size_change_rec, lsc_fid) == 16); - LASSERT((int)sizeof(((struct llog_size_change_rec *)0)->lsc_fid) == 16); - LASSERT(offsetof(struct llog_size_change_rec, lsc_io_epoch) == 32); - LASSERT((int)sizeof(((struct llog_size_change_rec *)0)->lsc_io_epoch) == 4); - LASSERT(offsetof(struct llog_size_change_rec, lsc_tail) == 40); - LASSERT((int)sizeof(((struct llog_size_change_rec *)0)->lsc_tail) == 8); + LASSERTF((int)sizeof(struct llog_size_change_rec) == 48, " found %lld\n", + (long long)(int)sizeof(struct llog_size_change_rec)); + LASSERTF(offsetof(struct llog_size_change_rec, lsc_hdr) == 0, " found %lld\n", + (long long)offsetof(struct llog_size_change_rec, lsc_hdr)); + LASSERTF((int)sizeof(((struct llog_size_change_rec *)0)->lsc_hdr) == 16, " found %lld\n", + (long long)(int)sizeof(((struct llog_size_change_rec *)0)->lsc_hdr)); + LASSERTF(offsetof(struct llog_size_change_rec, lsc_fid) == 16, " found %lld\n", + (long long)offsetof(struct llog_size_change_rec, lsc_fid)); + LASSERTF((int)sizeof(((struct llog_size_change_rec *)0)->lsc_fid) == 16, " found %lld\n", + (long long)(int)sizeof(((struct llog_size_change_rec *)0)->lsc_fid)); + LASSERTF(offsetof(struct llog_size_change_rec, lsc_io_epoch) == 32, " found %lld\n", + (long long)offsetof(struct llog_size_change_rec, lsc_io_epoch)); + LASSERTF((int)sizeof(((struct llog_size_change_rec *)0)->lsc_io_epoch) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_size_change_rec *)0)->lsc_io_epoch)); + LASSERTF(offsetof(struct llog_size_change_rec, lsc_tail) == 40, " found %lld\n", + (long long)offsetof(struct llog_size_change_rec, lsc_tail)); + LASSERTF((int)sizeof(((struct llog_size_change_rec *)0)->lsc_tail) == 8, " found %lld\n", + (long long)(int)sizeof(((struct llog_size_change_rec *)0)->lsc_tail)); /* Checks for struct llog_gen */ - LASSERT((int)sizeof(struct llog_gen) == 16); - LASSERT(offsetof(struct llog_gen, mnt_cnt) == 0); - LASSERT((int)sizeof(((struct llog_gen *)0)->mnt_cnt) == 8); - LASSERT(offsetof(struct llog_gen, conn_cnt) == 8); - LASSERT((int)sizeof(((struct llog_gen *)0)->conn_cnt) == 8); + LASSERTF((int)sizeof(struct llog_gen) == 16, " found %lld\n", + (long long)(int)sizeof(struct llog_gen)); + LASSERTF(offsetof(struct llog_gen, mnt_cnt) == 0, " found %lld\n", + (long long)offsetof(struct llog_gen, mnt_cnt)); + LASSERTF((int)sizeof(((struct llog_gen *)0)->mnt_cnt) == 8, " found %lld\n", + (long long)(int)sizeof(((struct llog_gen *)0)->mnt_cnt)); + LASSERTF(offsetof(struct llog_gen, conn_cnt) == 8, " found %lld\n", + (long long)offsetof(struct llog_gen, conn_cnt)); + LASSERTF((int)sizeof(((struct llog_gen *)0)->conn_cnt) == 8, " found %lld\n", + (long long)(int)sizeof(((struct llog_gen *)0)->conn_cnt)); /* Checks for struct llog_gen_rec */ - LASSERT((int)sizeof(struct llog_gen_rec) == 40); - LASSERT(offsetof(struct llog_gen_rec, lgr_hdr) == 0); - LASSERT((int)sizeof(((struct llog_gen_rec *)0)->lgr_hdr) == 16); - LASSERT(offsetof(struct llog_gen_rec, lgr_gen) == 16); - LASSERT((int)sizeof(((struct llog_gen_rec *)0)->lgr_gen) == 16); - LASSERT(offsetof(struct llog_gen_rec, lgr_tail) == 32); - LASSERT((int)sizeof(((struct llog_gen_rec *)0)->lgr_tail) == 8); + LASSERTF((int)sizeof(struct llog_gen_rec) == 40, " found %lld\n", + (long long)(int)sizeof(struct llog_gen_rec)); + LASSERTF(offsetof(struct llog_gen_rec, lgr_hdr) == 0, " found %lld\n", + (long long)offsetof(struct llog_gen_rec, lgr_hdr)); + LASSERTF((int)sizeof(((struct llog_gen_rec *)0)->lgr_hdr) == 16, " found %lld\n", + (long long)(int)sizeof(((struct llog_gen_rec *)0)->lgr_hdr)); + LASSERTF(offsetof(struct llog_gen_rec, lgr_gen) == 16, " found %lld\n", + (long long)offsetof(struct llog_gen_rec, lgr_gen)); + LASSERTF((int)sizeof(((struct llog_gen_rec *)0)->lgr_gen) == 16, " found %lld\n", + (long long)(int)sizeof(((struct llog_gen_rec *)0)->lgr_gen)); + LASSERTF(offsetof(struct llog_gen_rec, lgr_tail) == 32, " found %lld\n", + (long long)offsetof(struct llog_gen_rec, lgr_tail)); + LASSERTF((int)sizeof(((struct llog_gen_rec *)0)->lgr_tail) == 8, " found %lld\n", + (long long)(int)sizeof(((struct llog_gen_rec *)0)->lgr_tail)); /* Checks for struct llog_log_hdr */ - LASSERT((int)sizeof(struct llog_log_hdr) == 4096); - LASSERT(offsetof(struct llog_log_hdr, llh_hdr) == 0); - LASSERT((int)sizeof(((struct llog_log_hdr *)0)->llh_hdr) == 16); - LASSERT(offsetof(struct llog_log_hdr, llh_timestamp) == 16); - LASSERT((int)sizeof(((struct llog_log_hdr *)0)->llh_timestamp) == 8); - LASSERT(offsetof(struct llog_log_hdr, llh_count) == 24); - LASSERT((int)sizeof(((struct llog_log_hdr *)0)->llh_count) == 4); - LASSERT(offsetof(struct llog_log_hdr, llh_bitmap_offset) == 28); - LASSERT((int)sizeof(((struct llog_log_hdr *)0)->llh_bitmap_offset) == 4); - LASSERT(offsetof(struct llog_log_hdr, llh_size) == 32); - LASSERT((int)sizeof(((struct llog_log_hdr *)0)->llh_size) == 4); - LASSERT(offsetof(struct llog_log_hdr, llh_flags) == 36); - LASSERT((int)sizeof(((struct llog_log_hdr *)0)->llh_flags) == 4); - LASSERT(offsetof(struct llog_log_hdr, llh_cat_idx) == 40); - LASSERT((int)sizeof(((struct llog_log_hdr *)0)->llh_cat_idx) == 4); - LASSERT(offsetof(struct llog_log_hdr, llh_tgtuuid) == 44); - LASSERT((int)sizeof(((struct llog_log_hdr *)0)->llh_tgtuuid) == 40); - LASSERT(offsetof(struct llog_log_hdr, llh_reserved) == 84); - LASSERT((int)sizeof(((struct llog_log_hdr *)0)->llh_reserved) == 4); - LASSERT(offsetof(struct llog_log_hdr, llh_bitmap) == 88); - LASSERT((int)sizeof(((struct llog_log_hdr *)0)->llh_bitmap) == 4000); - LASSERT(offsetof(struct llog_log_hdr, llh_tail) == 4088); - LASSERT((int)sizeof(((struct llog_log_hdr *)0)->llh_tail) == 8); + LASSERTF((int)sizeof(struct llog_log_hdr) == 4096, " found %lld\n", + (long long)(int)sizeof(struct llog_log_hdr)); + LASSERTF(offsetof(struct llog_log_hdr, llh_hdr) == 0, " found %lld\n", + (long long)offsetof(struct llog_log_hdr, llh_hdr)); + LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_hdr) == 16, " found %lld\n", + (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_hdr)); + LASSERTF(offsetof(struct llog_log_hdr, llh_timestamp) == 16, " found %lld\n", + (long long)offsetof(struct llog_log_hdr, llh_timestamp)); + LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_timestamp) == 8, " found %lld\n", + (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_timestamp)); + LASSERTF(offsetof(struct llog_log_hdr, llh_count) == 24, " found %lld\n", + (long long)offsetof(struct llog_log_hdr, llh_count)); + LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_count) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_count)); + LASSERTF(offsetof(struct llog_log_hdr, llh_bitmap_offset) == 28, " found %lld\n", + (long long)offsetof(struct llog_log_hdr, llh_bitmap_offset)); + LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_bitmap_offset) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_bitmap_offset)); + LASSERTF(offsetof(struct llog_log_hdr, llh_size) == 32, " found %lld\n", + (long long)offsetof(struct llog_log_hdr, llh_size)); + LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_size) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_size)); + LASSERTF(offsetof(struct llog_log_hdr, llh_flags) == 36, " found %lld\n", + (long long)offsetof(struct llog_log_hdr, llh_flags)); + LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_flags) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_flags)); + LASSERTF(offsetof(struct llog_log_hdr, llh_cat_idx) == 40, " found %lld\n", + (long long)offsetof(struct llog_log_hdr, llh_cat_idx)); + LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_cat_idx) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_cat_idx)); + LASSERTF(offsetof(struct llog_log_hdr, llh_tgtuuid) == 44, " found %lld\n", + (long long)offsetof(struct llog_log_hdr, llh_tgtuuid)); + LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_tgtuuid) == 40, " found %lld\n", + (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_tgtuuid)); + LASSERTF(offsetof(struct llog_log_hdr, llh_reserved) == 84, " found %lld\n", + (long long)offsetof(struct llog_log_hdr, llh_reserved)); + LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_reserved) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_reserved)); + LASSERTF(offsetof(struct llog_log_hdr, llh_bitmap) == 88, " found %lld\n", + (long long)offsetof(struct llog_log_hdr, llh_bitmap)); + LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_bitmap) == 4000, " found %lld\n", + (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_bitmap)); + LASSERTF(offsetof(struct llog_log_hdr, llh_tail) == 4088, " found %lld\n", + (long long)offsetof(struct llog_log_hdr, llh_tail)); + LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_tail) == 8, " found %lld\n", + (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_tail)); /* Checks for struct llog_cookie */ - LASSERT((int)sizeof(struct llog_cookie) == 32); - LASSERT(offsetof(struct llog_cookie, lgc_lgl) == 0); - LASSERT((int)sizeof(((struct llog_cookie *)0)->lgc_lgl) == 20); - LASSERT(offsetof(struct llog_cookie, lgc_subsys) == 20); - LASSERT((int)sizeof(((struct llog_cookie *)0)->lgc_subsys) == 4); - LASSERT(offsetof(struct llog_cookie, lgc_index) == 24); - LASSERT((int)sizeof(((struct llog_cookie *)0)->lgc_index) == 4); + LASSERTF((int)sizeof(struct llog_cookie) == 32, " found %lld\n", + (long long)(int)sizeof(struct llog_cookie)); + LASSERTF(offsetof(struct llog_cookie, lgc_lgl) == 0, " found %lld\n", + (long long)offsetof(struct llog_cookie, lgc_lgl)); + LASSERTF((int)sizeof(((struct llog_cookie *)0)->lgc_lgl) == 20, " found %lld\n", + (long long)(int)sizeof(((struct llog_cookie *)0)->lgc_lgl)); + LASSERTF(offsetof(struct llog_cookie, lgc_subsys) == 20, " found %lld\n", + (long long)offsetof(struct llog_cookie, lgc_subsys)); + LASSERTF((int)sizeof(((struct llog_cookie *)0)->lgc_subsys) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_cookie *)0)->lgc_subsys)); + LASSERTF(offsetof(struct llog_cookie, lgc_index) == 24, " found %lld\n", + (long long)offsetof(struct llog_cookie, lgc_index)); + LASSERTF((int)sizeof(((struct llog_cookie *)0)->lgc_index) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_cookie *)0)->lgc_index)); /* Checks for struct llogd_body */ - LASSERT((int)sizeof(struct llogd_body) == 48); - LASSERT(offsetof(struct llogd_body, lgd_logid) == 0); - LASSERT((int)sizeof(((struct llogd_body *)0)->lgd_logid) == 20); - LASSERT(offsetof(struct llogd_body, lgd_ctxt_idx) == 20); - LASSERT((int)sizeof(((struct llogd_body *)0)->lgd_ctxt_idx) == 4); - LASSERT(offsetof(struct llogd_body, lgd_llh_flags) == 24); - LASSERT((int)sizeof(((struct llogd_body *)0)->lgd_llh_flags) == 4); - LASSERT(offsetof(struct llogd_body, lgd_index) == 28); - LASSERT((int)sizeof(((struct llogd_body *)0)->lgd_index) == 4); - LASSERT(offsetof(struct llogd_body, lgd_saved_index) == 32); - LASSERT((int)sizeof(((struct llogd_body *)0)->lgd_saved_index) == 4); - LASSERT(offsetof(struct llogd_body, lgd_len) == 36); - LASSERT((int)sizeof(((struct llogd_body *)0)->lgd_len) == 4); - LASSERT(offsetof(struct llogd_body, lgd_cur_offset) == 40); - LASSERT((int)sizeof(((struct llogd_body *)0)->lgd_cur_offset) == 8); - LASSERT(LLOG_ORIGIN_HANDLE_CREATE == 501); - LASSERT(LLOG_ORIGIN_HANDLE_NEXT_BLOCK == 502); - LASSERT(LLOG_ORIGIN_HANDLE_READ_HEADER == 503); - LASSERT(LLOG_ORIGIN_HANDLE_WRITE_REC == 504); - LASSERT(LLOG_ORIGIN_HANDLE_CLOSE == 505); - LASSERT(LLOG_ORIGIN_CONNECT == 506); - LASSERT(LLOG_CATINFO == 507); + LASSERTF((int)sizeof(struct llogd_body) == 48, " found %lld\n", + (long long)(int)sizeof(struct llogd_body)); + LASSERTF(offsetof(struct llogd_body, lgd_logid) == 0, " found %lld\n", + (long long)offsetof(struct llogd_body, lgd_logid)); + LASSERTF((int)sizeof(((struct llogd_body *)0)->lgd_logid) == 20, " found %lld\n", + (long long)(int)sizeof(((struct llogd_body *)0)->lgd_logid)); + LASSERTF(offsetof(struct llogd_body, lgd_ctxt_idx) == 20, " found %lld\n", + (long long)offsetof(struct llogd_body, lgd_ctxt_idx)); + LASSERTF((int)sizeof(((struct llogd_body *)0)->lgd_ctxt_idx) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llogd_body *)0)->lgd_ctxt_idx)); + LASSERTF(offsetof(struct llogd_body, lgd_llh_flags) == 24, " found %lld\n", + (long long)offsetof(struct llogd_body, lgd_llh_flags)); + LASSERTF((int)sizeof(((struct llogd_body *)0)->lgd_llh_flags) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llogd_body *)0)->lgd_llh_flags)); + LASSERTF(offsetof(struct llogd_body, lgd_index) == 28, " found %lld\n", + (long long)offsetof(struct llogd_body, lgd_index)); + LASSERTF((int)sizeof(((struct llogd_body *)0)->lgd_index) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llogd_body *)0)->lgd_index)); + LASSERTF(offsetof(struct llogd_body, lgd_saved_index) == 32, " found %lld\n", + (long long)offsetof(struct llogd_body, lgd_saved_index)); + LASSERTF((int)sizeof(((struct llogd_body *)0)->lgd_saved_index) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llogd_body *)0)->lgd_saved_index)); + LASSERTF(offsetof(struct llogd_body, lgd_len) == 36, " found %lld\n", + (long long)offsetof(struct llogd_body, lgd_len)); + LASSERTF((int)sizeof(((struct llogd_body *)0)->lgd_len) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llogd_body *)0)->lgd_len)); + LASSERTF(offsetof(struct llogd_body, lgd_cur_offset) == 40, " found %lld\n", + (long long)offsetof(struct llogd_body, lgd_cur_offset)); + LASSERTF((int)sizeof(((struct llogd_body *)0)->lgd_cur_offset) == 8, " found %lld\n", + (long long)(int)sizeof(((struct llogd_body *)0)->lgd_cur_offset)); + LASSERTF(LLOG_ORIGIN_HANDLE_CREATE == 501, " found %lld\n", + (long long)LLOG_ORIGIN_HANDLE_CREATE); + LASSERTF(LLOG_ORIGIN_HANDLE_NEXT_BLOCK == 502, " found %lld\n", + (long long)LLOG_ORIGIN_HANDLE_NEXT_BLOCK); + LASSERTF(LLOG_ORIGIN_HANDLE_READ_HEADER == 503, " found %lld\n", + (long long)LLOG_ORIGIN_HANDLE_READ_HEADER); + LASSERTF(LLOG_ORIGIN_HANDLE_WRITE_REC == 504, " found %lld\n", + (long long)LLOG_ORIGIN_HANDLE_WRITE_REC); + LASSERTF(LLOG_ORIGIN_HANDLE_CLOSE == 505, " found %lld\n", + (long long)LLOG_ORIGIN_HANDLE_CLOSE); + LASSERTF(LLOG_ORIGIN_CONNECT == 506, " found %lld\n", + (long long)LLOG_ORIGIN_CONNECT); + LASSERTF(LLOG_CATINFO == 507, " found %lld\n", + (long long)LLOG_CATINFO); /* Checks for struct llogd_conn_body */ - LASSERT((int)sizeof(struct llogd_conn_body) == 40); - LASSERT(offsetof(struct llogd_conn_body, lgdc_gen) == 0); - LASSERT((int)sizeof(((struct llogd_conn_body *)0)->lgdc_gen) == 16); - LASSERT(offsetof(struct llogd_conn_body, lgdc_logid) == 16); - LASSERT((int)sizeof(((struct llogd_conn_body *)0)->lgdc_logid) == 20); - LASSERT(offsetof(struct llogd_conn_body, lgdc_ctxt_idx) == 36); - LASSERT((int)sizeof(((struct llogd_conn_body *)0)->lgdc_ctxt_idx) == 4); + LASSERTF((int)sizeof(struct llogd_conn_body) == 40, " found %lld\n", + (long long)(int)sizeof(struct llogd_conn_body)); + LASSERTF(offsetof(struct llogd_conn_body, lgdc_gen) == 0, " found %lld\n", + (long long)offsetof(struct llogd_conn_body, lgdc_gen)); + LASSERTF((int)sizeof(((struct llogd_conn_body *)0)->lgdc_gen) == 16, " found %lld\n", + (long long)(int)sizeof(((struct llogd_conn_body *)0)->lgdc_gen)); + LASSERTF(offsetof(struct llogd_conn_body, lgdc_logid) == 16, " found %lld\n", + (long long)offsetof(struct llogd_conn_body, lgdc_logid)); + LASSERTF((int)sizeof(((struct llogd_conn_body *)0)->lgdc_logid) == 20, " found %lld\n", + (long long)(int)sizeof(((struct llogd_conn_body *)0)->lgdc_logid)); + LASSERTF(offsetof(struct llogd_conn_body, lgdc_ctxt_idx) == 36, " found %lld\n", + (long long)offsetof(struct llogd_conn_body, lgdc_ctxt_idx)); + LASSERTF((int)sizeof(((struct llogd_conn_body *)0)->lgdc_ctxt_idx) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llogd_conn_body *)0)->lgdc_ctxt_idx)); }