Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 95018
b: refs/heads/master
c: 9fc7c63
h: refs/heads/master
v: v3
  • Loading branch information
Josef Bacik authored and Theodore Ts'o committed Apr 17, 2008
1 parent 6c01311 commit e16695b
Show file tree
Hide file tree
Showing 44 changed files with 953 additions and 414 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: c15a2434ed4868cad99278ac4d4ae4de9de62e02
refs/heads/master: 9fc7c63a1d6e9920038ced782390a54888ed70a6
1 change: 0 additions & 1 deletion trunk/drivers/edac/pasemi_edac.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#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
16 changes: 0 additions & 16 deletions trunk/fs/jbd2/commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -519,22 +519,6 @@ void jbd2_journal_commit_transaction(journal_t *journal)

jbd_debug (3, "JBD: commit phase 2\n");

/*
* First, drop modified flag: all accesses to the buffers
* will be tracked for a new trasaction only -bzzz
*/
spin_lock(&journal->j_list_lock);
if (commit_transaction->t_buffers) {
new_jh = jh = commit_transaction->t_buffers->b_tnext;
do {
J_ASSERT_JH(new_jh, new_jh->b_modified == 1 ||
new_jh->b_modified == 0);
new_jh->b_modified = 0;
new_jh = new_jh->b_tnext;
} while (new_jh != jh);
}
spin_unlock(&journal->j_list_lock);

/*
* Now start flushing things to disk, in the order they appear
* on the transaction lists. Data blocks go first.
Expand Down
13 changes: 13 additions & 0 deletions trunk/fs/jbd2/transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,12 @@ do_get_write_access(handle_t *handle, struct journal_head *jh,
jh->b_next_transaction == transaction)
goto done;

/*
* this is the first time this transaction is touching this buffer,
* reset the modified flag
*/
jh->b_modified = 0;

/*
* If there is already a copy-out version of this buffer, then we don't
* need to make another one
Expand Down Expand Up @@ -829,9 +835,16 @@ int jbd2_journal_get_create_access(handle_t *handle, struct buffer_head *bh)

if (jh->b_transaction == NULL) {
jh->b_transaction = transaction;

/* first access by this transaction */
jh->b_modified = 0;

JBUFFER_TRACE(jh, "file as BJ_Reserved");
__jbd2_journal_file_buffer(jh, transaction, BJ_Reserved);
} else if (jh->b_transaction == journal->j_committing_transaction) {
/* first access by this transaction */
jh->b_modified = 0;

JBUFFER_TRACE(jh, "set next transaction");
jh->b_next_transaction = transaction;
}
Expand Down
13 changes: 0 additions & 13 deletions trunk/fs/xfs/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,3 @@ 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: 36 additions & 24 deletions trunk/fs/xfs/linux-2.6/mrlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,29 @@

#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 @@ -46,11 +51,10 @@ 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 @@ -60,31 +64,39 @@ 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_excl(mrlock_t *mrp)
static inline void mrunlock(mrlock_t *mrp)
{
#ifdef DEBUG
mrp->mr_writer = 0;
#endif
up_write(&mrp->mr_lock);
}

static inline void mrunlock_shared(mrlock_t *mrp)
{
up_read(&mrp->mr_lock);
if (mrp->mr_writer) {
mrp->mr_writer = 0;
up_write(&mrp->mr_lock);
} else {
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__ */
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 bp->b_sema.count;
return atomic_read(&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_gen != generation) {
if (!ip->i_d.di_mode || ip->i_d.di_gen != generation) {
xfs_iput_new(ip, XFS_ILOCK_SHARED);
return ERR_PTR(-ENOENT);
}
Expand Down
75 changes: 75 additions & 0 deletions trunk/fs/xfs/linux-2.6/xfs_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
#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 @@ -199,6 +202,22 @@ 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 @@ -367,6 +386,11 @@ 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 @@ -413,6 +437,47 @@ 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 @@ -481,3 +546,13 @@ 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_gen != igen) {
if (ip->i_d.di_mode == 0 || 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);
error = xfs_attr_get(XFS_I(inode), name, kbuf, (int *)len, flags, NULL);
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: 1 addition & 2 deletions trunk/fs/xfs/linux-2.6/xfs_iops.c
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,7 @@ 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, new_inode ?
XFS_I(new_inode) : NULL);
XFS_I(ndir), &nname);
if (likely(!error)) {
if (new_inode)
xfs_validate_fields(new_inode);
Expand Down
1 change: 1 addition & 0 deletions trunk/fs/xfs/linux-2.6/xfs_linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
/*
* 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
Loading

0 comments on commit e16695b

Please sign in to comment.