#include <linux/fs.h>
#include <linux/version.h>
],[
- #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,24))
- #error "down_read_trylock broken before 2.4.24"
- #endif
struct inode i;
return (char *)&i.i_alloc_sem - (char *)&i;
],[
#include <linux/smp.h>
#include <linux/rwsem.h>
#include <libcfs/kp30.h>
-
-# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
-# include <linux/statfs.h>
-# else
-# define kstatfs statfs
-# endif
+#include <linux/statfs.h>
#else
# define kstatfs statfs
#ifdef __KERNEL__
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) && LINUX_VERSION_CODE < KERNEL_VERSION(2,5,69)
-#error sorry, lustre requires at least 2.5.69
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,5)
+#error sorry, lustre requires at least 2.6.5
#endif
#include <libcfs/linux/portals_compat25.h>
#define gfp_t int
#endif
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
-
#define lock_dentry(___dentry) spin_lock(&(___dentry)->d_lock)
#define unlock_dentry(___dentry) spin_unlock(&(___dentry)->d_lock)
-#define lock_24kernel() do {} while (0)
-#define unlock_24kernel() do {} while (0)
#define ll_kernel_locked() kernel_locked()
/*
((!PageWriteback(page) && (cmd & OBD_BRW_READ)) || \
(PageWriteback(page) && (cmd & OBD_BRW_WRITE)))
-#else /* 2.4.. */
-
-#define ll_flock_lock_file_wait(file, lock, can_sleep) \
- do {} while(0)
-
-#define lock_dentry(___dentry)
-#define unlock_dentry(___dentry)
-
-#define lock_24kernel() lock_kernel()
-#define unlock_24kernel() unlock_kernel()
-#define ll_kernel_locked() (current->lock_depth >= 0)
-
-/* 2.4 kernels have HZ=100 on i386/x86_64, this should be reasonably safe */
-#define get_jiffies_64() (__u64)jiffies
-
-#ifdef HAVE_MM_INLINE
-#include <linux/mm_inline.h>
-#endif
-
-#ifndef pgoff_t
-#define pgoff_t unsigned long
-#endif
-
-#define ll_vfs_create(a,b,c,d) vfs_create(a,b,c)
-#define ll_permission(inode,mask,nd) permission(inode,mask)
-#define ILOOKUP(sb, ino, test, data) ilookup4(sb, ino, test, data);
-#define DCACHE_DISCONNECTED DCACHE_NFSD_DISCONNECTED
-#define ll_dev_t int
-#define old_encode_dev(dev) (dev)
-
-/* 2.5 uses hlists for some things, like the d_hash. we'll treat them
- * as 2.5 and let macros drop back.. */
-#ifndef HLIST_HEAD /* until we get a kernel newer than l28 */
-#define hlist_entry list_entry
-#define hlist_head list_head
-#define hlist_node list_head
-#define HLIST_HEAD LIST_HEAD
-#define INIT_HLIST_HEAD INIT_LIST_HEAD
-#define hlist_del_init list_del_init
-#define hlist_add_head list_add
-#endif
-
-#ifndef INIT_HLIST_NODE
-#define INIT_HLIST_NODE(p) ((p)->next = NULL, (p)->prev = NULL)
-#endif
-
-#ifndef hlist_for_each
-#define hlist_for_each list_for_each
-#endif
-
-#ifndef hlist_for_each_safe
-#define hlist_for_each_safe list_for_each_safe
-#endif
-
-#define KDEVT_INIT(val) (val)
-#define ext3_xattr_set_handle ext3_xattr_set
-#define try_module_get __MOD_INC_USE_COUNT
-#define module_put __MOD_DEC_USE_COUNT
-#define LTIME_S(time) (time)
-
-#if !defined(CONFIG_RH_2_4_20) && !defined(cpu_online)
-#define cpu_online(cpu) test_bit(cpu, &(cpu_online_map))
-#endif
-
-static inline int ll_path_lookup(const char *path, unsigned flags,
- struct nameidata *nd)
-{
- int error = 0;
- if (path_init(path, flags, nd))
- error = path_walk(path, nd);
- return error;
-}
-#define ll_permission(inode,mask,nd) permission(inode,mask)
-typedef long sector_t;
-
-#define ll_pgcache_lock(mapping) spin_lock(&pagecache_lock)
-#define ll_pgcache_unlock(mapping) spin_unlock(&pagecache_lock)
-#define ll_call_writepage(inode, page) \
- (inode)->i_mapping->a_ops->writepage(page)
-#define ll_invalidate_inode_pages(inode) invalidate_inode_pages(inode)
-#define ll_truncate_complete_page(page) truncate_complete_page(page)
-
-static inline void clear_page_dirty(struct page *page)
-{
- if (PageDirty(page))
- ClearPageDirty(page);
-}
-
-static inline int clear_page_dirty_for_io(struct page *page)
-{
- struct address_space *mapping = page->mapping;
-
- if (page->mapping && PageDirty(page)) {
- ClearPageDirty(page);
- ll_pgcache_lock(mapping);
- list_del(&page->list);
- list_add(&page->list, &mapping->locked_pages);
- ll_pgcache_unlock(mapping);
- return 1;
- }
- return 0;
-}
-
-static inline void ll_redirty_page(struct page *page)
-{
- SetPageDirty(page);
- ClearPageLaunder(page);
-}
-
-static inline void __d_drop(struct dentry *dentry)
-{
- list_del_init(&dentry->d_hash);
-}
-
-static inline int cleanup_group_info(void)
-{
- /* Get rid of unneeded supplementary groups */
- current->ngroups = 0;
- memset(current->groups, 0, sizeof(current->groups));
- return 0;
-}
-
-#ifndef HAVE_COND_RESCHED
-static inline void cond_resched(void)
-{
- if (unlikely(need_resched())) {
- set_current_state(TASK_RUNNING);
- schedule();
- }
-}
-#endif
-
-/* to find proc_dir_entry from inode. 2.6 has native one -bzzz */
-#ifndef HAVE_PDE
-#define PDE(ii) ((ii)->u.generic_ip)
-#endif
-
-#define __set_page_ll_data(page, llap) set_page_private(page, (unsigned long)llap)
-#define __clear_page_ll_data(page) set_page_private(page, 0)
-#define PageWriteback(page) 0
-#define CheckWriteback(page, cmd) 1
-#define set_page_writeback(page) do {} while (0)
-#define end_page_writeback(page) do {} while (0)
-
-static inline int mapping_mapped(struct address_space *mapping)
-{
- if (mapping->i_mmap_shared)
- return 1;
- if (mapping->i_mmap)
- return 1;
- return 0;
-}
-
-#ifdef ZAP_PAGE_RANGE_VMA
-#define ll_zap_page_range(vma, addr, len) zap_page_range(vma, addr, len)
-#else
-#define ll_zap_page_range(vma, addr, len) zap_page_range(vma->vm_mm, addr, len)
-#endif
-
-#ifndef HAVE_PAGE_MAPPED
-/* Poor man's page_mapped. substract from page count, counts from
- buffers/pagecache and our own count (we are supposed to hold one reference).
- What is left are user mappings and also others who work with this page now,
- but there are supposedly none. */
-static inline int page_mapped(struct page *page)
-{
- return page_count(page) - !!page->mapping - !!page->buffers - 1;
-}
-#endif /* !HAVE_PAGE_MAPPED */
-
-static inline void touch_atime(struct vfsmount *mnt, struct dentry *dentry)
-{
- update_atime(dentry->d_inode);
-}
-
-static inline void file_accessed(struct file *file)
-{
-#ifdef O_NOATIME
- if (file->f_flags & O_NOATIME)
- return;
-#endif
- touch_atime(file->f_vfsmnt, file->f_dentry);
-}
-
-#ifndef typecheck
-/*
- * Check at compile time that something is of a particular type.
- * Always evaluates to 1 so you may use it easily in comparisons.
- */
-#define typecheck(type,x) \
-({ type __dummy; \
- typeof(x) __dummy2; \
- (void)(&__dummy == &__dummy2); \
- 1; \
-})
-#endif
-
-#endif /* end of 2.4 compat macros */
#ifdef HAVE_PAGE_LIST
static inline int mapping_has_pages(struct address_space *mapping)
#include <linux/version.h>
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
#include <asm/statfs.h>
-#endif
#include <linux/fs.h>
#include <linux/dcache.h>
LPROC_LL_TRUNC,
LPROC_LL_LOCKLESS_TRUNC,
LPROC_LL_FLOCK,
-
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
LPROC_LL_GETATTR,
-#else
- LPROC_LL_REVALIDATE,
-#endif
LPROC_LL_STAFS,
LPROC_LL_ALLOC_INODE,
LPROC_LL_SETXATTR,
#ifdef __KERNEL__
#include <linux/version.h>
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-#include <linux/tqueue.h>
-#else
#include <linux/workqueue.h>
#endif
-#endif
/* XXX Liang: should be moved to other header instead of here */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,4)
# endif
#else
# include <linux/version.h>
-# if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,21)
-# define NEED_QUOTA_DEFS
-# endif
# ifdef HAVE_QUOTA_SUPPORT
# include <linux/quota.h>
# endif
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/fs.h>
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
#include <linux/namei.h>
-#endif
#include <linux/sched.h>
#include <lvfs.h>
};
#define LVFS_DENTRY_PARAMS_INIT { .ldp_magic = LVFS_DENTRY_PARAM_MAGIC }
-# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
-# define BDEVNAME_DECLARE_STORAGE(foo) char foo[BDEVNAME_SIZE]
-# define ll_bdevname(SB, STORAGE) __bdevname(kdev_t_to_nr(SB->s_dev), STORAGE)
-# define lvfs_sbdev(SB) ((SB)->s_bdev)
-# define lvfs_sbdev_type struct block_device *
+#define lvfs_sbdev(SB) ((SB)->s_bdev)
+#define lvfs_sbdev_type struct block_device *
int fsync_bdev(struct block_device *);
-# define lvfs_sbdev_sync fsync_bdev
-# else
-# define BDEVNAME_DECLARE_STORAGE(foo) char __unused_##foo
-# define ll_bdevname(SB,STORAGE) ((void)__unused_##STORAGE,bdevname(lvfs_sbdev(SB)))
-# define lvfs_sbdev(SB) (kdev_t_to_nr((SB)->s_dev))
-# define lvfs_sbdev_type kdev_t
-# define lvfs_sbdev_sync fsync_dev
-# endif
+#define lvfs_sbdev_sync fsync_bdev
/* Instead of calling within lvfs (a layering violation) */
#define lvfs_set_rdonly(obd, sb) \
void obdo_from_inode(struct obdo *dst, struct inode *src, obd_flag valid);
void obdo_refresh_inode(struct inode *dst, struct obdo *src, obd_flag valid);
void obdo_to_inode(struct inode *dst, struct obdo *src, obd_flag valid);
-#endif
-
-#if !defined(__KERNEL__) || (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
+#else
#define to_kdev_t(dev) dev
#define kdev_t_to_nr(dev) dev
#endif
#define OBD_FAIL_WRITE(obd, id, sb) \
{ \
if (OBD_FAIL_CHECK(id)) { \
- BDEVNAME_DECLARE_STORAGE(tmp); \
CERROR("obd_fail_loc=%x, fail write operation on %s\n", \
- id, ll_bdevname(sb, tmp)); \
+ id, sb->s_id); \
lvfs_set_rdonly(obd, sb); \
/* We set FAIL_ONCE because we never "un-fail" a device */ \
obd_fail_loc |= OBD_FAILED | OBD_FAIL_ONCE; \
#define LSI_UMOUNT_FORCE 0x00000010
#define LSI_UMOUNT_FAILOVER 0x00000020
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
-# define s2lsi(sb) ((struct lustre_sb_info *)((sb)->s_fs_info))
-# define s2lsi_nocast(sb) ((sb)->s_fs_info)
-#else /* 2.4 here */
-# define s2lsi(sb) ((struct lustre_sb_info *)((sb)->u.generic_sbp))
-# define s2lsi_nocast(sb) ((sb)->u.generic_sbp)
-#endif
-
+#define s2lsi(sb) ((struct lustre_sb_info *)((sb)->s_fs_info))
+#define s2lsi_nocast(sb) ((sb)->s_fs_info)
#define get_profile_name(sb) (s2lsi(sb)->lsi_lmd->lmd_profile)
#endif /* __KERNEL__ */
#define QFILE_CONVERT 7
/* admin quotafile operations */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
int lustre_check_quota_file(struct lustre_quota_info *lqi, int type);
int lustre_read_quota_info(struct lustre_quota_info *lqi, int type);
int lustre_write_quota_info(struct lustre_quota_info *lqi, int type);
int lustre_get_qids(struct file *file, struct inode *inode, int type,
struct list_head *list);
int lustre_quota_convert(struct lustre_quota_info *lqi, int type);
-#else
-
-#ifndef DQ_FAKE_B
-#define DQ_FAKE_B 6
-#endif
-
-static inline int lustre_check_quota_file(struct lustre_quota_info *lqi,
- int type)
-{
- return 0;
-}
-static inline int lustre_read_quota_info(struct lustre_quota_info *lqi,
- int type)
-{
- return 0;
-}
-static inline int lustre_write_quota_info(struct lustre_quota_info *lqi,
- int type)
-{
- return 0;
-}
-static inline int lustre_read_dquot(struct lustre_dquot *dquot)
-{
- return 0;
-}
-static inline int lustre_commit_dquot(struct lustre_dquot *dquot)
-{
- return 0;
-}
-static inline int lustre_init_quota_info(struct lustre_quota_info *lqi,
- int type)
-{
- return 0;
-}
-static inline int lustre_quota_convert(struct lustre_quota_info *lqi,
- int type)
-{
- return 0;
-}
-#endif /* KERNEL_VERSION(2,5,0) */
#define LL_DQUOT_OFF(sb) DQUOT_OFF(sb)
llite_lloop-objs := lloop.o
-ifeq ($(PATCHLEVEL),4)
-lustre-objs += rw24.o super.o
-else
lustre-objs += rw26.o super25.o
-endif
@INCLUDE_RULES@
* sys_getcwd() could return -ENOENT -bzzz */
#ifdef DCACHE_LUSTRE_INVALID
dentry->d_flags |= DCACHE_LUSTRE_INVALID;
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
- __d_drop(dentry);
- if (dentry->d_inode) {
- /* Put positive dentries to orphan list */
- list_add(&dentry->d_hash,
- &ll_i2sbi(dentry->d_inode)->ll_orphan_dentry_list);
- }
-#endif
#else
if (!dentry->d_inode || !S_ISDIR(dentry->d_inode->i_mode))
__d_drop(dentry);
/* drop lookup or getattr locks immediately */
if (it->it_op == IT_LOOKUP || it->it_op == IT_GETATTR) {
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
/* on 2.6 there are situation when several lookups and
* revalidations may be requested during single operation.
* therefore, we don't release intent here -bzzz */
ll_intent_drop_lock(it);
-#else
- ll_intent_release(it);
-#endif
}
}
void ll_frob_intent(struct lookup_intent **itp, struct lookup_intent *deft)
{
struct lookup_intent *it = *itp;
-#if defined(HAVE_VFS_INTENT_PATCHES)&&(LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
+#ifdef HAVE_VFS_INTENT_PATCHES
if (it) {
LASSERTF(it->it_magic == INTENT_MAGIC, "bad intent magic: %x\n",
it->it_magic);
return;
}
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
#ifdef HAVE_VFS_INTENT_PATCHES
static int ll_revalidate_nd(struct dentry *dentry, struct nameidata *nd)
{
RETURN(rc);
}
#endif
-#endif
struct dentry_operations ll_d_ops = {
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
.d_revalidate = ll_revalidate_nd,
-#else
- .d_revalidate_it = ll_revalidate_it,
-#endif
.d_release = ll_release,
.d_delete = ll_ddelete,
#ifdef DCACHE_LUSTRE_INVALID
#include <linux/version.h>
#include <linux/smp_lock.h>
#include <asm/uaccess.h>
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-# include <linux/locks.h> // for wait_on_buffer
-#else
-# include <linux/buffer_head.h> // for wait_on_buffer
-#endif
+#include <linux/buffer_head.h> // for wait_on_buffer
#define DEBUG_SUBSYSTEM S_LLITE
#include <lustre_lite.h>
#include <linux/pagemap.h>
#include <linux/file.h>
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-#include <linux/lustre_compat25.h>
-#endif
#include "llite_internal.h"
#include <lustre/ll_fiemap.h>
CERROR("writepage inode %lu(%p) of page %p "
"failed: %d\n", mapping->host->i_ino,
mapping->host, page, rc);
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
if (rc == -ENOSPC)
set_bit(AS_ENOSPC, &mapping->flags);
else
set_bit(AS_EIO, &mapping->flags);
-#else
- mapping->gfp_mask |= AS_EIO_MASK;
-#endif
}
}
if (page->mapping != NULL) {
/* turn off the kernel's read-ahead */
if (lock_style != LL_LOCK_STYLE_NOLOCK) {
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
- file->f_ramax = 0;
-#else
file->f_ra.ra_pages = 0;
-#endif
/* initialize read-ahead window once per syscall */
if (ra == 0) {
ra = 1;
/*
* Send file content (through pagecache) somewhere with helper
*/
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
static ssize_t ll_file_sendfile(struct file *in_file, loff_t *ppos,size_t count,
read_actor_t actor, void *target)
{
ll_tree_unlock(&tree);
RETURN(retval);
}
-#endif
static int ll_lov_recreate_obj(struct inode *inode, struct file *file,
unsigned long arg)
if (offset >= 0 && offset <= ll_file_maxbytes(inode)) {
if (offset != file->f_pos) {
file->f_pos = offset;
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
- file->f_reada = 0;
- file->f_version = ++event;
-#else
file->f_version = 0;
-#endif
}
retval = offset;
}
}
CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p),name=%s\n",
inode->i_ino, inode->i_generation, inode, dentry->d_name.name);
-#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,0))
- ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_REVALIDATE, 1);
-#endif
exp = ll_i2mdcexp(inode);
RETURN(rc);
}
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
int ll_getattr_it(struct vfsmount *mnt, struct dentry *de,
struct lookup_intent *it, struct kstat *stat)
{
return ll_getattr_it(mnt, de, &it, stat);
}
-#endif
static
int lustre_check_acl(struct inode *inode, int mask)
.release = ll_file_release,
.mmap = ll_file_mmap,
.llseek = ll_file_seek,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
.sendfile = ll_file_sendfile,
-#endif
.fsync = ll_fsync,
};
.release = ll_file_release,
.mmap = ll_file_mmap,
.llseek = ll_file_seek,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
.sendfile = ll_file_sendfile,
-#endif
.fsync = ll_fsync,
#ifdef HAVE_F_OP_FLOCK
.flock = ll_file_flock,
.release = ll_file_release,
.mmap = ll_file_mmap,
.llseek = ll_file_seek,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
.sendfile = ll_file_sendfile,
-#endif
.fsync = ll_fsync,
#ifdef HAVE_F_OP_FLOCK
.flock = ll_file_noflock,
#endif
.setattr = ll_setattr,
.truncate = ll_truncate,
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
.getattr = ll_getattr,
-#else
- .revalidate_it = ll_inode_revalidate_it,
-#endif
.permission = ll_inode_permission,
.setxattr = ll_setxattr,
.getxattr = ll_getxattr,
#ifdef HAVE_VFS_INTENT_PATCHES
static inline struct lookup_intent *ll_nd2it(struct nameidata *nd)
{
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
return &nd->intent;
-#else
- return nd->intent;
-#endif
}
#endif
__u64 lli_open_fd_write_count;
struct obd_client_handle *lli_mds_exec_och;
__u64 lli_open_fd_exec_count;
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
struct inode lli_vfs_inode;
-#endif
/* metadata stat-ahead */
/*
// static inline struct ll_inode_info *LL_I(struct inode *inode)
static inline struct ll_inode_info *ll_i2info(struct inode *inode)
{
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
return container_of(inode, struct ll_inode_info, lli_vfs_inode);
-#else
- CLASSERT(sizeof(inode->u) >= sizeof(struct ll_inode_info));
- return (struct ll_inode_info *)&(inode->u.generic_ip);
-#endif
}
/* default to about 40meg of readahead on a given system. That much tied
static inline struct inode *ll_info2i(struct ll_inode_info *lli)
{
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
return &lli->lli_vfs_inode;
-#else
- return list_entry(lli, struct inode, u.generic_ip);
-#endif
}
struct it_cb_data {
int ll_mdc_real_close(struct inode *inode, int flags);
extern void ll_rw_stats_tally(struct ll_sb_info *sbi, pid_t pid, struct file
*file, size_t count, int rw);
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
int ll_getattr_it(struct vfsmount *mnt, struct dentry *de,
struct lookup_intent *it, struct kstat *stat);
int ll_getattr(struct vfsmount *mnt, struct dentry *de, struct kstat *stat);
-#endif
struct ll_file_data *ll_file_data_get(void);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))
int ll_inode_permission(struct inode *inode, int mask, struct nameidata *nd);
int ll_close_thread_start(struct ll_close_queue **lcq_ret);
/* llite/llite_mmap.c */
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
typedef struct rb_root rb_root_t;
typedef struct rb_node rb_node_t;
-#endif
struct ll_lock_tree_node;
struct ll_lock_tree {
#define ll_s2sbi(sb) (s2lsi(sb)->lsi_llsbi)
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
static inline __u64 ll_ts2u64(struct timespec *time)
{
__u64 t = time->tv_sec;
return t;
}
-#else /* 2.4 here */
-static inline __u64 ll_ts2u64(time_t *time)
-{
- return *time;
-}
-#endif
/* don't need an addref as the sb_info should be holding one */
static inline struct obd_export *ll_s2obdexp(struct super_block *sb)
}
}
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-void lustre_throw_orphan_dentries(struct super_block *sb)
-{
- struct dentry *dentry, *next;
- struct ll_sb_info *sbi = ll_s2sbi(sb);
-
- /* Do this to get rid of orphaned dentries. That is not really trw. */
- list_for_each_entry_safe(dentry, next, &sbi->ll_orphan_dentry_list,
- d_hash) {
- CWARN("found orphan dentry %.*s (%p->%p) at unmount, dumping "
- "before and after shrink_dcache_parent\n",
- dentry->d_name.len, dentry->d_name.name, dentry, next);
- lustre_dump_dentry(dentry, 1);
- shrink_dcache_parent(dentry);
- lustre_dump_dentry(dentry, 1);
- }
-}
-#else
-#define lustre_throw_orphan_dentries(sb)
-#endif
-
#ifdef HAVE_EXPORT___IGET
static void prune_dir_dentries(struct inode *inode)
{
obd_disconnect(sbi->ll_mdc_exp);
sbi->ll_mdc_exp = NULL;
- lustre_throw_orphan_dentries(sb);
-
EXIT;
}
local_lock = 1;
}
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
- DOWN_WRITE_I_ALLOC_SEM(inode);
- LOCK_INODE_MUTEX(inode);
-#else
LOCK_INODE_MUTEX(inode);
DOWN_WRITE_I_ALLOC_SEM(inode);
-#endif
if (likely(rc == 0)) {
/* Only ll_inode_size_lock is taken at this level.
* lov_stripe_lock() is grabbed by ll_truncate() only over
if (body->valid & OBD_MD_FLGENER)
inode->i_generation = body->generation;
if (body->valid & OBD_MD_FLRDEV)
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
- inode->i_rdev = body->rdev;
-#else
inode->i_rdev = old_decode_dev(body->rdev);
-#endif
if (body->valid & OBD_MD_FLSIZE) {
#if 0 /* Can't block ll_test_inode->ll_update_inode, b=14326*/
ll_inode_size_lock(inode, 0);
set_bit(LLI_F_HAVE_MDS_SIZE_LOCK, &lli->lli_flags);
}
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
static struct backing_dev_info ll_backing_dev_info = {
.ra_pages = 0, /* No readahead */
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12))
.memory_backed = 0, /* Does contribute to dirty memory */
#endif
};
-#endif
void ll_read_inode2(struct inode *inode, void *opaque)
{
EXIT;
} else {
inode->i_op = &ll_special_inode_operations;
-
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
init_special_inode(inode, inode->i_mode,
kdev_t_to_nr(inode->i_rdev));
-
/* initializing backing dev info. */
inode->i_mapping->backing_dev_info = &ll_backing_dev_info;
-#else
- init_special_inode(inode, inode->i_mode, inode->i_rdev);
-#endif
EXIT;
}
}
#include <linux/mm.h>
#include <linux/pagemap.h>
#include <linux/smp_lock.h>
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-#include <linux/iobuf.h>
-#endif
#define DEBUG_SUBSYSTEM S_LLITE
ll_stats_ops_tally(ll_i2sbi(file->f_dentry->d_inode), LPROC_LL_MAP, 1);
rc = generic_file_mmap(file, vma);
if (rc == 0) {
-#if !defined(HAVE_FILEMAP_POPULATE) && \
- (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
+#ifndef HAVE_FILEMAP_POPULATE
if (!filemap_populate)
filemap_populate = vma->vm_ops->populate;
#endif
return (key0 << 1);
}
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-static int ll_nfs_test_inode(struct inode *inode, unsigned long ino, void *opaque)
-#else
static int ll_nfs_test_inode(struct inode *inode, void *opaque)
-#endif
{
struct ll_fid *iid = opaque;
{
struct inode *inode;
struct dentry *result;
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
- struct list_head *lp;
-#endif
ENTRY;
if (ino == 0)
RETURN(ERR_PTR(-ESTALE));
}
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
result = d_alloc_anon(inode);
if (!result) {
iput(inode);
RETURN(ERR_PTR(-ENOMEM));
}
-#else
- /* now to find a dentry.
- * If possible, get a well-connected one
- */
- spin_lock(&dcache_lock);
- for (lp = inode->i_dentry.next; lp != &inode->i_dentry ; lp=lp->next) {
- result = list_entry(lp,struct dentry, d_alias);
- lock_dentry(result);
- if (!(result->d_flags & DCACHE_DISCONNECTED)) {
- dget_locked(result);
- ll_set_dflags(result, DCACHE_REFERENCED);
- unlock_dentry(result);
- spin_unlock(&dcache_lock);
- iput(inode);
- RETURN(result);
- }
- unlock_dentry(result);
- }
- spin_unlock(&dcache_lock);
- result = d_alloc_root(inode);
- if (result == NULL) {
- iput(inode);
- RETURN(ERR_PTR(-ENOMEM));
- }
- result->d_flags |= DCACHE_DISCONNECTED;
-
-#endif
ll_dops_init(result, 1);
RETURN(result);
{ LPROC_LL_TRUNC, LPROCFS_TYPE_REGS, "truncate" },
{ LPROC_LL_LOCKLESS_TRUNC, LPROCFS_TYPE_REGS, "lockless_truncate" },
{ LPROC_LL_FLOCK, LPROCFS_TYPE_REGS, "flock" },
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
{ LPROC_LL_GETATTR, LPROCFS_TYPE_REGS, "getattr" },
-#else
- { LPROC_LL_REVALIDATE, LPROCFS_TYPE_REGS, "getattr" },
-#endif
/* special inode operation */
{ LPROC_LL_STAFS, LPROCFS_TYPE_REGS, "statfs" },
{ LPROC_LL_ALLOC_INODE, LPROCFS_TYPE_REGS, "alloc_inode" },
return retval;
}
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
#ifdef HAVE_VFS_INTENT_PATCHES
static struct dentry *ll_lookup_nd(struct inode *parent, struct dentry *dentry,
struct nameidata *nd)
RETURN(de);
}
#endif
-#endif
/* We depend on "mode" being set with the proper file type/umask by now */
static struct inode *ll_create_node(struct inode *dir, const char *name,
RETURN(err);
}
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
#ifndef HAVE_VFS_INTENT_PATCHES
static int ll_create_nd(struct inode *dir, struct dentry *dentry, int mode, struct nameidata *nd)
{
return ll_create_it(dir, dentry, mode, &nd->intent);
}
#endif
-#endif
static int ll_symlink_generic(struct inode *dir, struct qstr *name,
const char *tgt, struct dentry *dchild)
old_encode_dev(rdev), dchild);
}
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
static int ll_unlink(struct inode * dir, struct dentry *dentry)
{
return ll_unlink_generic(dir, &dentry->d_name);
}
return err;
}
-#endif
struct inode_operations ll_dir_inode_operations = {
#ifdef HAVE_VFS_INTENT_PATCHES
.setattr_raw = ll_setattr_raw,
#endif
.mknod = ll_mknod,
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
- .create_it = ll_create_it,
- .lookup_it = ll_lookup_it,
- .revalidate_it = ll_inode_revalidate_it,
-#else
.lookup = ll_lookup_nd,
.create = ll_create_nd,
/* We need all these non-raw things for NFSD, to not patch it. */
.rename = ll_rename,
.setattr = ll_setattr,
.getattr = ll_getattr,
-#endif
.permission = ll_inode_permission,
.setxattr = ll_setxattr,
.getxattr = ll_getxattr,
.setattr_raw = ll_setattr_raw,
#endif
.setattr = ll_setattr,
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
.getattr = ll_getattr,
-#else
- .revalidate_it = ll_inode_revalidate_it,
-#endif
.permission = ll_inode_permission,
.setxattr = ll_setxattr,
.getxattr = ll_getxattr,
llap->llap_defer_uptodate = 0;
}
SetPageError(page);
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
if (rc == -ENOSPC)
set_bit(AS_ENOSPC, &page->mapping->flags);
else
set_bit(AS_EIO, &page->mapping->flags);
-#else
- page->mapping->gfp_mask |= AS_EIO_MASK;
-#endif
}
/* be carefull about clear WB.
#ifdef HAVE_COOKIE_FOLLOW_LINK
.put_link = ll_put_link,
#endif
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
- .revalidate_it = ll_inode_revalidate_it,
-#else
.getattr = ll_getattr,
-#endif
.permission = ll_inode_permission,
.setxattr = ll_setxattr,
.getxattr = ll_getxattr,
#define DEBUG_SUBSYSTEM S_CLASS
#include <linux/version.h>
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
#include <asm/statfs.h>
-#endif
#include <lprocfs_status.h>
#include <obd_class.h>
#include <linux/seq_file.h>
#include <linux/quotaio_v1.h>
#include <linux/quotaio_v2.h>
#include <linux/parser.h>
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-#include <linux/ext3_xattr.h>
-#else
#include <ext3/xattr.h>
-#endif
#include <libcfs/kp30.h>
#include <lustre_fsfilt.h>
#include <obd.h>
#include <lustre_quota.h>
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-#include <linux/iobuf.h>
-#endif
#include <linux/lustre_compat25.h>
#include <linux/lprocfs_status.h>
#define FSFILT_SINGLEDATA_TRANS_BLOCKS(sb) EXT3_SINGLEDATA_TRANS_BLOCKS
#endif
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-#define fsfilt_ext3_journal_start(inode, nblocks) \
- journal_start(EXT3_JOURNAL(inode),nblocks)
-#define fsfilt_ext3_journal_stop(handle) journal_stop(handle)
-#else
-#define fsfilt_ext3_journal_start(inode, nblocks) ext3_journal_start(inode, nblocks)
-#define fsfilt_ext3_journal_stop(handle) ext3_journal_stop(handle)
-#endif
-
static cfs_mem_cache_t *fcb_cache;
struct fsfilt_cb_data {
int err;
journal = EXT3_SB(sb)->s_journal;
- lock_24kernel();
handle = journal_start(journal, 1);
- unlock_24kernel();
if (IS_ERR(handle)) {
CERROR("can't start transaction\n");
return(PTR_ERR(handle));
err = ext3_journal_dirty_metadata(handle, EXT3_SB(sb)->s_sbh);
out:
- lock_24kernel();
journal_stop(handle);
- unlock_24kernel();
return(err);
}
journal_start:
LASSERTF(nblocks > 0, "can't start %d credit transaction\n", nblocks);
- lock_24kernel();
- handle = fsfilt_ext3_journal_start(inode, nblocks);
- unlock_24kernel();
+ handle = ext3_journal_start(inode, nblocks);
if (!IS_ERR(handle))
LASSERT(current->journal_info == handle);
}
LASSERTF(needed > 0, "can't start %d credit transaction\n", needed);
- lock_24kernel();
- handle = fsfilt_ext3_journal_start(fso->fso_dentry->d_inode, needed);
- unlock_24kernel();
+ handle = ext3_journal_start(fso->fso_dentry->d_inode, needed);
if (IS_ERR(handle)) {
CERROR("can't get handle for %d credits: rc = %ld\n", needed,
PTR_ERR(handle));
if (force_sync)
handle->h_sync = 1; /* recovery likes this */
- lock_24kernel();
- rc = fsfilt_ext3_journal_stop(handle);
- unlock_24kernel();
+ rc = ext3_journal_stop(handle);
return rc;
}
{
unsigned long tid;
transaction_t *transaction;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- unsigned long rtid;
-#endif
handle_t *handle = h;
journal_t *journal;
int rc;
LASSERT(current->journal_info == handle);
- lock_24kernel();
transaction = handle->h_transaction;
journal = transaction->t_journal;
tid = transaction->t_tid;
/* we don't want to be blocked */
handle->h_sync = 0;
- rc = fsfilt_ext3_journal_stop(handle);
+ rc = ext3_journal_stop(handle);
if (rc) {
CERROR("error while stopping transaction: %d\n", rc);
- unlock_24kernel();
return rc;
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- rtid = log_start_commit(journal, transaction);
- if (rtid != tid)
- CERROR("strange race: %lu != %lu\n",
- (unsigned long) tid, (unsigned long) rtid);
-#else
log_start_commit(journal, tid);
-#endif
- unlock_24kernel();
*wait_handle = (void *) tid;
CDEBUG(D_INODE, "commit async: %lu\n", (unsigned long) tid);
struct inode *inode = dentry->d_inode;
int rc = 0;
- lock_24kernel();
-
/* Avoid marking the inode dirty on the superblock list unnecessarily.
* We are already writing the inode to disk as part of this
* transaction and want to avoid a lot of extra inode writeout
}
out:
- unlock_24kernel();
RETURN(rc);
}
LASSERT(TRYLOCK_INODE_MUTEX(inode) == 0);
- lock_24kernel();
rc = ext3_xattr_set_handle(handle, inode, EXT3_XATTR_INDEX_TRUSTED,
name, lmm, lmm_size, XATTR_NO_CTIME);
- unlock_24kernel();
-
if (rc && rc != -EROFS)
CERROR("error adding MD data to inode %lu: rc = %d\n",
inode->i_ino, rc);
int rc;
LASSERT(TRYLOCK_INODE_MUTEX(inode) == 0);
- lock_24kernel();
rc = ext3_xattr_get(inode, EXT3_XATTR_INDEX_TRUSTED,
name, lmm, lmm_size);
- unlock_24kernel();
-
/* This gives us the MD size */
if (lmm == NULL)
return (rc == -ENODATA) ? 0 : rc;
return rc;
}
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
static int fsfilt_ext3_send_bio(int rw, struct inode *inode, struct bio *bio)
{
submit_bio(rw, bio);
return 0;
}
-#else
-static int fsfilt_ext3_send_bio(int rw, struct inode *inode, struct kiobuf *bio)
-{
- int rc, blk_per_page;
-
- rc = brw_kiovec(rw, 1, &bio, inode->i_dev,
- KIOBUF_GET_BLOCKS(bio), 1 << inode->i_blkbits);
- /*
- * brw_kiovec() returns number of bytes actually written. If error
- * occurred after something was written, error code is returned though
- * kiobuf->errno. (See bug 6854.)
- */
-
- blk_per_page = CFS_PAGE_SIZE >> inode->i_blkbits;
-
- if (rc != (1 << inode->i_blkbits) * bio->nr_pages * blk_per_page) {
- CERROR("short write? expected %d, wrote %d (%d)\n",
- (1 << inode->i_blkbits) * bio->nr_pages * blk_per_page,
- rc, bio->errno);
- }
- if (bio->errno != 0) {
- CERROR("IO error. Wrote %d of %d (%d)\n",
- rc,
- (1 << inode->i_blkbits) * bio->nr_pages * blk_per_page,
- bio->errno);
- rc = bio->errno;
- }
-
- return rc;
-}
-#endif
static ssize_t fsfilt_ext3_readpage(struct file *file, char *buf, size_t count,
loff_t *off)
fcb->cb_data = cb_data;
CDEBUG(D_EXT2, "set callback for last_rcvd: "LPD64"\n", last_rcvd);
- lock_24kernel();
journal_callback_set(handle, fsfilt_ext3_cb_func,
(struct journal_callback *)fcb);
- unlock_24kernel();
return 0;
}
#endif
#ifdef EXT3_MULTIBLOCK_ALLOCATOR
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-#define ext3_up_truncate_sem(inode) up_write(&EXT3_I(inode)->truncate_sem);
-#define ext3_down_truncate_sem(inode) down_write(&EXT3_I(inode)->truncate_sem);
-#elif (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17))
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17))
#define ext3_up_truncate_sem(inode) up(&EXT3_I(inode)->truncate_sem);
#define ext3_down_truncate_sem(inode) down(&EXT3_I(inode)->truncate_sem);
#else
return bg_start + colour + block;
}
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-#include <linux/locks.h>
-static void ll_unmap_underlying_metadata(struct super_block *sb,
- unsigned long blocknr)
-{
- struct buffer_head *old_bh;
-
- old_bh = get_hash_table(sb->s_dev, blocknr, sb->s_blocksize);
- if (old_bh) {
- mark_buffer_clean(old_bh);
- wait_on_buffer(old_bh);
- clear_bit(BH_Req, &old_bh->b_state);
- __brelse(old_bh);
- }
-}
-#else
#define ll_unmap_underlying_metadata(sb, blocknr) \
unmap_underlying_metadata((sb)->s_bdev, blocknr)
-#endif
#ifndef EXT3_MB_HINT_GROUP_ALLOC
static unsigned long new_blocks(handle_t *handle, struct ext3_ext_base *base,
goal = ext3_ext_find_goal(inode, path, block, &aflags);
aflags |= 2; /* block have been already reserved */
- lock_24kernel();
pblock = ext3_mb_new_blocks(handle, inode, goal, count, aflags, err);
- unlock_24kernel();
return pblock;
}
count = ext3_ext_calc_credits_for_insert(base, path);
ext3_up_truncate_sem(inode);
- lock_24kernel();
- handle = fsfilt_ext3_journal_start(inode, count+EXT3_ALLOC_NEEDED+1);
- unlock_24kernel();
+ handle = ext3_journal_start(inode, count+EXT3_ALLOC_NEEDED+1);
if (IS_ERR(handle)) {
ext3_down_truncate_sem(inode);
return PTR_ERR(handle);
ext3_down_truncate_sem(inode);
if (tgen != EXT_GENERATION(base)) {
/* the tree has changed. so path can be invalid at moment */
- lock_24kernel();
- fsfilt_ext3_journal_stop(handle);
- unlock_24kernel();
+ ext3_journal_stop(handle);
return EXT_REPEAT;
}
BUG_ON(nex.ee_block != cex->ec_block);
out:
- lock_24kernel();
- fsfilt_ext3_journal_stop(handle);
- unlock_24kernel();
+ ext3_journal_stop(handle);
map:
if (err >= 0) {
/* map blocks */
block_count = (*offs & (blocksize - 1)) + bufsize;
block_count = (block_count + blocksize - 1) >> inode->i_blkbits;
- lock_24kernel();
- handle = fsfilt_ext3_journal_start(inode,
+ handle = ext3_journal_start(inode,
block_count * FSFILT_DATA_TRANS_BLOCKS(inode->i_sb) + 2);
- unlock_24kernel();
if (IS_ERR(handle)) {
CERROR("can't start transaction for %d blocks (%d bytes)\n",
block_count * FSFILT_DATA_TRANS_BLOCKS(inode->i_sb) + 2, bufsize);
unlock_kernel();
}
- lock_24kernel();
- fsfilt_ext3_journal_stop(handle);
- unlock_24kernel();
+ ext3_journal_stop(handle);
if (err == 0)
*offs = offset;
static lvfs_sbdev_type fsfilt_ext3_journal_sbdev(struct super_block *sb)
{
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
return (EXT3_SB(sb)->journal_bdev);
-#else
- return kdev_t_to_nr(EXT3_SB(sb)->s_journal->j_dev);
-#endif
}
static struct fsfilt_operations fsfilt_ext3_ops = {
int rc;
ENTRY;
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
- MOD_INC_USE_COUNT;
-#else
if (!try_module_get(THIS_MODULE)) {
CERROR("Can't get module. Is it alive?");
return -EINVAL;
}
-#endif
switch (cmd) {
case OBD_IOC_CLIENT_RECOVER:
rc = ptlrpc_recover_import(imp, data->ioc_inlbuf1);
GOTO(out, rc = -ENOTTY);
}
out:
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
- MOD_DEC_USE_COUNT;
-#else
module_put(THIS_MODULE);
-#endif
-
return rc;
}
#include <linux/random.h>
#include <linux/fs.h>
#include <linux/jbd.h>
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
# include <linux/smp_lock.h>
# include <linux/buffer_head.h>
# include <linux/workqueue.h>
# include <linux/mount.h>
-#else
-# include <linux/locks.h>
-#endif
#include <obd_class.h>
#include <lustre_dlm.h>
if (!inode->i_op || !inode->i_op->getxattr)
GOTO(out, 0);
- lock_24kernel();
rc = inode->i_op->getxattr(&de, MDS_XATTR_NAME_ACL_ACCESS,
lustre_msg_buf(repmsg, repoff, buflen),
buflen);
- unlock_24kernel();
-
if (rc >= 0)
repbody->aclsize = rc;
else if (rc != -ENODATA) {
size[bufcount] = 0;
if (inode->i_op && inode->i_op->getxattr) {
- lock_24kernel();
rc = inode->i_op->getxattr(&de, MDS_XATTR_NAME_ACL_ACCESS,
NULL, 0);
- unlock_24kernel();
-
if (rc < 0) {
if (rc != -ENODATA) {
CERROR("got acl size: %d\n", rc);
#define DEBUG_SUBSYSTEM S_CLASS
#include <linux/version.h>
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
#include <asm/statfs.h>
-#endif
#include <obd.h>
#include <obd_class.h>
#include <lprocfs_status.h>
#include <linux/version.h>
#include <linux/sched.h>
#include <lustre_quota.h>
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
#include <linux/mount.h>
-#endif
#include <lustre_mds.h>
#include <obd_class.h>
#include <obd_support.h>
#ifdef __KERNEL__
/* Open counts for files. No longer atomic, must hold inode->i_sem */
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
# define mds_inode_oatomic(inode) ((inode)->i_cindex)
-#else
-# define mds_inode_oatomic(inode) ((inode)->i_attr_flags)
-#endif
#ifdef HAVE_I_ALLOC_SEM
#define MDS_UP_READ_ORPHAN_SEM(i) UP_READ_I_ALLOC_SEM(i)
#include <linux/stat.h>
#include <linux/errno.h>
#include <linux/version.h>
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-# include <linux/locks.h> // for wait_on_buffer
-#else
-# include <linux/buffer_head.h> // for wait_on_buffer
-#endif
+#include <linux/buffer_head.h> // for wait_on_buffer
#include <linux/unistd.h>
#include <asm/system.h>
case OBD_IOC_SET_READONLY: {
void *handle;
struct inode *inode = obd->u.obt.obt_sb->s_root->d_inode;
- BDEVNAME_DECLARE_STORAGE(tmp);
LCONSOLE_WARN("*** setting obd %s device '%s' read-only ***\n",
- obd->obd_name, ll_bdevname(obd->u.obt.obt_sb, tmp));
+ obd->obd_name, obd->u.obt.obt_sb->s_id);
handle = fsfilt_start(obd, inode, FSFILT_OP_MKNOD, NULL);
if (!IS_ERR(handle))
#include <linux/module.h>
#include <linux/init.h>
#include <linux/version.h>
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
-# include <linux/buffer_head.h>
-# include <linux/workqueue.h>
-#else
-# include <linux/locks.h>
-#endif
+#include <linux/buffer_head.h>
+#include <linux/workqueue.h>
#include <obd_class.h>
#include <obd_lov.h>
OBD_FAIL_WRITE(obd, OBD_FAIL_MDS_REINT_RENAME_WRITE,
de_srcdir->d_inode->i_sb);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
/* Check if we are moving old entry into its child. 2.6 does not
check for this in vfs_rename() anymore */
if (is_subdir(de_new, de_old))
GOTO(cleanup, rc = -EINVAL);
-#endif
lmm = lustre_msg_buf(req->rq_repmsg, offset + 1, 0);
handle = fsfilt_start_log(obd, de_tgtdir->d_inode, FSFILT_OP_RENAME,
DEBUG_REQ(D_INODE, req, "getxattr %s", xattr_name);
if (inode->i_op && inode->i_op->getxattr) {
- lock_24kernel();
rc = inode->i_op->getxattr(dentry, xattr_name,
buf, buflen);
- unlock_24kernel();
}
if (rc < 0 && rc != -ENODATA && rc != -EOPNOTSUPP &&
} else if (reqbody->valid & OBD_MD_FLXATTRLS) {
DEBUG_REQ(D_INODE, req, "listxattr");
- if (inode->i_op && inode->i_op->listxattr) {
- lock_24kernel();
+ if (inode->i_op && inode->i_op->listxattr)
rc = inode->i_op->listxattr(dentry, buf, buflen);
- unlock_24kernel();
- }
if (rc < 0)
CDEBUG(D_OTHER, "listxattr failed: %d\n", rc);
} else
REQ_REC_OFF+2, xattrlen);
LOCK_INODE_MUTEX(inode);
- lock_24kernel();
rc = inode->i_op->setxattr(de, xattr_name, xattr,
xattrlen, body->flags);
- unlock_24kernel();
UNLOCK_INODE_MUTEX(inode);
}
} else if (body->valid & OBD_MD_FLXATTRRM) {
if (inode->i_op && inode->i_op->removexattr) {
LOCK_INODE_MUTEX(inode);
- lock_24kernel();
rc = inode->i_op->removexattr(de, xattr_name);
- unlock_24kernel();
UNLOCK_INODE_MUTEX(inode);
}
} else {
int rc;
ENTRY;
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
- MOD_INC_USE_COUNT;
-#else
if (!try_module_get(THIS_MODULE)) {
CERROR("Can't get module. Is it alive?");
return -EINVAL;
}
-#endif
switch (cmd) {
/* REPLicator context */
case OBD_IOC_PARSE: {
GOTO(out, rc = -ENOTTY);
}
out:
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
- MOD_DEC_USE_COUNT;
-#else
module_put(THIS_MODULE);
-#endif
return rc;
}
#define DEBUG_SUBSYSTEM S_CLASS
#include <linux/version.h>
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
#include <asm/statfs.h>
-#endif
#include <obd.h>
#include <obd_class.h>
#include <lprocfs_status.h>
#include <linux/kmod.h>
#include <linux/version.h>
#include <linux/sched.h>
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
#include <linux/mount.h>
-#endif
#include <obd_class.h>
#include <obd_support.h>
#include <lustre_disk.h>
#include <linux/mm.h>
#include <linux/sysctl.h>
#include <linux/version.h>
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-#include <linux/swapctl.h>
-#endif
#include <linux/proc_fs.h>
#include <linux/slab.h>
#include <linux/stat.h>
/***************** FS registration ******************/
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
/* 2.5 and later */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18))
struct super_block * lustre_get_sb(struct file_system_type *fs_type,
LL_RENAME_DOES_D_MOVE,
};
-#else
-/* 2.4 */
-static struct super_block *lustre_read_super(struct super_block *sb,
- void *data, int silent)
-{
- int rc;
- ENTRY;
-
- rc = lustre_fill_super(sb, data, silent);
- if (rc)
- RETURN(NULL);
- RETURN(sb);
-}
-
-static struct file_system_type lustre_fs_type = {
- .owner = THIS_MODULE,
- .name = "lustre",
- .fs_flags = FS_NFSEXP_FSID,
- .read_super = lustre_read_super,
-};
-#endif
-
int lustre_register_fs(void)
{
return register_filesystem(&lustre_fs_type);
#include <linux/init.h>
#include <linux/version.h>
#include <linux/sched.h>
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
-# include <linux/mount.h>
-# include <linux/buffer_head.h>
-#endif
+#include <linux/mount.h>
+#include <linux/buffer_head.h>
#include <obd_class.h>
#include <obd_lov.h>
* here) or some other ordering issue. */
DQUOT_INIT(dir);
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
rc = ll_security_inode_unlink(dir, dentry, mnt);
if (rc)
GOTO(out, rc);
-#endif
-
rc = dir->i_op->unlink(dir, dentry);
out:
/* need to drop i_mutex before we lose inode reference */
void *handle;
struct super_block *sb = obd->u.obt.obt_sb;
struct inode *inode = sb->s_root->d_inode;
- BDEVNAME_DECLARE_STORAGE(tmp);
LCONSOLE_WARN("*** setting obd %s device '%s' read-only ***\n",
- obd->obd_name, ll_bdevname(sb, tmp));
+ obd->obd_name, sb->s_id);
handle = fsfilt_start(obd, inode, FSFILT_OP_MKNOD, NULL);
if (!IS_ERR(handle))
&brw_stats->hist[BRW_R_DIO_FRAGS],
&brw_stats->hist[BRW_W_DIO_FRAGS], 0);
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
display_brw_stats(seq, "disk I/Os in flight", "ios",
&brw_stats->hist[BRW_R_RPC_HIST],
&brw_stats->hist[BRW_W_RPC_HIST], 0);
display_brw_stats(seq, "disk I/O size", "ios",
&brw_stats->hist[BRW_R_DISK_IOSIZE],
&brw_stats->hist[BRW_W_DISK_IOSIZE], 1);
-#endif
}
#undef pct
#define DEBUG_SUBSYSTEM S_CLASS
#include <linux/version.h>
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
#include <asm/statfs.h>
-#endif
#include <obd_class.h>
#include <lprocfs_status.h>
#include <linux/seq_file.h>
int err = 0;
ENTRY;
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
- MOD_INC_USE_COUNT;
-#else
if (!try_module_get(THIS_MODULE)) {
CERROR("Can't get module. Is it alive?");
return -EINVAL;
}
-#endif
switch (cmd) {
case OBD_IOC_LOV_GET_CONFIG: {
char *buf;
GOTO(out, err = -ENOTTY);
}
out:
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
- MOD_DEC_USE_COUNT;
-#else
module_put(THIS_MODULE);
-#endif
return err;
}
# include <linux/fs.h>
# include <linux/jbd.h>
# include <linux/quota.h>
-# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
# include <linux/smp_lock.h>
# include <linux/buffer_head.h>
# include <linux/workqueue.h>
# include <linux/mount.h>
-# else
-# include <linux/locks.h>
-# endif
#else /* __KERNEL__ */
# include <liblustre.h>
#endif
# include <linux/version.h>
# include <linux/module.h>
# include <linux/init.h>
-# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
# include <linux/smp_lock.h>
# include <linux/buffer_head.h>
# include <linux/workqueue.h>
# include <linux/mount.h>
-# else
-# include <linux/locks.h>
-# endif
#else /* __KERNEL__ */
# include <liblustre.h>
#endif
# include <linux/fs.h>
# include <linux/jbd.h>
# include <linux/quota.h>
-# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
# include <linux/smp_lock.h>
# include <linux/buffer_head.h>
# include <linux/workqueue.h>
# include <linux/mount.h>
-# else
-# include <linux/locks.h>
-# endif
#else /* __KERNEL__ */
# include <liblustre.h>
#endif
# include <linux/init.h>
# include <linux/fs.h>
# include <linux/jbd.h>
-# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
# include <linux/smp_lock.h>
# include <linux/buffer_head.h>
# include <linux/workqueue.h>
# include <linux/mount.h>
-# else
-# include <linux/locks.h>
-# endif
#else /* __KERNEL__ */
# include <liblustre.h>
#endif