Commit 13c0ce85 authored by Linus Torvalds's avatar Linus Torvalds

Merge master.kernel.org:/home/hch/BK/xfs/linux-2.5

into penguin.transmeta.com:/home/penguin/torvalds/repositories/kernel/linux
parents 51a43a9a 41f84493
......@@ -42,6 +42,7 @@
#include <linux/sched.h>
#include <linux/bitops.h>
#include <linux/major.h>
#include <linux/pagemap.h>
#include <linux/vfs.h>
#include <asm/page.h>
......@@ -169,7 +170,6 @@ typedef struct xfs_dirent { /* data from readdir() */
#define DEFAULT_PROJID 0
#define dfltprid DEFAULT_PROJID
#define MAXNAMELEN 256
#define MAXPATHLEN 1024
#define FINVIS 0x0100 /* don't update timestamps - XFS */
......
......@@ -872,13 +872,12 @@ XFS_log_write_unmount_ro(bhv_desc_t *bdp)
int error;
mp = XFS_BHVTOM(bdp);
xfs_binval(mp->m_ddev_targp);
pagebuf_delwri_flush(mp->m_ddev_targp, PBDF_WAIT, &pincount);
xfs_finish_reclaim_all(mp);
do {
xfs_log_force(mp, (xfs_lsn_t)0, XFS_LOG_FORCE | XFS_LOG_SYNC);
VFS_SYNC(XFS_MTOVFS(mp), SYNC_ATTR|SYNC_WAIT, NULL, error);
pagebuf_delwri_flush(mp->m_ddev_targp,
PBDF_WAIT, &pincount);
pagebuf_delwri_flush(mp->m_ddev_targp, PBDF_WAIT, &pincount);
if (pincount == 0) {delay(50); count++;}
} while (count < 2);
......
......@@ -671,13 +671,14 @@ extern void vn_rele(struct vnode *);
#define VN_HOLD(vp) ((void)vn_hold(vp))
#define VN_RELE(vp) (iput(LINVFS_GET_IP(vp)))
#endif /* ! (defined(CONFIG_XFS_VNODE_TRACING) */
#endif /* ! (defined(CONFIG_XFS_VNODE_TRACING)) */
/*
* Vname handling macros.
*/
#define VNAME(dentry) ((char *) (dentry)->d_name.name)
#define VNAMELEN(dentry) ((dentry)->d_name.len)
#define VNAME_TO_VNODE(dentry) (LINVFS_GET_VP((dentry)->d_inode))
/*
* Vnode spinlock manipulation.
......
......@@ -1108,7 +1108,7 @@ _pagebuf_wait_unpin(
* pagebuf_iodone
*
* pagebuf_iodone marks a buffer for which I/O is in progress
* done with respect to that I/O. The pb_done routine, if
* done with respect to that I/O. The pb_iodone routine, if
* present, will be called as a side-effect.
*/
void
......@@ -1173,7 +1173,7 @@ pagebuf_ioerror( /* mark/clear buffer error flag */
* pagebuf_iostart initiates I/O on a buffer, based on the flags supplied.
* If necessary, it will arrange for any disk space allocation required,
* and it will break up the request if the block mappings require it.
* An pb_iodone routine in the buffer supplied will only be called
* The pb_iodone routine in the buffer supplied will only be called
* when all of the subsidiary I/O requests, if any, have been completed.
* pagebuf_iostart calls the pagebuf_ioinitiate routine or
* pagebuf_iorequest, if the former routine is not defined, to start
......@@ -1317,7 +1317,7 @@ pagebuf_iorequest( /* start real I/O */
/* Set the count to 1 initially, this will stop an I/O
* completion callout which happens before we have started
* all the I/O from calling iodone too early
* all the I/O from calling pagebuf_iodone too early.
*/
atomic_set(&pb->pb_io_remaining, 1);
......
......@@ -41,7 +41,10 @@ static char message[256]; /* keep it off the stack */
static spinlock_t xfs_err_lock = SPIN_LOCK_UNLOCKED;
/* Translate from CE_FOO to KERN_FOO, err_level(CE_FOO) == KERN_FOO */
static char *err_level[8] = {KERN_EMERG, KERN_ALERT, KERN_CRIT,
#define XFS_MAX_ERR_LEVEL 7
#define XFS_ERR_MASK ((1 << 3) - 1)
static char *err_level[XFS_MAX_ERR_LEVEL+1] =
{KERN_EMERG, KERN_ALERT, KERN_CRIT,
KERN_ERR, KERN_WARNING, KERN_NOTICE,
KERN_INFO, KERN_DEBUG};
......@@ -82,15 +85,22 @@ void
cmn_err(register int level, char *fmt, ...)
{
char *fp = fmt;
int len;
int flags;
va_list ap;
spin_lock(&xfs_err_lock);
level &= XFS_ERR_MASK;
if (level > XFS_MAX_ERR_LEVEL)
level = XFS_MAX_ERR_LEVEL;
spin_lock_irqsave(&xfs_err_lock,flags);
va_start(ap, fmt);
if (*fmt == '!') fp++;
vsprintf(message, fp, ap);
printk("%s%s\n", err_level[level], message);
len = vsprintf(message, fp, ap);
if (message[len-1] != '\n')
strcat(message, "\n");
printk("%s%s", err_level[level], message);
va_end(ap);
spin_unlock(&xfs_err_lock);
spin_unlock_irqrestore(&xfs_err_lock,flags);
if (level == CE_PANIC)
BUG();
......@@ -100,10 +110,18 @@ cmn_err(register int level, char *fmt, ...)
void
icmn_err(register int level, char *fmt, va_list ap)
{
spin_lock(&xfs_err_lock);
vsprintf(message, fmt, ap);
spin_unlock(&xfs_err_lock);
printk("%s%s\n", err_level[level], message);
int len;
int flags;
level &= XFS_ERR_MASK;
if(level > XFS_MAX_ERR_LEVEL)
level = XFS_MAX_ERR_LEVEL;
spin_lock_irqsave(&xfs_err_lock,flags);
len = vsprintf(message, fmt, ap);
if (message[len-1] != '\n')
strcat(message, "\n");
spin_unlock_irqrestore(&xfs_err_lock,flags);
printk("%s%s", err_level[level], message);
if (level == CE_PANIC)
BUG();
}
......@@ -386,9 +386,6 @@ xfs_dir_lookup(xfs_trans_t *trans, xfs_inode_t *dp, char *name, int namelen,
int retval;
ASSERT((dp->i_d.di_mode & IFMT) == IFDIR);
if (namelen >= MAXNAMELEN) {
return(XFS_ERROR(EINVAL));
}
XFS_STATS_INC(xfsstats.xs_dir_lookup);
/*
......@@ -479,9 +476,6 @@ xfs_dir_replace(xfs_trans_t *trans, xfs_inode_t *dp, char *name, int namelen,
int retval;
ASSERT((dp->i_d.di_mode & IFMT) == IFDIR);
if (namelen >= MAXNAMELEN) {
return(XFS_ERROR(EINVAL));
}
if ((retval = xfs_dir_ino_validate(trans->t_mountp, inum)))
return retval;
......
......@@ -232,10 +232,8 @@ xfs_dir2_lookup(
int v; /* type-checking value */
ASSERT((dp->i_d.di_mode & IFMT) == IFDIR);
if (namelen >= MAXNAMELEN) {
return XFS_ERROR(EINVAL);
}
XFS_STATS_INC(xfsstats.xs_dir_lookup);
/*
* Fill in the arg structure for this request.
*/
......@@ -395,9 +393,7 @@ xfs_dir2_replace(
int v; /* type-checking value */
ASSERT((dp->i_d.di_mode & IFMT) == IFDIR);
if (namelen >= MAXNAMELEN) {
return XFS_ERROR(EINVAL);
}
if ((rval = xfs_dir_ino_validate(tp->t_mountp, inum))) {
return rval;
}
......
......@@ -414,11 +414,9 @@ void xfs_ifork_next_set(xfs_inode_t *ip, int w, int n);
* max file offset is 2^(31+PAGE_SHIFT) - 1 (due to linux page cache)
*
* NOTE: XFS itself can handle 2^63 - 1 (largest positive value of xfs_fsize_t)
* but Linux can't go above 2^(31+PAGE_SHIFT)-1: the Linux VM uses a 32 bit
* signed variable to index cache data, so 2^31 * PAGE_SIZE is as big as
* you can go.
* but this is the Linux limit.
*/
#define XFS_MAX_FILE_OFFSET ((long long)((1ULL<<(31+PAGE_SHIFT))-1ULL))
#define XFS_MAX_FILE_OFFSET MAX_LFS_FILESIZE
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ITOV)
struct vnode *xfs_itov(xfs_inode_t *ip);
......@@ -483,6 +481,7 @@ void xfs_iunlock_map_shared(xfs_inode_t *, uint);
void xfs_ifunlock(xfs_inode_t *);
void xfs_ireclaim(xfs_inode_t *);
int xfs_finish_reclaim(xfs_inode_t *, int, int);
int xfs_finish_reclaim_all(struct xfs_mount *);
/*
* xfs_inode.c prototypes.
......
......@@ -2952,7 +2952,6 @@ xlog_recover_process_iunlinks(xlog_t *log)
if (!error) {
ASSERT(ip->i_d.di_nlink == 0);
ASSERT(ip->i_d.di_mode != 0);
/* setup for the next pass */
agino = INT_GET(dip->di_next_unlinked,
......@@ -2970,7 +2969,9 @@ xlog_recover_process_iunlinks(xlog_t *log)
ip->i_d.di_dmevmask = 0;
/*
* Drop our reference to the
* If this is a new inode, handle
* it specially. Otherwise,
* just drop our reference to the
* inode. If there are no
* other references, this will
* send the inode to
......@@ -2978,6 +2979,9 @@ xlog_recover_process_iunlinks(xlog_t *log)
* truncate the file and free
* the inode.
*/
if (ip->i_d.di_mode == 0)
xfs_iput_new(ip, 0);
else
VN_RELE(XFS_ITOV(ip));
} else {
/*
......
......@@ -72,14 +72,13 @@ int xfs_rename_skip, xfs_rename_nskip;
* We are renaming dp1/name1 to dp2/name2.
*
* Return ENOENT if dp1 does not exist, other lookup errors, or 0 for success.
* Return EAGAIN if the caller needs to try again.
*/
STATIC int
xfs_lock_for_rename(
xfs_inode_t *dp1, /* old (source) directory inode */
xfs_inode_t *dp2, /* new (target) directory inode */
vname_t *dentry1, /* old entry name */
vname_t *dentry2, /* new entry name */
vname_t *vname1,/* old entry name */
vname_t *vname2,/* new entry name */
xfs_inode_t **ipp1, /* inode of old entry */
xfs_inode_t **ipp2, /* inode of new entry, if it
already exists, NULL otherwise. */
......@@ -102,7 +101,7 @@ xfs_lock_for_rename(
* to see if we still have the right inodes, directories, etc.
*/
lock_mode = xfs_ilock_map_shared(dp1);
error = xfs_get_dir_entry(dentry1, &ip1);
error = xfs_get_dir_entry(vname1, &ip1);
if (error) {
xfs_iunlock_map_shared(dp1, lock_mode);
return error;
......@@ -123,7 +122,7 @@ xfs_lock_for_rename(
}
error = xfs_dir_lookup_int(XFS_ITOBHV(dp2), lock_mode,
dentry2, &inum2, &ip2);
vname2, &inum2, &ip2);
if (error == ENOENT) { /* target does not need to exist. */
inum2 = 0;
} else if (error) {
......@@ -213,20 +212,15 @@ xfs_lock_for_rename(
int rename_which_error_return = 0;
#ifdef DEBUG
int xfs_rename_agains;
int xfs_renames;
#endif
/*
* xfs_rename
*/
int
xfs_rename(
bhv_desc_t *src_dir_bdp,
vname_t *src_dentry,
vname_t *src_vname,
vnode_t *target_dir_vp,
vname_t *target_dentry,
vname_t *target_vname,
cred_t *credp)
{
xfs_trans_t *tp;
......@@ -246,15 +240,11 @@ xfs_rename(
int spaceres;
int target_link_zero = 0;
int num_inodes;
char *src_name = VNAME(src_dentry);
char *target_name = VNAME(target_dentry);
int src_namelen;
int target_namelen;
#ifdef DEBUG
int retries;
char *src_name = VNAME(src_vname);
char *target_name = VNAME(target_vname);
int src_namelen = VNAMELEN(src_vname);
int target_namelen = VNAMELEN(target_vname);
xfs_renames++;
#endif
src_dir_vp = BHV_TO_VNODE(src_dir_bdp);
vn_trace_entry(src_dir_vp, "xfs_rename", (inst_t *)__return_address);
vn_trace_entry(target_dir_vp, "xfs_rename", (inst_t *)__return_address);
......@@ -268,14 +258,10 @@ xfs_rename(
if (target_dir_bdp == NULL) {
return XFS_ERROR(EXDEV);
}
src_namelen = VNAMELEN(src_dentry);
if (src_namelen >= MAXNAMELEN)
return XFS_ERROR(ENAMETOOLONG);
target_namelen = VNAMELEN(target_dentry);
if (target_namelen >= MAXNAMELEN)
return XFS_ERROR(ENAMETOOLONG);
src_dp = XFS_BHVTOI(src_dir_bdp);
target_dp = XFS_BHVTOI(target_dir_bdp);
if (DM_EVENT_ENABLED(src_dir_vp->v_vfsp, src_dp, DM_EVENT_RENAME) ||
DM_EVENT_ENABLED(target_dir_vp->v_vfsp,
target_dp, DM_EVENT_RENAME)) {
......@@ -290,9 +276,6 @@ xfs_rename(
}
/* Return through std_return after this point. */
#ifdef DEBUG
retries = 0;
#endif
/*
* Lock all the participating inodes. Depending upon whether
* the target_name exists in the target directory, and
......@@ -302,15 +285,9 @@ xfs_rename(
* does not exist in the source directory.
*/
tp = NULL;
do {
error = xfs_lock_for_rename(src_dp, target_dp, src_dentry,
target_dentry, &src_ip, &target_ip, inodes,
error = xfs_lock_for_rename(src_dp, target_dp, src_vname,
target_vname, &src_ip, &target_ip, inodes,
&num_inodes);
#ifdef DEBUG
if (error == EAGAIN)
xfs_rename_agains++;
#endif
} while (error == EAGAIN);
if (error) {
rename_which_error_return = __LINE__;
......
......@@ -47,9 +47,7 @@ xfs_get_dir_entry(
vnode_t *vp;
bhv_desc_t *bdp;
ASSERT(dentry->d_inode);
vp = LINVFS_GET_VP(dentry->d_inode);
vp = VNAME_TO_VNODE(dentry);
bdp = vn_bhv_lookup_unlocked(VN_BHV_HEAD(vp), &xfs_vnodeops);
if (!bdp) {
*ipp = NULL;
......
......@@ -926,7 +926,7 @@ xfs_syncsub(
IPOINTER_CLR; \
}
#define PREEMPT_MASK 0x7f
#define XFS_PREEMPT_MASK 0x7f
if (bypassed)
*bypassed = 0;
......@@ -1395,7 +1395,7 @@ xfs_syncsub(
* if we have looped many times without dropping the
* lock.
*/
if ((++preempt & PREEMPT_MASK) == 0) {
if ((++preempt & XFS_PREEMPT_MASK) == 0) {
if (mount_locked) {
IPOINTER_INSERT(ip, mp);
}
......
......@@ -82,7 +82,7 @@ xfs_open(
/*
* xfs_getattr
*/
int
STATIC int
xfs_getattr(
bhv_desc_t *bdp,
vattr_t *vap,
......@@ -1935,8 +1935,6 @@ xfs_create(
dm_di_mode = vap->va_mode|VTTOIF(vap->va_type);
namelen = VNAMELEN(dentry);
if (namelen >= MAXNAMELEN)
return XFS_ERROR(ENAMETOOLONG);
if (DM_EVENT_ENABLED(dir_vp->v_vfsp, dp, DM_EVENT_CREATE)) {
error = dm_send_namesp_event(DM_EVENT_CREATE,
......@@ -2433,8 +2431,7 @@ xfs_remove(
return XFS_ERROR(EIO);
namelen = VNAMELEN(dentry);
if (namelen >= MAXNAMELEN)
return XFS_ERROR(ENAMETOOLONG);
if (DM_EVENT_ENABLED(dir_vp->v_vfsp, dp, DM_EVENT_REMOVE)) {
error = dm_send_namesp_event(DM_EVENT_REMOVE, dir_bdp, DM_RIGHT_NULL,
NULL, DM_RIGHT_NULL,
......@@ -2668,8 +2665,6 @@ xfs_link(
vn_trace_entry(src_vp, __FUNCTION__, (inst_t *)__return_address);
target_namelen = VNAMELEN(dentry);
if (target_namelen >= MAXNAMELEN)
return XFS_ERROR(ENAMETOOLONG);
if (src_vp->v_type == VDIR)
return XFS_ERROR(EPERM);
......@@ -2857,8 +2852,6 @@ xfs_mkdir(
return XFS_ERROR(EIO);
dir_namelen = VNAMELEN(dentry);
if (dir_namelen >= MAXNAMELEN)
return XFS_ERROR(ENAMETOOLONG);
tp = NULL;
dp_joined_to_trans = B_FALSE;
......@@ -3100,8 +3093,6 @@ xfs_rmdir(
if (XFS_FORCED_SHUTDOWN(XFS_BHVTOI(dir_bdp)->i_mount))
return XFS_ERROR(EIO);
namelen = VNAMELEN(dentry);
if (namelen >= MAXNAMELEN)
return XFS_ERROR(ENAMETOOLONG);
if (DM_EVENT_ENABLED(dir_vp->v_vfsp, dp, DM_EVENT_REMOVE)) {
error = dm_send_namesp_event(DM_EVENT_REMOVE,
......@@ -3415,8 +3406,7 @@ xfs_symlink(
return XFS_ERROR(EIO);
link_namelen = VNAMELEN(dentry);
if (link_namelen >= MAXNAMELEN)
return XFS_ERROR(ENAMETOOLONG);
/*
* Check component lengths of the target path name.
*/
......@@ -4070,6 +4060,49 @@ xfs_finish_reclaim(
return 0;
}
int
xfs_finish_reclaim_all(xfs_mount_t *mp)
{
int purged;
xfs_inode_t *ip;
vnode_t *vp;
int done = 0;
while (!done) {
purged = 0;
XFS_MOUNT_ILOCK(mp);
ip = mp->m_inodes;
if (ip == NULL) {
break;
}
do {
/* Make sure we skip markers inserted by sync */
if (ip->i_mount == NULL) {
ip = ip->i_mnext;
continue;
}
/*
* It's up to our caller to purge the root
* and quota vnodes later.
*/
vp = XFS_ITOV_NULL(ip);
if (!vp) {
XFS_MOUNT_IUNLOCK(mp);
xfs_finish_reclaim(ip, 0, XFS_IFLUSH_ASYNC);
purged = 1;
break;
}
} while (ip != mp->m_inodes);
done = !purged;
}
XFS_MOUNT_IUNLOCK(mp);
return 0;
}
/*
* xfs_alloc_file_space()
* This routine allocates disk space for the given file.
......
......@@ -18,6 +18,7 @@
#define RTC_MINOR 135
#define EFI_RTC_MINOR 136 /* EFI Time services */
#define SUN_OPENPROM_MINOR 139
#define DMAPI_MINOR 140 /* DMAPI */
#define NVRAM_MINOR 144
#define I2O_MINOR 166
#define MICROCODE_MINOR 184
......
......@@ -4,7 +4,7 @@
Extended attributes handling.
Copyright (C) 2001 by Andreas Gruenbacher <a.gruenbacher@computer.org>
Copyright (C) 2001 SGI - Silicon Graphics, Inc <linux-xfs@oss.sgi.com>
Copyright (c) 2001-2002 Silicon Graphics, Inc. All Rights Reserved.
*/
#ifndef _LINUX_XATTR_H
#define _LINUX_XATTR_H
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment