#define cfs_mutex_is_locked(x) mutex_is_locked(x)
#define cfs_mutex_destroy(x) mutex_destroy(x)
-/*
- * Kernel locking primitives
- *
- * - lock_kernel
- * - unlock_kernel
- */
-#define cfs_lock_kernel() lock_kernel()
-#define cfs_unlock_kernel() unlock_kernel()
-
#ifndef lockdep_set_class
/**************************************************************************
return 0;
}
-#define cfs_lock_kernel() do {} while (0)
#define cfs_sigfillset(l) do {} while (0)
#define cfs_recalc_sigpending(l) do {} while (0)
/* Fine, crash, but stop giving me compile warnings */
#define unlikely(exp) (exp)
#endif
-#define cfs_lock_kernel() do {} while(0)
-#define cfs_unlock_kernel() do {} while(0)
-
#define local_irq_save(x)
#define local_irq_restore(x)
])
#
+# 2.6.37 remove kernel_locked
+#
+AC_DEFUN([LC_KERNEL_LOCKED],
+[AC_MSG_CHECKING([if kernel_locked is defined])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/smp_lock.h>
+],[
+ kernel_locked();
+],[
+ AC_MSG_RESULT([yes])
+ AC_DEFINE(HAVE_KERNEL_LOCKED, 1,
+ [kernel_locked is defined])
+],[
+ AC_MSG_RESULT([no])
+])
+])
+
+#
# 2.6.38 export blkdev_get_by_dev
#
AC_DEFUN([LC_BLKDEV_GET_BY_DEV],
LC_FS_STRUCT_RWLOCK
LC_SBOPS_EVICT_INODE
+ # 2.6.37
+ LC_KERNEL_LOCKED
+
# 2.6.38
LC_ATOMIC_MNT_COUNT
LC_BLKDEV_GET_BY_DEV
ret; \
}
-#define cfs_lock_kernel() do {} while (0)
-#define cfs_unlock_kernel() do {} while (0)
#define daemonize(l) do {} while (0)
#define sigfillset(l) do {} while (0)
#define recalc_sigpending(l) do {} while (0)
RETURN(rc);
}
-#ifdef HAVE_UNLOCKED_IOCTL
static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
-#else
-static int ll_dir_ioctl(struct inode *unuse, struct file *file,
- unsigned int cmd, unsigned long arg)
-#endif
{
struct inode *inode = file->f_dentry->d_inode;
struct ll_sb_info *sbi = ll_i2sbi(inode);
.release = ll_dir_release,
.read = generic_read_dir,
.readdir = ll_readdir,
-#ifdef HAVE_UNLOCKED_IOCTL
.unlocked_ioctl = ll_dir_ioctl,
-#else
- .ioctl = ll_dir_ioctl,
-#endif
.fsync = ll_fsync,
};
RETURN(rc);
}
-#ifdef HAVE_UNLOCKED_IOCTL
long ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
struct inode *inode = file->f_dentry->d_inode;
-#else
-int ll_file_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
- unsigned long arg)
-{
-#endif
struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
int flags;
.READ_METHOD = READ_FUNCTION,
.write = ll_file_write,
.WRITE_METHOD = WRITE_FUNCTION,
-#ifdef HAVE_UNLOCKED_IOCTL
.unlocked_ioctl = ll_file_ioctl,
-#else
- .ioctl = ll_file_ioctl,
-#endif
.open = ll_file_open,
.release = ll_file_release,
.mmap = ll_file_mmap,
.READ_METHOD = READ_FUNCTION,
.write = ll_file_write,
.WRITE_METHOD = WRITE_FUNCTION,
-#ifdef HAVE_UNLOCKED_IOCTL
.unlocked_ioctl = ll_file_ioctl,
-#else
- .ioctl = ll_file_ioctl,
-#endif
.open = ll_file_open,
.release = ll_file_release,
.mmap = ll_file_mmap,
.READ_METHOD = READ_FUNCTION,
.write = ll_file_write,
.WRITE_METHOD = WRITE_FUNCTION,
-#ifdef HAVE_UNLOCKED_IOCTL
.unlocked_ioctl = ll_file_ioctl,
-#else
- .ioctl = ll_file_ioctl,
-#endif
.open = ll_file_open,
.release = ll_file_release,
.mmap = ll_file_mmap,
int err, blocksize, csize, boffs, osize = size;
/* prevent reading after eof */
- cfs_lock_kernel();
+ spin_lock(&inode->i_lock);
if (i_size_read(inode) < *offs + size) {
size = i_size_read(inode) - *offs;
- cfs_unlock_kernel();
+ spin_unlock(&inode->i_lock);
if (size < 0) {
CDEBUG(D_EXT2, "size %llu is too short for read @%llu\n",
i_size_read(inode), *offs);
return 0;
}
} else {
- cfs_unlock_kernel();
+ spin_unlock(&inode->i_lock);
}
blocksize = 1 << inode->i_blkbits;
/* correct in-core and on-disk sizes */
if (new_size > i_size_read(inode)) {
- cfs_lock_kernel();
+ spin_lock(&inode->i_lock);
if (new_size > i_size_read(inode))
i_size_write(inode, new_size);
if (i_size_read(inode) > EXT3_I(inode)->i_disksize)
EXT3_I(inode)->i_disksize = i_size_read(inode);
- if (i_size_read(inode) > old_size)
+ if (i_size_read(inode) > old_size) {
+ spin_unlock(&inode->i_lock);
mark_inode_dirty(inode);
- cfs_unlock_kernel();
+ } else {
+ spin_unlock(&inode->i_lock);
+ }
}
if (err == 0)
static void unlock_mntput(struct vfsmount *mnt)
{
- if (kernel_locked()) {
- cfs_unlock_kernel();
- mntput(mnt);
- cfs_lock_kernel();
- } else {
- mntput(mnt);
- }
+#if HAVE_KERNEL_LOCKED
+ /* for kernel < 2.6.37 */
+ if (kernel_locked()) {
+ unlock_kernel();
+ mntput(mnt);
+ lock_kernel();
+ }
+#else
+ mntput(mnt);
+#endif
}
static int lustre_put_lsi(struct super_block *sb);
int i;
ENTRY;
-#ifndef HAVE_UNLOCKED_IOCTL
- cfs_unlock_kernel();
-#endif
-
memset(&dummy_oti, 0, sizeof(dummy_oti));
oa = &data->ioc_obdo1;
ldlm_lock_decref(&ack_lock->lock, ack_lock->mode);
}
-#ifndef HAVE_UNLOCKED_IOCTL
- cfs_lock_kernel();
-#endif
-
return rc;
}