Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c15a2434 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge branch 'for-linus' of git://oss.sgi.com:8090/xfs/xfs-2.6

* 'for-linus' of git://oss.sgi.com:8090/xfs/xfs-2.6: (24 commits)
  [XFS] Fix build failure after enabling CONFIG_XFS_DEBUG
  [XFS] remove dmapi cruft in xfs_file.c
  [XFS] remove sendfile leftovers
  [XFS] allow enabling CONFIG_XFS_DEBUG
  [XFS] Don't initialise new inode generation numbers to zero
  [XFS] Fix check for block zero access in xfs_write_iomap_allocate()
  [XFS] Don't double count reserved block changes on UP.
  [XFS] remove xfs_log_ticket_zone on rmmod
  [XFS] fix non-smp xfs build
  [XFS] Fix broken HAVE_SPLICE removal commit.
  [XFS] kill XFS_ICSB_SB_LOCKED
  [XFS] split xfs_icsb_balance_counter
  [XFS] Add xfs_icsb_sync_counters_locked for when m_sb_lock already held
  [XFS] Cleanup xfs_attr a bit with xfs_name and remove cred
  [XFS] kill usesless IHOLD calls in xfs_remove and xfs_rmdir
  [XFS] kill parent == child checks in xfs_remove and xfs_rmdir
  [XFS] kill usesless IHOLD calls in xfs_rename
  [XFS] remove manual lookup from xfs_rename and simplify locking
  [XFS] shrink mrlock_t
  [XFS] simplify xfs_lookup
  ...
parents a94a630a adaa693b
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -64,3 +64,16 @@ config XFS_RT
	  See the xfs man page in section 5 for additional information.

	  If unsure, say N.

config XFS_DEBUG
	bool "XFS Debugging support (EXPERIMENTAL)"
	depends on XFS_FS && EXPERIMENTAL
	help
	  Say Y here to get an XFS build with many debugging features,
	  including ASSERT checks, function wrappers around macros,
	  and extra sanity-checking functions in various code paths.

	  Note that the resulting code will be HUGE and SLOW, and probably
	  not useful unless you are debugging a particular problem.

	  Say N unless you are an XFS developer, or you play one on TV.
+24 −36
Original line number Diff line number Diff line
@@ -20,29 +20,24 @@

#include <linux/rwsem.h>

enum { MR_NONE, MR_ACCESS, MR_UPDATE };

typedef struct {
	struct rw_semaphore	mr_lock;
#ifdef DEBUG
	int			mr_writer;
#endif
} mrlock_t;

#ifdef DEBUG
#define mrinit(mrp, name)	\
	do { (mrp)->mr_writer = 0; init_rwsem(&(mrp)->mr_lock); } while (0)
#else
#define mrinit(mrp, name)	\
	do { init_rwsem(&(mrp)->mr_lock); } while (0)
#endif

#define mrlock_init(mrp, t,n,s)	mrinit(mrp, n)
#define mrfree(mrp)		do { } while (0)

static inline void mraccess(mrlock_t *mrp)
{
	down_read(&mrp->mr_lock);
}

static inline void mrupdate(mrlock_t *mrp)
{
	down_write(&mrp->mr_lock);
	mrp->mr_writer = 1;
}

static inline void mraccess_nested(mrlock_t *mrp, int subclass)
{
	down_read_nested(&mrp->mr_lock, subclass);
@@ -51,10 +46,11 @@ static inline void mraccess_nested(mrlock_t *mrp, int subclass)
static inline void mrupdate_nested(mrlock_t *mrp, int subclass)
{
	down_write_nested(&mrp->mr_lock, subclass);
#ifdef DEBUG
	mrp->mr_writer = 1;
#endif
}


static inline int mrtryaccess(mrlock_t *mrp)
{
	return down_read_trylock(&mrp->mr_lock);
@@ -64,39 +60,31 @@ static inline int mrtryupdate(mrlock_t *mrp)
{
	if (!down_write_trylock(&mrp->mr_lock))
		return 0;
#ifdef DEBUG
	mrp->mr_writer = 1;
#endif
	return 1;
}

static inline void mrunlock(mrlock_t *mrp)
static inline void mrunlock_excl(mrlock_t *mrp)
{
	if (mrp->mr_writer) {
#ifdef DEBUG
	mrp->mr_writer = 0;
#endif
	up_write(&mrp->mr_lock);
	} else {
		up_read(&mrp->mr_lock);
}

static inline void mrunlock_shared(mrlock_t *mrp)
{
	up_read(&mrp->mr_lock);
}

static inline void mrdemote(mrlock_t *mrp)
{
#ifdef DEBUG
	mrp->mr_writer = 0;
#endif
	downgrade_write(&mrp->mr_lock);
}

#ifdef DEBUG
/*
 * Debug-only routine, without some platform-specific asm code, we can
 * now only answer requests regarding whether we hold the lock for write
 * (reader state is outside our visibility, we only track writer state).
 * Note: means !ismrlocked would give false positives, so don't do that.
 */
static inline int ismrlocked(mrlock_t *mrp, int type)
{
	if (mrp && type == MR_UPDATE)
		return mrp->mr_writer;
	return 1;
}
#endif

#endif /* __XFS_SUPPORT_MRLOCK_H__ */
+1 −1
Original line number Diff line number Diff line
@@ -886,7 +886,7 @@ int
xfs_buf_lock_value(
	xfs_buf_t		*bp)
{
	return atomic_read(&bp->b_sema.count);
	return bp->b_sema.count;
}
#endif

+1 −1
Original line number Diff line number Diff line
@@ -133,7 +133,7 @@ xfs_nfs_get_inode(
	if (!ip)
		return ERR_PTR(-EIO);

	if (!ip->i_d.di_mode || ip->i_d.di_gen != generation) {
	if (ip->i_d.di_gen != generation) {
		xfs_iput_new(ip, XFS_ILOCK_SHARED);
		return ERR_PTR(-ENOENT);
	}
+0 −75
Original line number Diff line number Diff line
@@ -43,9 +43,6 @@
#include <linux/smp_lock.h>

static struct vm_operations_struct xfs_file_vm_ops;
#ifdef CONFIG_XFS_DMAPI
static struct vm_operations_struct xfs_dmapi_file_vm_ops;
#endif

STATIC_INLINE ssize_t
__xfs_file_read(
@@ -202,22 +199,6 @@ xfs_file_fsync(
			(xfs_off_t)0, (xfs_off_t)-1);
}

#ifdef CONFIG_XFS_DMAPI
STATIC int
xfs_vm_fault(
	struct vm_area_struct	*vma,
	struct vm_fault	*vmf)
{
	struct inode	*inode = vma->vm_file->f_path.dentry->d_inode;
	bhv_vnode_t	*vp = vn_from_inode(inode);

	ASSERT_ALWAYS(vp->v_vfsp->vfs_flag & VFS_DMI);
	if (XFS_SEND_MMAP(XFS_VFSTOM(vp->v_vfsp), vma, 0))
		return VM_FAULT_SIGBUS;
	return filemap_fault(vma, vmf);
}
#endif /* CONFIG_XFS_DMAPI */

/*
 * Unfortunately we can't just use the clean and simple readdir implementation
 * below, because nfs might call back into ->lookup from the filldir callback
@@ -386,11 +367,6 @@ xfs_file_mmap(
	vma->vm_ops = &xfs_file_vm_ops;
	vma->vm_flags |= VM_CAN_NONLINEAR;

#ifdef CONFIG_XFS_DMAPI
	if (XFS_M(filp->f_path.dentry->d_inode->i_sb)->m_flags & XFS_MOUNT_DMAPI)
		vma->vm_ops = &xfs_dmapi_file_vm_ops;
#endif /* CONFIG_XFS_DMAPI */

	file_accessed(filp);
	return 0;
}
@@ -437,47 +413,6 @@ xfs_file_ioctl_invis(
	return error;
}

#ifdef CONFIG_XFS_DMAPI
#ifdef HAVE_VMOP_MPROTECT
STATIC int
xfs_vm_mprotect(
	struct vm_area_struct *vma,
	unsigned int	newflags)
{
	struct inode	*inode = vma->vm_file->f_path.dentry->d_inode;
	struct xfs_mount *mp = XFS_M(inode->i_sb);
	int		error = 0;

	if (mp->m_flags & XFS_MOUNT_DMAPI) {
		if ((vma->vm_flags & VM_MAYSHARE) &&
		    (newflags & VM_WRITE) && !(vma->vm_flags & VM_WRITE))
			error = XFS_SEND_MMAP(mp, vma, VM_WRITE);
	}
	return error;
}
#endif /* HAVE_VMOP_MPROTECT */
#endif /* CONFIG_XFS_DMAPI */

#ifdef HAVE_FOP_OPEN_EXEC
/* If the user is attempting to execute a file that is offline then
 * we have to trigger a DMAPI READ event before the file is marked as busy
 * otherwise the invisible I/O will not be able to write to the file to bring
 * it back online.
 */
STATIC int
xfs_file_open_exec(
	struct inode	*inode)
{
	struct xfs_mount *mp = XFS_M(inode->i_sb);
	struct xfs_inode *ip = XFS_I(inode);

	if (unlikely(mp->m_flags & XFS_MOUNT_DMAPI) &&
	             DM_EVENT_ENABLED(ip, DM_EVENT_READ))
		return -XFS_SEND_DATA(mp, DM_EVENT_READ, ip, 0, 0, 0, NULL);
	return 0;
}
#endif /* HAVE_FOP_OPEN_EXEC */

/*
 * mmap()d file has taken write protection fault and is being made
 * writable. We can set the page state up correctly for a writable
@@ -546,13 +481,3 @@ static struct vm_operations_struct xfs_file_vm_ops = {
	.fault		= filemap_fault,
	.page_mkwrite	= xfs_vm_page_mkwrite,
};

#ifdef CONFIG_XFS_DMAPI
static struct vm_operations_struct xfs_dmapi_file_vm_ops = {
	.fault		= xfs_vm_fault,
	.page_mkwrite	= xfs_vm_page_mkwrite,
#ifdef HAVE_VMOP_MPROTECT
	.mprotect	= xfs_vm_mprotect,
#endif
};
#endif /* CONFIG_XFS_DMAPI */
Loading