X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=libcfs%2Finclude%2Flibcfs%2Flibcfs.h;h=5fa92dfe811b5a016237a221b860a13781a7a34d;hp=9b7d3f275bf5040c9d81f05a7acd759a50c0d805;hb=f55fdfff5dede69e6674999fb02c1add513704f0;hpb=e82516955fdfbcad390f2fc36a84f24ec3b42a69;ds=sidebyside diff --git a/libcfs/include/libcfs/libcfs.h b/libcfs/include/libcfs/libcfs.h index 9b7d3f2..5fa92df 100644 --- a/libcfs/include/libcfs/libcfs.h +++ b/libcfs/include/libcfs/libcfs.h @@ -42,6 +42,7 @@ #endif #include +#include #include #include @@ -50,19 +51,14 @@ #include #include #include -#include #include #include #include -#include #include #include "curproc.h" #define LIBCFS_VERSION "0.7.1" -#define PO2_ROUNDUP_TYPED(x, po2, type) (-(-(type)(x) & -(type)(po2))) -#define LOWEST_BIT_SET(x) ((x) & ~((x) - 1)) - /* Sparse annotations */ #if !defined(__must_hold) # ifdef __CHECKER__ @@ -72,16 +68,6 @@ # endif /* !__CHECKER__ */ #endif /* !__must_hold */ -#ifdef HAVE_TOTALRAM_PAGES_AS_FUNC - #ifndef cfs_totalram_pages - #define cfs_totalram_pages() totalram_pages() - #endif -#else - #ifndef cfs_totalram_pages - #define cfs_totalram_pages() totalram_pages - #endif -#endif - typedef s32 timeout_t; /* need both kernel and user-land acceptor */ @@ -96,15 +82,8 @@ static inline int notifier_from_ioctl_errno(int err) return notifier_from_errno(err) | NOTIFY_STOP_MASK; } -/* - * Defined by platform - */ -int unshare_fs_struct(void); - int libcfs_ioctl_data_adjust(struct libcfs_ioctl_data *data); -#define container_of0(ptr, type, member) container_of_safe(ptr, type, member) - extern struct workqueue_struct *cfs_rehash_wq; struct lnet_debugfs_symlink_def { @@ -121,6 +100,16 @@ int lprocfs_call_handler(void *data, int write, loff_t *ppos, int (*handler)(void *data, int write, loff_t pos, void __user *buffer, int len)); +/* + * Memory + */ +#if BITS_PER_LONG == 32 +/* limit to lowmem on 32-bit systems */ +#define NUM_CACHEPAGES \ + min(cfs_totalram_pages(), 1UL << (30 - PAGE_SHIFT) * 3 / 4) +#else +#define NUM_CACHEPAGES cfs_totalram_pages() +#endif #define wait_var_event_warning(var, condition, format, ...) \ do { \ @@ -136,4 +125,17 @@ do { \ ); \ } while (0) +/* atomic-context safe vfree */ +void libcfs_vfree_atomic(const void *addr); + +/* interval tree */ + +#ifdef HAVE_INTERVAL_TREE_CACHED +#define interval_tree_root rb_root_cached +#define INTERVAL_TREE_ROOT RB_ROOT_CACHED +#else +#define interval_tree_root rb_root +#define INTERVAL_TREE_ROOT RB_ROOT +#endif /* HAVE_INTERVAL_TREE_CACHED */ + #endif /* _LIBCFS_LIBCFS_H_ */