Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 95066
b: refs/heads/master
c: c4755d1
h: refs/heads/master
v: v3
  • Loading branch information
Linus Torvalds committed Apr 30, 2008
1 parent 62e2b8d commit ffd0d48
Show file tree
Hide file tree
Showing 42 changed files with 398 additions and 940 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f1fa3342e271029f93d323ca664809b94594fe04
refs/heads/master: c4755d16fce9a4cdbb316c17657444856821bd4b
1 change: 1 addition & 0 deletions trunk/drivers/edac/pasemi_edac.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <linux/pci.h>
#include <linux/pci_ids.h>
#include <linux/slab.h>
#include <linux/edac.h>
#include "edac_core.h"

#define MODULE_NAME "pasemi_edac"
Expand Down
13 changes: 13 additions & 0 deletions trunk/fs/xfs/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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.
60 changes: 24 additions & 36 deletions trunk/fs/xfs/linux-2.6/mrlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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) {
mrp->mr_writer = 0;
up_write(&mrp->mr_lock);
} else {
up_read(&mrp->mr_lock);
}
#ifdef DEBUG
mrp->mr_writer = 0;
#endif
up_write(&mrp->mr_lock);
}

static inline void mrdemote(mrlock_t *mrp)
static inline void mrunlock_shared(mrlock_t *mrp)
{
mrp->mr_writer = 0;
downgrade_write(&mrp->mr_lock);
up_read(&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)
static inline void mrdemote(mrlock_t *mrp)
{
if (mrp && type == MR_UPDATE)
return mrp->mr_writer;
return 1;
}
#ifdef DEBUG
mrp->mr_writer = 0;
#endif
downgrade_write(&mrp->mr_lock);
}

#endif /* __XFS_SUPPORT_MRLOCK_H__ */
2 changes: 1 addition & 1 deletion trunk/fs/xfs/linux-2.6/xfs_buf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/xfs/linux-2.6/xfs_export.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
75 changes: 0 additions & 75 deletions trunk/fs/xfs/linux-2.6/xfs_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 */
8 changes: 4 additions & 4 deletions trunk/fs/xfs/linux-2.6/xfs_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ xfs_vget_fsop_handlereq(
return error;
if (ip == NULL)
return XFS_ERROR(EIO);
if (ip->i_d.di_mode == 0 || ip->i_d.di_gen != igen) {
if (ip->i_d.di_gen != igen) {
xfs_iput_new(ip, XFS_ILOCK_SHARED);
return XFS_ERROR(ENOENT);
}
Expand Down Expand Up @@ -505,14 +505,14 @@ xfs_attrmulti_attr_get(
{
char *kbuf;
int error = EFAULT;

if (*len > XATTR_SIZE_MAX)
return EINVAL;
kbuf = kmalloc(*len, GFP_KERNEL);
if (!kbuf)
return ENOMEM;

error = xfs_attr_get(XFS_I(inode), name, kbuf, (int *)len, flags, NULL);
error = xfs_attr_get(XFS_I(inode), name, kbuf, (int *)len, flags);
if (error)
goto out_kfree;

Expand Down Expand Up @@ -546,7 +546,7 @@ xfs_attrmulti_attr_set(

if (copy_from_user(kbuf, ubuf, len))
goto out_kfree;

error = xfs_attr_set(XFS_I(inode), name, kbuf, len, flags);

out_kfree:
Expand Down
3 changes: 2 additions & 1 deletion trunk/fs/xfs/linux-2.6/xfs_iops.c
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,8 @@ xfs_vn_rename(
xfs_dentry_to_name(&nname, ndentry);

error = xfs_rename(XFS_I(odir), &oname, XFS_I(odentry->d_inode),
XFS_I(ndir), &nname);
XFS_I(ndir), &nname, new_inode ?
XFS_I(new_inode) : NULL);
if (likely(!error)) {
if (new_inode)
xfs_validate_fields(new_inode);
Expand Down
1 change: 0 additions & 1 deletion trunk/fs/xfs/linux-2.6/xfs_linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@
/*
* Feature macros (disable/enable)
*/
#define HAVE_SPLICE /* a splice(2) exists in 2.6, but not in 2.4 */
#ifdef CONFIG_SMP
#define HAVE_PERCPU_SB /* per cpu superblock counters are a 2.6 feature */
#else
Expand Down
21 changes: 9 additions & 12 deletions trunk/fs/xfs/linux-2.6/xfs_lrw.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ xfs_zero_last_block(
int error = 0;
xfs_bmbt_irec_t imap;

ASSERT(ismrlocked(&ip->i_lock, MR_UPDATE) != 0);
ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));

zero_offset = XFS_B_FSB_OFFSET(mp, isize);
if (zero_offset == 0) {
Expand Down Expand Up @@ -425,14 +425,14 @@ xfs_zero_last_block(
* out sync. We need to drop the ilock while we do this so we
* don't deadlock when the buffer cache calls back to us.
*/
xfs_iunlock(ip, XFS_ILOCK_EXCL| XFS_EXTSIZE_RD);
xfs_iunlock(ip, XFS_ILOCK_EXCL);

zero_len = mp->m_sb.sb_blocksize - zero_offset;
if (isize + zero_len > offset)
zero_len = offset - isize;
error = xfs_iozero(ip, isize, zero_len);

xfs_ilock(ip, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD);
xfs_ilock(ip, XFS_ILOCK_EXCL);
ASSERT(error >= 0);
return error;
}
Expand Down Expand Up @@ -465,8 +465,7 @@ xfs_zero_eof(
int error = 0;
xfs_bmbt_irec_t imap;

ASSERT(ismrlocked(&ip->i_lock, MR_UPDATE));
ASSERT(ismrlocked(&ip->i_iolock, MR_UPDATE));
ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_IOLOCK_EXCL));
ASSERT(offset > isize);

/*
Expand All @@ -475,8 +474,7 @@ xfs_zero_eof(
*/
error = xfs_zero_last_block(ip, offset, isize);
if (error) {
ASSERT(ismrlocked(&ip->i_lock, MR_UPDATE));
ASSERT(ismrlocked(&ip->i_iolock, MR_UPDATE));
ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_IOLOCK_EXCL));
return error;
}

Expand Down Expand Up @@ -507,8 +505,7 @@ xfs_zero_eof(
error = xfs_bmapi(NULL, ip, start_zero_fsb, zero_count_fsb,
0, NULL, 0, &imap, &nimaps, NULL, NULL);
if (error) {
ASSERT(ismrlocked(&ip->i_lock, MR_UPDATE));
ASSERT(ismrlocked(&ip->i_iolock, MR_UPDATE));
ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_IOLOCK_EXCL));
return error;
}
ASSERT(nimaps > 0);
Expand All @@ -532,7 +529,7 @@ xfs_zero_eof(
* Drop the inode lock while we're doing the I/O.
* We'll still have the iolock to protect us.
*/
xfs_iunlock(ip, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD);
xfs_iunlock(ip, XFS_ILOCK_EXCL);

zero_off = XFS_FSB_TO_B(mp, start_zero_fsb);
zero_len = XFS_FSB_TO_B(mp, imap.br_blockcount);
Expand All @@ -548,13 +545,13 @@ xfs_zero_eof(
start_zero_fsb = imap.br_startoff + imap.br_blockcount;
ASSERT(start_zero_fsb <= (end_zero_fsb + 1));

xfs_ilock(ip, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD);
xfs_ilock(ip, XFS_ILOCK_EXCL);
}

return 0;

out_lock:
xfs_ilock(ip, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD);
xfs_ilock(ip, XFS_ILOCK_EXCL);
ASSERT(error >= 0);
return error;
}
Expand Down
Loading

0 comments on commit ffd0d48

Please sign in to comment.