Merge branch 'for-linus' of git://oss.sgi.com/xfs/xfs
* 'for-linus' of git://oss.sgi.com/xfs/xfs: (61 commits) Revert "xfs: increase the maximum number of supported ACL entries" xfs: cleanup uuid handling xfs: remove m_attroffset xfs: fix various typos xfs: pagecache usage optimization xfs: remove m_litino xfs: kill ino64 mount option xfs: kill mutex_t typedef xfs: increase the maximum number of supported ACL entries xfs: factor out code to find the longest free extent in the AG xfs: kill VN_BAD xfs: kill vn_atime_* helpers. xfs: cleanup xlog_bread xfs: cleanup xlog_recover_do_trans xfs: remove another leftover of the old inode log item format xfs: cleanup log unmount handling Fix xfs debug build breakage by pushing xfs_error.h after xfs: include header files for prototypes xfs: make symbols static xfs: move declaration to header file ...
Esse commit está contido em:
@@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2003,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_MUTEX_H__
|
||||
#define __XFS_SUPPORT_MUTEX_H__
|
||||
|
||||
#include <linux/mutex.h>
|
||||
|
||||
typedef struct mutex mutex_t;
|
||||
|
||||
#endif /* __XFS_SUPPORT_MUTEX_H__ */
|
@@ -1623,4 +1623,5 @@ const struct address_space_operations xfs_address_space_operations = {
|
||||
.bmap = xfs_vm_bmap,
|
||||
.direct_IO = xfs_vm_direct_IO,
|
||||
.migratepage = buffer_migrate_page,
|
||||
.is_partially_uptodate = block_is_partially_uptodate,
|
||||
};
|
||||
|
@@ -34,6 +34,7 @@
|
||||
#include "xfs_dir2_sf.h"
|
||||
#include "xfs_dinode.h"
|
||||
#include "xfs_inode.h"
|
||||
#include "xfs_ioctl.h"
|
||||
#include "xfs_btree.h"
|
||||
#include "xfs_ialloc.h"
|
||||
#include "xfs_rtalloc.h"
|
||||
@@ -78,92 +79,74 @@ xfs_find_handle(
|
||||
int hsize;
|
||||
xfs_handle_t handle;
|
||||
struct inode *inode;
|
||||
struct file *file = NULL;
|
||||
struct path path;
|
||||
int error;
|
||||
struct xfs_inode *ip;
|
||||
|
||||
memset((char *)&handle, 0, sizeof(handle));
|
||||
|
||||
switch (cmd) {
|
||||
case XFS_IOC_PATH_TO_FSHANDLE:
|
||||
case XFS_IOC_PATH_TO_HANDLE: {
|
||||
struct path path;
|
||||
int error = user_lpath((const char __user *)hreq->path, &path);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
ASSERT(path.dentry);
|
||||
ASSERT(path.dentry->d_inode);
|
||||
inode = igrab(path.dentry->d_inode);
|
||||
path_put(&path);
|
||||
break;
|
||||
}
|
||||
|
||||
case XFS_IOC_FD_TO_HANDLE: {
|
||||
struct file *file;
|
||||
|
||||
if (cmd == XFS_IOC_FD_TO_HANDLE) {
|
||||
file = fget(hreq->fd);
|
||||
if (!file)
|
||||
return -EBADF;
|
||||
|
||||
ASSERT(file->f_path.dentry);
|
||||
ASSERT(file->f_path.dentry->d_inode);
|
||||
inode = igrab(file->f_path.dentry->d_inode);
|
||||
fput(file);
|
||||
break;
|
||||
return -EBADF;
|
||||
inode = file->f_path.dentry->d_inode;
|
||||
} else {
|
||||
error = user_lpath((const char __user *)hreq->path, &path);
|
||||
if (error)
|
||||
return error;
|
||||
inode = path.dentry->d_inode;
|
||||
}
|
||||
ip = XFS_I(inode);
|
||||
|
||||
default:
|
||||
ASSERT(0);
|
||||
return -XFS_ERROR(EINVAL);
|
||||
}
|
||||
/*
|
||||
* We can only generate handles for inodes residing on a XFS filesystem,
|
||||
* and only for regular files, directories or symbolic links.
|
||||
*/
|
||||
error = -EINVAL;
|
||||
if (inode->i_sb->s_magic != XFS_SB_MAGIC)
|
||||
goto out_put;
|
||||
|
||||
if (inode->i_sb->s_magic != XFS_SB_MAGIC) {
|
||||
/* we're not in XFS anymore, Toto */
|
||||
iput(inode);
|
||||
return -XFS_ERROR(EINVAL);
|
||||
}
|
||||
error = -EBADF;
|
||||
if (!S_ISREG(inode->i_mode) &&
|
||||
!S_ISDIR(inode->i_mode) &&
|
||||
!S_ISLNK(inode->i_mode))
|
||||
goto out_put;
|
||||
|
||||
switch (inode->i_mode & S_IFMT) {
|
||||
case S_IFREG:
|
||||
case S_IFDIR:
|
||||
case S_IFLNK:
|
||||
break;
|
||||
default:
|
||||
iput(inode);
|
||||
return -XFS_ERROR(EBADF);
|
||||
}
|
||||
|
||||
/* now we can grab the fsid */
|
||||
memcpy(&handle.ha_fsid, XFS_I(inode)->i_mount->m_fixedfsid,
|
||||
sizeof(xfs_fsid_t));
|
||||
hsize = sizeof(xfs_fsid_t);
|
||||
memcpy(&handle.ha_fsid, ip->i_mount->m_fixedfsid, sizeof(xfs_fsid_t));
|
||||
|
||||
if (cmd != XFS_IOC_PATH_TO_FSHANDLE) {
|
||||
xfs_inode_t *ip = XFS_I(inode);
|
||||
if (cmd == XFS_IOC_PATH_TO_FSHANDLE) {
|
||||
/*
|
||||
* This handle only contains an fsid, zero the rest.
|
||||
*/
|
||||
memset(&handle.ha_fid, 0, sizeof(handle.ha_fid));
|
||||
hsize = sizeof(xfs_fsid_t);
|
||||
} else {
|
||||
int lock_mode;
|
||||
|
||||
/* need to get access to the xfs_inode to read the generation */
|
||||
lock_mode = xfs_ilock_map_shared(ip);
|
||||
|
||||
/* fill in fid section of handle from inode */
|
||||
handle.ha_fid.fid_len = sizeof(xfs_fid_t) -
|
||||
sizeof(handle.ha_fid.fid_len);
|
||||
handle.ha_fid.fid_pad = 0;
|
||||
handle.ha_fid.fid_gen = ip->i_d.di_gen;
|
||||
handle.ha_fid.fid_ino = ip->i_ino;
|
||||
|
||||
xfs_iunlock_map_shared(ip, lock_mode);
|
||||
|
||||
hsize = XFS_HSIZE(handle);
|
||||
}
|
||||
|
||||
/* now copy our handle into the user buffer & write out the size */
|
||||
error = -EFAULT;
|
||||
if (copy_to_user(hreq->ohandle, &handle, hsize) ||
|
||||
copy_to_user(hreq->ohandlen, &hsize, sizeof(__s32))) {
|
||||
iput(inode);
|
||||
return -XFS_ERROR(EFAULT);
|
||||
}
|
||||
copy_to_user(hreq->ohandlen, &hsize, sizeof(__s32)))
|
||||
goto out_put;
|
||||
|
||||
iput(inode);
|
||||
return 0;
|
||||
error = 0;
|
||||
|
||||
out_put:
|
||||
if (cmd == XFS_IOC_FD_TO_HANDLE)
|
||||
fput(file);
|
||||
else
|
||||
path_put(&path);
|
||||
return error;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -211,8 +211,13 @@ xfs_vn_mknod(
|
||||
* Irix uses Missed'em'V split, but doesn't want to see
|
||||
* the upper 5 bits of (14bit) major.
|
||||
*/
|
||||
if (unlikely(!sysv_valid_dev(rdev) || MAJOR(rdev) & ~0x1ff))
|
||||
return -EINVAL;
|
||||
if (S_ISCHR(mode) || S_ISBLK(mode)) {
|
||||
if (unlikely(!sysv_valid_dev(rdev) || MAJOR(rdev) & ~0x1ff))
|
||||
return -EINVAL;
|
||||
rdev = sysv_encode_dev(rdev);
|
||||
} else {
|
||||
rdev = 0;
|
||||
}
|
||||
|
||||
if (test_default_acl && test_default_acl(dir)) {
|
||||
if (!_ACL_ALLOC(default_acl)) {
|
||||
@@ -224,28 +229,11 @@ xfs_vn_mknod(
|
||||
}
|
||||
}
|
||||
|
||||
xfs_dentry_to_name(&name, dentry);
|
||||
|
||||
if (IS_POSIXACL(dir) && !default_acl)
|
||||
mode &= ~current_umask();
|
||||
|
||||
switch (mode & S_IFMT) {
|
||||
case S_IFCHR:
|
||||
case S_IFBLK:
|
||||
case S_IFIFO:
|
||||
case S_IFSOCK:
|
||||
rdev = sysv_encode_dev(rdev);
|
||||
case S_IFREG:
|
||||
error = xfs_create(XFS_I(dir), &name, mode, rdev, &ip, NULL);
|
||||
break;
|
||||
case S_IFDIR:
|
||||
error = xfs_mkdir(XFS_I(dir), &name, mode, &ip, NULL);
|
||||
break;
|
||||
default:
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
xfs_dentry_to_name(&name, dentry);
|
||||
error = xfs_create(XFS_I(dir), &name, mode, rdev, &ip, NULL);
|
||||
if (unlikely(error))
|
||||
goto out_free_acl;
|
||||
|
||||
@@ -553,9 +541,6 @@ xfs_vn_getattr(
|
||||
stat->uid = ip->i_d.di_uid;
|
||||
stat->gid = ip->i_d.di_gid;
|
||||
stat->ino = ip->i_ino;
|
||||
#if XFS_BIG_INUMS
|
||||
stat->ino += mp->m_inoadd;
|
||||
#endif
|
||||
stat->atime = inode->i_atime;
|
||||
stat->mtime.tv_sec = ip->i_d.di_mtime.t_sec;
|
||||
stat->mtime.tv_nsec = ip->i_d.di_mtime.t_nsec;
|
||||
|
@@ -38,7 +38,6 @@
|
||||
#include <kmem.h>
|
||||
#include <mrlock.h>
|
||||
#include <sv.h>
|
||||
#include <mutex.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <support/ktrace.h>
|
||||
@@ -51,6 +50,7 @@
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/file.h>
|
||||
#include <linux/swap.h>
|
||||
#include <linux/errno.h>
|
||||
@@ -147,17 +147,6 @@
|
||||
#define SYNCHRONIZE() barrier()
|
||||
#define __return_address __builtin_return_address(0)
|
||||
|
||||
/*
|
||||
* IRIX (BSD) quotactl makes use of separate commands for user/group,
|
||||
* whereas on Linux the syscall encodes this information into the cmd
|
||||
* field (see the QCMD macro in quota.h). These macros help keep the
|
||||
* code portable - they are not visible from the syscall interface.
|
||||
*/
|
||||
#define Q_XSETGQLIM XQM_CMD(8) /* set groups disk limits */
|
||||
#define Q_XGETGQUOTA XQM_CMD(9) /* get groups disk limits */
|
||||
#define Q_XSETPQLIM XQM_CMD(10) /* set projects disk limits */
|
||||
#define Q_XGETPQUOTA XQM_CMD(11) /* get projects disk limits */
|
||||
|
||||
#define dfltprid 0
|
||||
#define MAXPATHLEN 1024
|
||||
|
||||
|
157
fs/xfs/linux-2.6/xfs_quotaops.c
Arquivo normal
157
fs/xfs/linux-2.6/xfs_quotaops.c
Arquivo normal
@@ -0,0 +1,157 @@
|
||||
/*
|
||||
* Copyright (c) 2008, Christoph Hellwig
|
||||
* 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
|
||||
*/
|
||||
#include "xfs.h"
|
||||
#include "xfs_dmapi.h"
|
||||
#include "xfs_sb.h"
|
||||
#include "xfs_inum.h"
|
||||
#include "xfs_ag.h"
|
||||
#include "xfs_mount.h"
|
||||
#include "xfs_quota.h"
|
||||
#include "xfs_log.h"
|
||||
#include "xfs_trans.h"
|
||||
#include "xfs_bmap_btree.h"
|
||||
#include "xfs_inode.h"
|
||||
#include "quota/xfs_qm.h"
|
||||
#include <linux/quota.h>
|
||||
|
||||
|
||||
STATIC int
|
||||
xfs_quota_type(int type)
|
||||
{
|
||||
switch (type) {
|
||||
case USRQUOTA:
|
||||
return XFS_DQ_USER;
|
||||
case GRPQUOTA:
|
||||
return XFS_DQ_GROUP;
|
||||
default:
|
||||
return XFS_DQ_PROJ;
|
||||
}
|
||||
}
|
||||
|
||||
STATIC int
|
||||
xfs_fs_quota_sync(
|
||||
struct super_block *sb,
|
||||
int type)
|
||||
{
|
||||
struct xfs_mount *mp = XFS_M(sb);
|
||||
|
||||
if (!XFS_IS_QUOTA_RUNNING(mp))
|
||||
return -ENOSYS;
|
||||
return -xfs_sync_inodes(mp, SYNC_DELWRI);
|
||||
}
|
||||
|
||||
STATIC int
|
||||
xfs_fs_get_xstate(
|
||||
struct super_block *sb,
|
||||
struct fs_quota_stat *fqs)
|
||||
{
|
||||
struct xfs_mount *mp = XFS_M(sb);
|
||||
|
||||
if (!XFS_IS_QUOTA_RUNNING(mp))
|
||||
return -ENOSYS;
|
||||
return -xfs_qm_scall_getqstat(mp, fqs);
|
||||
}
|
||||
|
||||
STATIC int
|
||||
xfs_fs_set_xstate(
|
||||
struct super_block *sb,
|
||||
unsigned int uflags,
|
||||
int op)
|
||||
{
|
||||
struct xfs_mount *mp = XFS_M(sb);
|
||||
unsigned int flags = 0;
|
||||
|
||||
if (sb->s_flags & MS_RDONLY)
|
||||
return -EROFS;
|
||||
if (!XFS_IS_QUOTA_RUNNING(mp))
|
||||
return -ENOSYS;
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EPERM;
|
||||
|
||||
if (uflags & XFS_QUOTA_UDQ_ACCT)
|
||||
flags |= XFS_UQUOTA_ACCT;
|
||||
if (uflags & XFS_QUOTA_PDQ_ACCT)
|
||||
flags |= XFS_PQUOTA_ACCT;
|
||||
if (uflags & XFS_QUOTA_GDQ_ACCT)
|
||||
flags |= XFS_GQUOTA_ACCT;
|
||||
if (uflags & XFS_QUOTA_UDQ_ENFD)
|
||||
flags |= XFS_UQUOTA_ENFD;
|
||||
if (uflags & (XFS_QUOTA_PDQ_ENFD|XFS_QUOTA_GDQ_ENFD))
|
||||
flags |= XFS_OQUOTA_ENFD;
|
||||
|
||||
switch (op) {
|
||||
case Q_XQUOTAON:
|
||||
return -xfs_qm_scall_quotaon(mp, flags);
|
||||
case Q_XQUOTAOFF:
|
||||
if (!XFS_IS_QUOTA_ON(mp))
|
||||
return -EINVAL;
|
||||
return -xfs_qm_scall_quotaoff(mp, flags);
|
||||
case Q_XQUOTARM:
|
||||
if (XFS_IS_QUOTA_ON(mp))
|
||||
return -EINVAL;
|
||||
return -xfs_qm_scall_trunc_qfiles(mp, flags);
|
||||
}
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
STATIC int
|
||||
xfs_fs_get_xquota(
|
||||
struct super_block *sb,
|
||||
int type,
|
||||
qid_t id,
|
||||
struct fs_disk_quota *fdq)
|
||||
{
|
||||
struct xfs_mount *mp = XFS_M(sb);
|
||||
|
||||
if (!XFS_IS_QUOTA_RUNNING(mp))
|
||||
return -ENOSYS;
|
||||
if (!XFS_IS_QUOTA_ON(mp))
|
||||
return -ESRCH;
|
||||
|
||||
return -xfs_qm_scall_getquota(mp, id, xfs_quota_type(type), fdq);
|
||||
}
|
||||
|
||||
STATIC int
|
||||
xfs_fs_set_xquota(
|
||||
struct super_block *sb,
|
||||
int type,
|
||||
qid_t id,
|
||||
struct fs_disk_quota *fdq)
|
||||
{
|
||||
struct xfs_mount *mp = XFS_M(sb);
|
||||
|
||||
if (sb->s_flags & MS_RDONLY)
|
||||
return -EROFS;
|
||||
if (!XFS_IS_QUOTA_RUNNING(mp))
|
||||
return -ENOSYS;
|
||||
if (!XFS_IS_QUOTA_ON(mp))
|
||||
return -ESRCH;
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EPERM;
|
||||
|
||||
return -xfs_qm_scall_setqlim(mp, id, xfs_quota_type(type), fdq);
|
||||
}
|
||||
|
||||
struct quotactl_ops xfs_quotactl_operations = {
|
||||
.quota_sync = xfs_fs_quota_sync,
|
||||
.get_xstate = xfs_fs_get_xstate,
|
||||
.set_xstate = xfs_fs_set_xstate,
|
||||
.get_xquota = xfs_fs_get_xquota,
|
||||
.set_xquota = xfs_fs_set_xquota,
|
||||
};
|
@@ -68,7 +68,6 @@
|
||||
#include <linux/freezer.h>
|
||||
#include <linux/parser.h>
|
||||
|
||||
static struct quotactl_ops xfs_quotactl_operations;
|
||||
static struct super_operations xfs_super_operations;
|
||||
static kmem_zone_t *xfs_ioend_zone;
|
||||
mempool_t *xfs_ioend_pool;
|
||||
@@ -79,7 +78,6 @@ mempool_t *xfs_ioend_pool;
|
||||
#define MNTOPT_RTDEV "rtdev" /* realtime I/O device */
|
||||
#define MNTOPT_BIOSIZE "biosize" /* log2 of preferred buffered io size */
|
||||
#define MNTOPT_WSYNC "wsync" /* safe-mode nfs compatible mount */
|
||||
#define MNTOPT_INO64 "ino64" /* force inodes into 64-bit range */
|
||||
#define MNTOPT_NOALIGN "noalign" /* turn off stripe alignment */
|
||||
#define MNTOPT_SWALLOC "swalloc" /* turn on stripe width allocation */
|
||||
#define MNTOPT_SUNIT "sunit" /* data volume stripe unit */
|
||||
@@ -180,7 +178,7 @@ xfs_parseargs(
|
||||
int dswidth = 0;
|
||||
int iosize = 0;
|
||||
int dmapi_implies_ikeep = 1;
|
||||
uchar_t iosizelog = 0;
|
||||
__uint8_t iosizelog = 0;
|
||||
|
||||
/*
|
||||
* Copy binary VFS mount flags we are interested in.
|
||||
@@ -291,16 +289,6 @@ xfs_parseargs(
|
||||
mp->m_flags |= XFS_MOUNT_OSYNCISOSYNC;
|
||||
} else if (!strcmp(this_char, MNTOPT_NORECOVERY)) {
|
||||
mp->m_flags |= XFS_MOUNT_NORECOVERY;
|
||||
} else if (!strcmp(this_char, MNTOPT_INO64)) {
|
||||
#if XFS_BIG_INUMS
|
||||
mp->m_flags |= XFS_MOUNT_INO64;
|
||||
mp->m_inoadd = XFS_INO64_OFFSET;
|
||||
#else
|
||||
cmn_err(CE_WARN,
|
||||
"XFS: %s option not allowed on this system",
|
||||
this_char);
|
||||
return EINVAL;
|
||||
#endif
|
||||
} else if (!strcmp(this_char, MNTOPT_NOALIGN)) {
|
||||
mp->m_flags |= XFS_MOUNT_NOALIGN;
|
||||
} else if (!strcmp(this_char, MNTOPT_SWALLOC)) {
|
||||
@@ -529,7 +517,6 @@ xfs_showargs(
|
||||
/* the few simple ones we can get from the mount struct */
|
||||
{ XFS_MOUNT_IKEEP, "," MNTOPT_IKEEP },
|
||||
{ XFS_MOUNT_WSYNC, "," MNTOPT_WSYNC },
|
||||
{ XFS_MOUNT_INO64, "," MNTOPT_INO64 },
|
||||
{ XFS_MOUNT_NOALIGN, "," MNTOPT_NOALIGN },
|
||||
{ XFS_MOUNT_SWALLOC, "," MNTOPT_SWALLOC },
|
||||
{ XFS_MOUNT_NOUUID, "," MNTOPT_NOUUID },
|
||||
@@ -634,7 +621,7 @@ xfs_max_file_offset(
|
||||
return (((__uint64_t)pagefactor) << bitshift) - 1;
|
||||
}
|
||||
|
||||
int
|
||||
STATIC int
|
||||
xfs_blkdev_get(
|
||||
xfs_mount_t *mp,
|
||||
const char *name,
|
||||
@@ -651,7 +638,7 @@ xfs_blkdev_get(
|
||||
return -error;
|
||||
}
|
||||
|
||||
void
|
||||
STATIC void
|
||||
xfs_blkdev_put(
|
||||
struct block_device *bdev)
|
||||
{
|
||||
@@ -872,7 +859,7 @@ xfsaild_wakeup(
|
||||
wake_up_process(ailp->xa_task);
|
||||
}
|
||||
|
||||
int
|
||||
STATIC int
|
||||
xfsaild(
|
||||
void *data)
|
||||
{
|
||||
@@ -990,26 +977,57 @@ xfs_fs_write_inode(
|
||||
int sync)
|
||||
{
|
||||
struct xfs_inode *ip = XFS_I(inode);
|
||||
struct xfs_mount *mp = ip->i_mount;
|
||||
int error = 0;
|
||||
int flags = 0;
|
||||
|
||||
xfs_itrace_entry(ip);
|
||||
|
||||
if (XFS_FORCED_SHUTDOWN(mp))
|
||||
return XFS_ERROR(EIO);
|
||||
|
||||
if (sync) {
|
||||
error = xfs_wait_on_pages(ip, 0, -1);
|
||||
if (error)
|
||||
goto out_error;
|
||||
flags |= FLUSH_SYNC;
|
||||
goto out;
|
||||
}
|
||||
error = xfs_inode_flush(ip, flags);
|
||||
|
||||
out_error:
|
||||
/*
|
||||
* Bypass inodes which have already been cleaned by
|
||||
* the inode flush clustering code inside xfs_iflush
|
||||
*/
|
||||
if (xfs_inode_clean(ip))
|
||||
goto out;
|
||||
|
||||
/*
|
||||
* We make this non-blocking if the inode is contended, return
|
||||
* EAGAIN to indicate to the caller that they did not succeed.
|
||||
* This prevents the flush path from blocking on inodes inside
|
||||
* another operation right now, they get caught later by xfs_sync.
|
||||
*/
|
||||
if (sync) {
|
||||
xfs_ilock(ip, XFS_ILOCK_SHARED);
|
||||
xfs_iflock(ip);
|
||||
|
||||
error = xfs_iflush(ip, XFS_IFLUSH_SYNC);
|
||||
} else {
|
||||
error = EAGAIN;
|
||||
if (!xfs_ilock_nowait(ip, XFS_ILOCK_SHARED))
|
||||
goto out;
|
||||
if (xfs_ipincount(ip) || !xfs_iflock_nowait(ip))
|
||||
goto out_unlock;
|
||||
|
||||
error = xfs_iflush(ip, XFS_IFLUSH_ASYNC_NOBLOCK);
|
||||
}
|
||||
|
||||
out_unlock:
|
||||
xfs_iunlock(ip, XFS_ILOCK_SHARED);
|
||||
out:
|
||||
/*
|
||||
* if we failed to write out the inode then mark
|
||||
* it dirty again so we'll try again later.
|
||||
*/
|
||||
if (error)
|
||||
xfs_mark_inode_dirty_sync(ip);
|
||||
|
||||
return -error;
|
||||
}
|
||||
|
||||
@@ -1169,18 +1187,12 @@ xfs_fs_statfs(
|
||||
statp->f_bfree = statp->f_bavail =
|
||||
sbp->sb_fdblocks - XFS_ALLOC_SET_ASIDE(mp);
|
||||
fakeinos = statp->f_bfree << sbp->sb_inopblog;
|
||||
#if XFS_BIG_INUMS
|
||||
fakeinos += mp->m_inoadd;
|
||||
#endif
|
||||
statp->f_files =
|
||||
MIN(sbp->sb_icount + fakeinos, (__uint64_t)XFS_MAXINUMBER);
|
||||
if (mp->m_maxicount)
|
||||
#if XFS_BIG_INUMS
|
||||
if (!mp->m_inoadd)
|
||||
#endif
|
||||
statp->f_files = min_t(typeof(statp->f_files),
|
||||
statp->f_files,
|
||||
mp->m_maxicount);
|
||||
statp->f_files = min_t(typeof(statp->f_files),
|
||||
statp->f_files,
|
||||
mp->m_maxicount);
|
||||
statp->f_ffree = statp->f_files - (sbp->sb_icount - sbp->sb_ifree);
|
||||
spin_unlock(&mp->m_sb_lock);
|
||||
|
||||
@@ -1302,57 +1314,6 @@ xfs_fs_show_options(
|
||||
return -xfs_showargs(XFS_M(mnt->mnt_sb), m);
|
||||
}
|
||||
|
||||
STATIC int
|
||||
xfs_fs_quotasync(
|
||||
struct super_block *sb,
|
||||
int type)
|
||||
{
|
||||
return -XFS_QM_QUOTACTL(XFS_M(sb), Q_XQUOTASYNC, 0, NULL);
|
||||
}
|
||||
|
||||
STATIC int
|
||||
xfs_fs_getxstate(
|
||||
struct super_block *sb,
|
||||
struct fs_quota_stat *fqs)
|
||||
{
|
||||
return -XFS_QM_QUOTACTL(XFS_M(sb), Q_XGETQSTAT, 0, (caddr_t)fqs);
|
||||
}
|
||||
|
||||
STATIC int
|
||||
xfs_fs_setxstate(
|
||||
struct super_block *sb,
|
||||
unsigned int flags,
|
||||
int op)
|
||||
{
|
||||
return -XFS_QM_QUOTACTL(XFS_M(sb), op, 0, (caddr_t)&flags);
|
||||
}
|
||||
|
||||
STATIC int
|
||||
xfs_fs_getxquota(
|
||||
struct super_block *sb,
|
||||
int type,
|
||||
qid_t id,
|
||||
struct fs_disk_quota *fdq)
|
||||
{
|
||||
return -XFS_QM_QUOTACTL(XFS_M(sb),
|
||||
(type == USRQUOTA) ? Q_XGETQUOTA :
|
||||
((type == GRPQUOTA) ? Q_XGETGQUOTA :
|
||||
Q_XGETPQUOTA), id, (caddr_t)fdq);
|
||||
}
|
||||
|
||||
STATIC int
|
||||
xfs_fs_setxquota(
|
||||
struct super_block *sb,
|
||||
int type,
|
||||
qid_t id,
|
||||
struct fs_disk_quota *fdq)
|
||||
{
|
||||
return -XFS_QM_QUOTACTL(XFS_M(sb),
|
||||
(type == USRQUOTA) ? Q_XSETQLIM :
|
||||
((type == GRPQUOTA) ? Q_XSETGQLIM :
|
||||
Q_XSETPQLIM), id, (caddr_t)fdq);
|
||||
}
|
||||
|
||||
/*
|
||||
* This function fills in xfs_mount_t fields based on mount args.
|
||||
* Note: the superblock _has_ now been read in.
|
||||
@@ -1435,7 +1396,9 @@ xfs_fs_fill_super(
|
||||
sb_min_blocksize(sb, BBSIZE);
|
||||
sb->s_xattr = xfs_xattr_handlers;
|
||||
sb->s_export_op = &xfs_export_operations;
|
||||
#ifdef CONFIG_XFS_QUOTA
|
||||
sb->s_qcop = &xfs_quotactl_operations;
|
||||
#endif
|
||||
sb->s_op = &xfs_super_operations;
|
||||
|
||||
error = xfs_dmops_get(mp);
|
||||
@@ -1578,14 +1541,6 @@ static struct super_operations xfs_super_operations = {
|
||||
.show_options = xfs_fs_show_options,
|
||||
};
|
||||
|
||||
static struct quotactl_ops xfs_quotactl_operations = {
|
||||
.quota_sync = xfs_fs_quotasync,
|
||||
.get_xstate = xfs_fs_getxstate,
|
||||
.set_xstate = xfs_fs_setxstate,
|
||||
.get_xquota = xfs_fs_getxquota,
|
||||
.set_xquota = xfs_fs_setxquota,
|
||||
};
|
||||
|
||||
static struct file_system_type xfs_fs_type = {
|
||||
.owner = THIS_MODULE,
|
||||
.name = "xfs",
|
||||
|
@@ -93,6 +93,7 @@ extern void xfs_blkdev_issue_flush(struct xfs_buftarg *);
|
||||
|
||||
extern const struct export_operations xfs_export_operations;
|
||||
extern struct xattr_handler *xfs_xattr_handlers[];
|
||||
extern struct quotactl_ops xfs_quotactl_operations;
|
||||
|
||||
#define XFS_M(sb) ((struct xfs_mount *)((sb)->s_fs_info))
|
||||
|
||||
|
@@ -19,6 +19,7 @@
|
||||
#define XFS_SYNC_H 1
|
||||
|
||||
struct xfs_mount;
|
||||
struct xfs_perag;
|
||||
|
||||
typedef struct bhv_vfs_sync_work {
|
||||
struct list_head w_list;
|
||||
|
@@ -40,11 +40,6 @@ struct attrlist_cursor_kern;
|
||||
#define IO_ISDIRECT 0x00004 /* bypass page cache */
|
||||
#define IO_INVIS 0x00020 /* don't update inode timestamps */
|
||||
|
||||
/*
|
||||
* Flags for xfs_inode_flush
|
||||
*/
|
||||
#define FLUSH_SYNC 1 /* wait for flush to complete */
|
||||
|
||||
/*
|
||||
* Flush/Invalidate options for vop_toss/flush/flushinval_pages.
|
||||
*/
|
||||
@@ -54,33 +49,6 @@ struct attrlist_cursor_kern;
|
||||
Prevent VM access to the pages until
|
||||
the operation completes. */
|
||||
|
||||
/*
|
||||
* Dealing with bad inodes
|
||||
*/
|
||||
static inline int VN_BAD(struct inode *vp)
|
||||
{
|
||||
return is_bad_inode(vp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Extracting atime values in various formats
|
||||
*/
|
||||
static inline void vn_atime_to_bstime(struct inode *vp, xfs_bstime_t *bs_atime)
|
||||
{
|
||||
bs_atime->tv_sec = vp->i_atime.tv_sec;
|
||||
bs_atime->tv_nsec = vp->i_atime.tv_nsec;
|
||||
}
|
||||
|
||||
static inline void vn_atime_to_timespec(struct inode *vp, struct timespec *ts)
|
||||
{
|
||||
*ts = vp->i_atime;
|
||||
}
|
||||
|
||||
static inline void vn_atime_to_time_t(struct inode *vp, time_t *tt)
|
||||
{
|
||||
*tt = vp->i_atime.tv_sec;
|
||||
}
|
||||
|
||||
/*
|
||||
* Some useful predicates.
|
||||
*/
|
||||
|
Referência em uma nova issue
Block a user