aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6/xfs_iops.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_iops.c')
-rw-r--r--fs/xfs/linux-2.6/xfs_iops.c68
1 files changed, 6 insertions, 62 deletions
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c
index da54403633b6..dd21784525a8 100644
--- a/fs/xfs/linux-2.6/xfs_iops.c
+++ b/fs/xfs/linux-2.6/xfs_iops.c
@@ -46,7 +46,6 @@
46#include <linux/namei.h> 46#include <linux/namei.h>
47#include <linux/posix_acl.h> 47#include <linux/posix_acl.h>
48#include <linux/security.h> 48#include <linux/security.h>
49#include <linux/falloc.h>
50#include <linux/fiemap.h> 49#include <linux/fiemap.h>
51#include <linux/slab.h> 50#include <linux/slab.h>
52 51
@@ -71,7 +70,7 @@ xfs_synchronize_times(
71 70
72/* 71/*
73 * If the linux inode is valid, mark it dirty. 72 * If the linux inode is valid, mark it dirty.
74 * Used when commiting a dirty inode into a transaction so that 73 * Used when committing a dirty inode into a transaction so that
75 * the inode will get written back by the linux code 74 * the inode will get written back by the linux code
76 */ 75 */
77void 76void
@@ -103,7 +102,8 @@ xfs_mark_inode_dirty(
103STATIC int 102STATIC int
104xfs_init_security( 103xfs_init_security(
105 struct inode *inode, 104 struct inode *inode,
106 struct inode *dir) 105 struct inode *dir,
106 const struct qstr *qstr)
107{ 107{
108 struct xfs_inode *ip = XFS_I(inode); 108 struct xfs_inode *ip = XFS_I(inode);
109 size_t length; 109 size_t length;
@@ -111,7 +111,7 @@ xfs_init_security(
111 unsigned char *name; 111 unsigned char *name;
112 int error; 112 int error;
113 113
114 error = security_inode_init_security(inode, dir, (char **)&name, 114 error = security_inode_init_security(inode, dir, qstr, (char **)&name,
115 &value, &length); 115 &value, &length);
116 if (error) { 116 if (error) {
117 if (error == -EOPNOTSUPP) 117 if (error == -EOPNOTSUPP)
@@ -195,7 +195,7 @@ xfs_vn_mknod(
195 195
196 inode = VFS_I(ip); 196 inode = VFS_I(ip);
197 197
198 error = xfs_init_security(inode, dir); 198 error = xfs_init_security(inode, dir, &dentry->d_name);
199 if (unlikely(error)) 199 if (unlikely(error))
200 goto out_cleanup_inode; 200 goto out_cleanup_inode;
201 201
@@ -368,7 +368,7 @@ xfs_vn_symlink(
368 368
369 inode = VFS_I(cip); 369 inode = VFS_I(cip);
370 370
371 error = xfs_init_security(inode, dir); 371 error = xfs_init_security(inode, dir, &dentry->d_name);
372 if (unlikely(error)) 372 if (unlikely(error))
373 goto out_cleanup_inode; 373 goto out_cleanup_inode;
374 374
@@ -505,61 +505,6 @@ xfs_vn_setattr(
505 return -xfs_setattr(XFS_I(dentry->d_inode), iattr, 0); 505 return -xfs_setattr(XFS_I(dentry->d_inode), iattr, 0);
506} 506}
507 507
508STATIC long
509xfs_vn_fallocate(
510 struct inode *inode,
511 int mode,
512 loff_t offset,
513 loff_t len)
514{
515 long error;
516 loff_t new_size = 0;
517 xfs_flock64_t bf;
518 xfs_inode_t *ip = XFS_I(inode);
519 int cmd = XFS_IOC_RESVSP;
520
521 /* preallocation on directories not yet supported */
522 error = -ENODEV;
523 if (S_ISDIR(inode->i_mode))
524 goto out_error;
525
526 bf.l_whence = 0;
527 bf.l_start = offset;
528 bf.l_len = len;
529
530 xfs_ilock(ip, XFS_IOLOCK_EXCL);
531
532 if (mode & FALLOC_FL_PUNCH_HOLE)
533 cmd = XFS_IOC_UNRESVSP;
534
535 /* check the new inode size is valid before allocating */
536 if (!(mode & FALLOC_FL_KEEP_SIZE) &&
537 offset + len > i_size_read(inode)) {
538 new_size = offset + len;
539 error = inode_newsize_ok(inode, new_size);
540 if (error)
541 goto out_unlock;
542 }
543
544 error = -xfs_change_file_space(ip, cmd, &bf, 0, XFS_ATTR_NOLOCK);
545 if (error)
546 goto out_unlock;
547
548 /* Change file size if needed */
549 if (new_size) {
550 struct iattr iattr;
551
552 iattr.ia_valid = ATTR_SIZE;
553 iattr.ia_size = new_size;
554 error = -xfs_setattr(ip, &iattr, XFS_ATTR_NOLOCK);
555 }
556
557out_unlock:
558 xfs_iunlock(ip, XFS_IOLOCK_EXCL);
559out_error:
560 return error;
561}
562
563#define XFS_FIEMAP_FLAGS (FIEMAP_FLAG_SYNC|FIEMAP_FLAG_XATTR) 508#define XFS_FIEMAP_FLAGS (FIEMAP_FLAG_SYNC|FIEMAP_FLAG_XATTR)
564 509
565/* 510/*
@@ -653,7 +598,6 @@ static const struct inode_operations xfs_inode_operations = {
653 .getxattr = generic_getxattr, 598 .getxattr = generic_getxattr,
654 .removexattr = generic_removexattr, 599 .removexattr = generic_removexattr,
655 .listxattr = xfs_vn_listxattr, 600 .listxattr = xfs_vn_listxattr,
656 .fallocate = xfs_vn_fallocate,
657 .fiemap = xfs_vn_fiemap, 601 .fiemap = xfs_vn_fiemap,
658}; 602};
659 603