#define OBD_FAIL_MDS_STATFS_PACK 0x11d
#define OBD_FAIL_MDS_STATFS_NET 0x11e
#define OBD_FAIL_MDS_GETATTR_NAME_NET 0x11f
-#define OBD_FAIL_MDS_ALL_REPLY_NET 0x120
-#define OBD_FAIL_MDS_ALL_REQUEST_NET 0x121
+#define OBD_FAIL_MDS_PIN_NET 0x120
+#define OBD_FAIL_MDS_UNPIN_NET 0x121
+#define OBD_FAIL_MDS_ALL_REPLY_NET 0x122
+#define OBD_FAIL_MDS_ALL_REQUEST_NET 0x123
#define OBD_FAIL_OST 0x200
#define OBD_FAIL_OST_CONNECT_NET 0x201
#define OBD_FAIL_PTLRPC 0x500
#define OBD_FAIL_PTLRPC_ACK 0x501
+#define OBD_FAIL_OBD_PING_NET 0x600
+#define OBD_FAIL_OBD_LOG_CANCEL_NET 0x601
+
/* preparation for a more advanced failure testbed (not functional yet) */
#define OBD_FAIL_MASK_SYS 0x0000FF00
#define OBD_FAIL_MASK_LOC (0x000000FF | OBD_FAIL_MASK_SYS)
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
-#define ll_bdevname(a) __bdevname((a))
+#define BDEVNAME_DECLARE_STORAGE(foo) char foo[BDEVNAME_SIZE]
+#define ll_bdevname(DEV, STORAGE) __bdevname(DEV, STORAGE)
#define ll_lock_kernel lock_kernel()
-#define LTIME_S(time) (time.tv_sec)
#else
+#define BDEVNAME_DECLARE_STORAGE(foo) char __unused_##foo
+#define ll_bdevname(DEV, STORAGE) ((void)__unused_##STORAGE, bdevname((DEV)))
#define ll_lock_kernel
-#define ll_bdevname(a) bdevname((a))
-#define LTIME_S(time) (time)
#endif
static inline void OBD_FAIL_WRITE(int id, kdev_t dev)
{
if (OBD_FAIL_CHECK(id)) {
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
+ BDEVNAME_DECLARE_STORAGE(tmp);
#ifdef CONFIG_DEV_RDONLY
CERROR("obd_fail_loc=%x, fail write operation on %s\n",
- id, ll_bdevname(dev));
+ id, ll_bdevname(kdev_t_to_nr(dev), tmp));
dev_set_rdonly(dev, 2);
#else
CERROR("obd_fail_loc=%x, can't fail write operation on %s\n",
- id, ll_bdevname(dev));
-#endif
-#else
-#ifdef CONFIG_DEV_RDONLY
- CERROR("obd_fail_loc=%x, fail write operation on %s\n",
- id, ll_bdevname(dev.value));
- dev_set_rdonly(dev, 2);
-#else
- CERROR("obd_fail_loc=%x, can't fail write operation on %s\n",
- id, ll_bdevname(dev.value));
-#endif
+ id, ll_bdevname(kdev_t_to_nr(dev), tmp));
#endif
/* We set FAIL_ONCE because we never "un-fail" a device */
obd_fail_loc |= OBD_FAILED | OBD_FAIL_ONCE;
#define LTIME_S(time) (time)
#endif /* __KERNEL__ */
-#define OBD_ALLOC(ptr, size) \
+#define OBD_ALLOC_GFP(ptr, size, gfp_mask) \
do { \
- (ptr) = kmalloc(size, GFP_KERNEL); \
+ (ptr) = kmalloc(size, gfp_mask); \
if ((ptr) == NULL) { \
CERROR("kmalloc of '" #ptr "' (%d bytes) failed at %s:%d\n", \
(int)(size), __FILE__, __LINE__); \
} \
} while (0)
+#ifndef OBD_GFP_MASK
+# define OBD_GFP_MASK GFP_KERNEL
+#endif
+
+#define OBD_ALLOC(ptr, size) OBD_ALLOC_GFP(ptr, size, OBD_GFP_MASK)
+
#ifdef __arch_um__
# define OBD_VMALLOC(ptr, size) OBD_ALLOC(ptr, size)
#else
#endif
#ifdef CONFIG_DEBUG_SLAB
-#define POISON(lptr, c, s) do {} while (0)
+#define POISON(ptr, c, s) do {} while (0)
#else
-#define POISON(lptr, c, s) memset(lptr, c, s)
+#define POISON(ptr, c, s) memset(ptr, c, s)
#endif
#define OBD_FREE(ptr, size) \
} while (0)
#endif
+/* we memset() the slab object to 0 when allocation succeeds, so DO NOT
+ * HAVE A CTOR THAT DOES ANYTHING. its work will be cleared here. we'd
+ * love to assert on that, but slab.c keeps kmem_cache_s all to itself. */
#define OBD_SLAB_ALLOC(ptr, slab, type, size) \
do { \
- LASSERT (!in_interrupt()); \
+ LASSERT(!in_interrupt()); \
(ptr) = kmem_cache_alloc(slab, type); \
if ((ptr) == NULL) { \
CERROR("slab-alloc of '"#ptr"' (%d bytes) failed at %s:%d\n", \