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

Commit 9ea319b6 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* git://oss.sgi.com:8090/xfs/linux-2.6: (45 commits)
  [XFS] Fix use after free in xfs_log_done().
  [XFS] Make xfs_bmap_*_count_leaves void.
  [XFS] Use KM_NOFS for debug trace buffers
  [XFS] use KM_MAYFAIL in xfs_mountfs
  [XFS] refactor xfs_mount_free
  [XFS] don't call xfs_freesb from xfs_unmountfs
  [XFS] xfs_unmountfs should return void
  [XFS] cleanup xfs_mountfs
  [XFS] move root inode IRELE into xfs_unmountfs
  [XFS] stop using file_update_time
  [XFS] optimize xfs_ichgtime
  [XFS] update timestamp in xfs_ialloc manually
  [XFS] remove the sema_t from XFS.
  [XFS] replace dquot flush semaphore with a completion
  [XFS] replace inode flush semaphore with a completion
  [XFS] extend completions to provide XFS object flush requirements
  [XFS] replace the XFS buf iodone semaphore with a completion
  [XFS] clean up stale references to semaphores
  [XFS] use get_unaligned_* helpers
  [XFS] Fix compile failure in xfs_buf_trace()
  ...
parents 3e11acd4 c6a7b0f8
Loading
Loading
Loading
Loading

fs/xfs/linux-2.6/sema.h

deleted100644 → 0
+0 −52
Original line number Diff line number Diff line
/*
 * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc.
 * All Rights Reserved.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it would be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write the Free Software Foundation,
 * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
#ifndef __XFS_SUPPORT_SEMA_H__
#define __XFS_SUPPORT_SEMA_H__

#include <linux/time.h>
#include <linux/wait.h>
#include <linux/semaphore.h>
#include <asm/atomic.h>

/*
 * sema_t structure just maps to struct semaphore in Linux kernel.
 */

typedef struct semaphore sema_t;

#define initnsema(sp, val, name)	sema_init(sp, val)
#define psema(sp, b)			down(sp)
#define vsema(sp)			up(sp)
#define freesema(sema)			do { } while (0)

static inline int issemalocked(sema_t *sp)
{
	return down_trylock(sp) || (up(sp), 0);
}

/*
 * Map cpsema (try to get the sema) to down_trylock. We need to switch
 * the return values since cpsema returns 1 (acquired) 0 (failed) and
 * down_trylock returns the reverse 0 (acquired) 1 (failed).
 */
static inline int cpsema(sema_t *sp)
{
	return down_trylock(sp) ? 0 : 1;
}

#endif /* __XFS_SUPPORT_SEMA_H__ */
+1 −2
Original line number Diff line number Diff line
@@ -73,7 +73,6 @@ xfs_page_trace(
	unsigned long	pgoff)
{
	xfs_inode_t	*ip;
	bhv_vnode_t	*vp = vn_from_inode(inode);
	loff_t		isize = i_size_read(inode);
	loff_t		offset = page_offset(page);
	int		delalloc = -1, unmapped = -1, unwritten = -1;
@@ -81,7 +80,7 @@ xfs_page_trace(
	if (page_has_buffers(page))
		xfs_count_page_state(page, &delalloc, &unmapped, &unwritten);

	ip = xfs_vtoi(vp);
	ip = XFS_I(inode);
	if (!ip->i_rwtrace)
		return;

+6 −10
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ xfs_buf_trace(
		bp, id,
		(void *)(unsigned long)bp->b_flags,
		(void *)(unsigned long)bp->b_hold.counter,
		(void *)(unsigned long)bp->b_sema.count.counter,
		(void *)(unsigned long)bp->b_sema.count,
		(void *)current,
		data, ra,
		(void *)(unsigned long)((bp->b_file_offset>>32) & 0xffffffff),
@@ -253,7 +253,7 @@ _xfs_buf_initialize(

	memset(bp, 0, sizeof(xfs_buf_t));
	atomic_set(&bp->b_hold, 1);
	init_MUTEX_LOCKED(&bp->b_iodonesema);
	init_completion(&bp->b_iowait);
	INIT_LIST_HEAD(&bp->b_list);
	INIT_LIST_HEAD(&bp->b_hash_list);
	init_MUTEX_LOCKED(&bp->b_sema); /* held, no waiters */
@@ -838,6 +838,7 @@ xfs_buf_rele(
		return;
	}

	ASSERT(atomic_read(&bp->b_hold) > 0);
	if (atomic_dec_and_lock(&bp->b_hold, &hash->bh_lock)) {
		if (bp->b_relse) {
			atomic_inc(&bp->b_hold);
@@ -851,11 +852,6 @@ xfs_buf_rele(
			spin_unlock(&hash->bh_lock);
			xfs_buf_free(bp);
		}
	} else {
		/*
		 * Catch reference count leaks
		 */
		ASSERT(atomic_read(&bp->b_hold) >= 0);
	}
}

@@ -1037,7 +1033,7 @@ xfs_buf_ioend(
			xfs_buf_iodone_work(&bp->b_iodone_work);
		}
	} else {
		up(&bp->b_iodonesema);
		complete(&bp->b_iowait);
	}
}

@@ -1275,7 +1271,7 @@ xfs_buf_iowait(
	XB_TRACE(bp, "iowait", 0);
	if (atomic_read(&bp->b_io_remaining))
		blk_run_address_space(bp->b_target->bt_mapping);
	down(&bp->b_iodonesema);
	wait_for_completion(&bp->b_iowait);
	XB_TRACE(bp, "iowaited", (long)bp->b_error);
	return bp->b_error;
}
@@ -1799,7 +1795,7 @@ int __init
xfs_buf_init(void)
{
#ifdef XFS_BUF_TRACE
	xfs_buf_trace_buf = ktrace_alloc(XFS_BUF_TRACE_SIZE, KM_SLEEP);
	xfs_buf_trace_buf = ktrace_alloc(XFS_BUF_TRACE_SIZE, KM_NOFS);
#endif

	xfs_buf_zone = kmem_zone_init_flags(sizeof(xfs_buf_t), "xfs_buf",
+2 −2
Original line number Diff line number Diff line
@@ -157,7 +157,7 @@ typedef struct xfs_buf {
	xfs_buf_iodone_t	b_iodone;	/* I/O completion function */
	xfs_buf_relse_t		b_relse;	/* releasing function */
	xfs_buf_bdstrat_t	b_strat;	/* pre-write function */
	struct semaphore	b_iodonesema;	/* Semaphore for I/O waiters */
	struct completion	b_iowait;	/* queue for I/O waiters */
	void			*b_fspriv;
	void			*b_fspriv2;
	void			*b_fspriv3;
@@ -352,7 +352,7 @@ extern void xfs_buf_trace(xfs_buf_t *, char *, void *, void *);
#define XFS_BUF_CPSEMA(bp)	(xfs_buf_cond_lock(bp) == 0)
#define XFS_BUF_VSEMA(bp)	xfs_buf_unlock(bp)
#define XFS_BUF_PSEMA(bp,x)	xfs_buf_lock(bp)
#define XFS_BUF_V_IODONESEMA(bp) up(&bp->b_iodonesema);
#define XFS_BUF_FINISH_IOWAIT(bp)	complete(&bp->b_iowait);

#define XFS_BUF_SET_TARGET(bp, target)	((bp)->b_target = (target))
#define XFS_BUF_TARGET(bp)		((bp)->b_target)
+5 −5
Original line number Diff line number Diff line
@@ -139,7 +139,7 @@ xfs_nfs_get_inode(
	}

	xfs_iunlock(ip, XFS_ILOCK_SHARED);
	return ip->i_vnode;
	return VFS_I(ip);
}

STATIC struct dentry *
@@ -167,7 +167,7 @@ xfs_fs_fh_to_dentry(struct super_block *sb, struct fid *fid,
	if (!inode)
		return NULL;
	if (IS_ERR(inode))
		return ERR_PTR(PTR_ERR(inode));
		return ERR_CAST(inode);
	result = d_alloc_anon(inode);
	if (!result) {
		iput(inode);
@@ -198,7 +198,7 @@ xfs_fs_fh_to_parent(struct super_block *sb, struct fid *fid,
	if (!inode)
		return NULL;
	if (IS_ERR(inode))
		return ERR_PTR(PTR_ERR(inode));
		return ERR_CAST(inode);
	result = d_alloc_anon(inode);
	if (!result) {
		iput(inode);
@@ -219,9 +219,9 @@ xfs_fs_get_parent(
	if (unlikely(error))
		return ERR_PTR(-error);

	parent = d_alloc_anon(cip->i_vnode);
	parent = d_alloc_anon(VFS_I(cip));
	if (unlikely(!parent)) {
		iput(cip->i_vnode);
		iput(VFS_I(cip));
		return ERR_PTR(-ENOMEM);
	}
	return parent;
Loading