diff options
Diffstat (limited to 'fs/xfs/xfs_iops.c')
-rw-r--r-- | fs/xfs/xfs_iops.c | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index 205613a06068..72129493e9d3 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c | |||
@@ -72,7 +72,7 @@ xfs_initxattrs( | |||
72 | int error = 0; | 72 | int error = 0; |
73 | 73 | ||
74 | for (xattr = xattr_array; xattr->name != NULL; xattr++) { | 74 | for (xattr = xattr_array; xattr->name != NULL; xattr++) { |
75 | error = -xfs_attr_set(ip, xattr->name, xattr->value, | 75 | error = xfs_attr_set(ip, xattr->name, xattr->value, |
76 | xattr->value_len, ATTR_SECURE); | 76 | xattr->value_len, ATTR_SECURE); |
77 | if (error < 0) | 77 | if (error < 0) |
78 | break; | 78 | break; |
@@ -93,7 +93,7 @@ xfs_init_security( | |||
93 | struct inode *dir, | 93 | struct inode *dir, |
94 | const struct qstr *qstr) | 94 | const struct qstr *qstr) |
95 | { | 95 | { |
96 | return -security_inode_init_security(inode, dir, qstr, | 96 | return security_inode_init_security(inode, dir, qstr, |
97 | &xfs_initxattrs, NULL); | 97 | &xfs_initxattrs, NULL); |
98 | } | 98 | } |
99 | 99 | ||
@@ -173,12 +173,12 @@ xfs_generic_create( | |||
173 | 173 | ||
174 | #ifdef CONFIG_XFS_POSIX_ACL | 174 | #ifdef CONFIG_XFS_POSIX_ACL |
175 | if (default_acl) { | 175 | if (default_acl) { |
176 | error = -xfs_set_acl(inode, default_acl, ACL_TYPE_DEFAULT); | 176 | error = xfs_set_acl(inode, default_acl, ACL_TYPE_DEFAULT); |
177 | if (error) | 177 | if (error) |
178 | goto out_cleanup_inode; | 178 | goto out_cleanup_inode; |
179 | } | 179 | } |
180 | if (acl) { | 180 | if (acl) { |
181 | error = -xfs_set_acl(inode, acl, ACL_TYPE_ACCESS); | 181 | error = xfs_set_acl(inode, acl, ACL_TYPE_ACCESS); |
182 | if (error) | 182 | if (error) |
183 | goto out_cleanup_inode; | 183 | goto out_cleanup_inode; |
184 | } | 184 | } |
@@ -194,7 +194,7 @@ xfs_generic_create( | |||
194 | posix_acl_release(default_acl); | 194 | posix_acl_release(default_acl); |
195 | if (acl) | 195 | if (acl) |
196 | posix_acl_release(acl); | 196 | posix_acl_release(acl); |
197 | return -error; | 197 | return error; |
198 | 198 | ||
199 | out_cleanup_inode: | 199 | out_cleanup_inode: |
200 | if (!tmpfile) | 200 | if (!tmpfile) |
@@ -248,8 +248,8 @@ xfs_vn_lookup( | |||
248 | xfs_dentry_to_name(&name, dentry, 0); | 248 | xfs_dentry_to_name(&name, dentry, 0); |
249 | error = xfs_lookup(XFS_I(dir), &name, &cip, NULL); | 249 | error = xfs_lookup(XFS_I(dir), &name, &cip, NULL); |
250 | if (unlikely(error)) { | 250 | if (unlikely(error)) { |
251 | if (unlikely(error != ENOENT)) | 251 | if (unlikely(error != -ENOENT)) |
252 | return ERR_PTR(-error); | 252 | return ERR_PTR(error); |
253 | d_add(dentry, NULL); | 253 | d_add(dentry, NULL); |
254 | return NULL; | 254 | return NULL; |
255 | } | 255 | } |
@@ -275,8 +275,8 @@ xfs_vn_ci_lookup( | |||
275 | xfs_dentry_to_name(&xname, dentry, 0); | 275 | xfs_dentry_to_name(&xname, dentry, 0); |
276 | error = xfs_lookup(XFS_I(dir), &xname, &ip, &ci_name); | 276 | error = xfs_lookup(XFS_I(dir), &xname, &ip, &ci_name); |
277 | if (unlikely(error)) { | 277 | if (unlikely(error)) { |
278 | if (unlikely(error != ENOENT)) | 278 | if (unlikely(error != -ENOENT)) |
279 | return ERR_PTR(-error); | 279 | return ERR_PTR(error); |
280 | /* | 280 | /* |
281 | * call d_add(dentry, NULL) here when d_drop_negative_children | 281 | * call d_add(dentry, NULL) here when d_drop_negative_children |
282 | * is called in xfs_vn_mknod (ie. allow negative dentries | 282 | * is called in xfs_vn_mknod (ie. allow negative dentries |
@@ -311,7 +311,7 @@ xfs_vn_link( | |||
311 | 311 | ||
312 | error = xfs_link(XFS_I(dir), XFS_I(inode), &name); | 312 | error = xfs_link(XFS_I(dir), XFS_I(inode), &name); |
313 | if (unlikely(error)) | 313 | if (unlikely(error)) |
314 | return -error; | 314 | return error; |
315 | 315 | ||
316 | ihold(inode); | 316 | ihold(inode); |
317 | d_instantiate(dentry, inode); | 317 | d_instantiate(dentry, inode); |
@@ -328,7 +328,7 @@ xfs_vn_unlink( | |||
328 | 328 | ||
329 | xfs_dentry_to_name(&name, dentry, 0); | 329 | xfs_dentry_to_name(&name, dentry, 0); |
330 | 330 | ||
331 | error = -xfs_remove(XFS_I(dir), &name, XFS_I(dentry->d_inode)); | 331 | error = xfs_remove(XFS_I(dir), &name, XFS_I(dentry->d_inode)); |
332 | if (error) | 332 | if (error) |
333 | return error; | 333 | return error; |
334 | 334 | ||
@@ -375,7 +375,7 @@ xfs_vn_symlink( | |||
375 | xfs_cleanup_inode(dir, inode, dentry); | 375 | xfs_cleanup_inode(dir, inode, dentry); |
376 | iput(inode); | 376 | iput(inode); |
377 | out: | 377 | out: |
378 | return -error; | 378 | return error; |
379 | } | 379 | } |
380 | 380 | ||
381 | STATIC int | 381 | STATIC int |
@@ -392,8 +392,8 @@ xfs_vn_rename( | |||
392 | xfs_dentry_to_name(&oname, odentry, 0); | 392 | xfs_dentry_to_name(&oname, odentry, 0); |
393 | xfs_dentry_to_name(&nname, ndentry, odentry->d_inode->i_mode); | 393 | xfs_dentry_to_name(&nname, ndentry, odentry->d_inode->i_mode); |
394 | 394 | ||
395 | return -xfs_rename(XFS_I(odir), &oname, XFS_I(odentry->d_inode), | 395 | return xfs_rename(XFS_I(odir), &oname, XFS_I(odentry->d_inode), |
396 | XFS_I(ndir), &nname, new_inode ? | 396 | XFS_I(ndir), &nname, new_inode ? |
397 | XFS_I(new_inode) : NULL); | 397 | XFS_I(new_inode) : NULL); |
398 | } | 398 | } |
399 | 399 | ||
@@ -414,7 +414,7 @@ xfs_vn_follow_link( | |||
414 | if (!link) | 414 | if (!link) |
415 | goto out_err; | 415 | goto out_err; |
416 | 416 | ||
417 | error = -xfs_readlink(XFS_I(dentry->d_inode), link); | 417 | error = xfs_readlink(XFS_I(dentry->d_inode), link); |
418 | if (unlikely(error)) | 418 | if (unlikely(error)) |
419 | goto out_kfree; | 419 | goto out_kfree; |
420 | 420 | ||
@@ -441,7 +441,7 @@ xfs_vn_getattr( | |||
441 | trace_xfs_getattr(ip); | 441 | trace_xfs_getattr(ip); |
442 | 442 | ||
443 | if (XFS_FORCED_SHUTDOWN(mp)) | 443 | if (XFS_FORCED_SHUTDOWN(mp)) |
444 | return -XFS_ERROR(EIO); | 444 | return -EIO; |
445 | 445 | ||
446 | stat->size = XFS_ISIZE(ip); | 446 | stat->size = XFS_ISIZE(ip); |
447 | stat->dev = inode->i_sb->s_dev; | 447 | stat->dev = inode->i_sb->s_dev; |
@@ -546,14 +546,14 @@ xfs_setattr_nonsize( | |||
546 | /* If acls are being inherited, we already have this checked */ | 546 | /* If acls are being inherited, we already have this checked */ |
547 | if (!(flags & XFS_ATTR_NOACL)) { | 547 | if (!(flags & XFS_ATTR_NOACL)) { |
548 | if (mp->m_flags & XFS_MOUNT_RDONLY) | 548 | if (mp->m_flags & XFS_MOUNT_RDONLY) |
549 | return XFS_ERROR(EROFS); | 549 | return -EROFS; |
550 | 550 | ||
551 | if (XFS_FORCED_SHUTDOWN(mp)) | 551 | if (XFS_FORCED_SHUTDOWN(mp)) |
552 | return XFS_ERROR(EIO); | 552 | return -EIO; |
553 | 553 | ||
554 | error = -inode_change_ok(inode, iattr); | 554 | error = inode_change_ok(inode, iattr); |
555 | if (error) | 555 | if (error) |
556 | return XFS_ERROR(error); | 556 | return error; |
557 | } | 557 | } |
558 | 558 | ||
559 | ASSERT((mask & ATTR_SIZE) == 0); | 559 | ASSERT((mask & ATTR_SIZE) == 0); |
@@ -703,7 +703,7 @@ xfs_setattr_nonsize( | |||
703 | xfs_qm_dqrele(gdqp); | 703 | xfs_qm_dqrele(gdqp); |
704 | 704 | ||
705 | if (error) | 705 | if (error) |
706 | return XFS_ERROR(error); | 706 | return error; |
707 | 707 | ||
708 | /* | 708 | /* |
709 | * XXX(hch): Updating the ACL entries is not atomic vs the i_mode | 709 | * XXX(hch): Updating the ACL entries is not atomic vs the i_mode |
@@ -713,9 +713,9 @@ xfs_setattr_nonsize( | |||
713 | * Posix ACL code seems to care about this issue either. | 713 | * Posix ACL code seems to care about this issue either. |
714 | */ | 714 | */ |
715 | if ((mask & ATTR_MODE) && !(flags & XFS_ATTR_NOACL)) { | 715 | if ((mask & ATTR_MODE) && !(flags & XFS_ATTR_NOACL)) { |
716 | error = -posix_acl_chmod(inode, inode->i_mode); | 716 | error = posix_acl_chmod(inode, inode->i_mode); |
717 | if (error) | 717 | if (error) |
718 | return XFS_ERROR(error); | 718 | return error; |
719 | } | 719 | } |
720 | 720 | ||
721 | return 0; | 721 | return 0; |
@@ -748,14 +748,14 @@ xfs_setattr_size( | |||
748 | trace_xfs_setattr(ip); | 748 | trace_xfs_setattr(ip); |
749 | 749 | ||
750 | if (mp->m_flags & XFS_MOUNT_RDONLY) | 750 | if (mp->m_flags & XFS_MOUNT_RDONLY) |
751 | return XFS_ERROR(EROFS); | 751 | return -EROFS; |
752 | 752 | ||
753 | if (XFS_FORCED_SHUTDOWN(mp)) | 753 | if (XFS_FORCED_SHUTDOWN(mp)) |
754 | return XFS_ERROR(EIO); | 754 | return -EIO; |
755 | 755 | ||
756 | error = -inode_change_ok(inode, iattr); | 756 | error = inode_change_ok(inode, iattr); |
757 | if (error) | 757 | if (error) |
758 | return XFS_ERROR(error); | 758 | return error; |
759 | 759 | ||
760 | ASSERT(xfs_isilocked(ip, XFS_IOLOCK_EXCL)); | 760 | ASSERT(xfs_isilocked(ip, XFS_IOLOCK_EXCL)); |
761 | ASSERT(S_ISREG(ip->i_d.di_mode)); | 761 | ASSERT(S_ISREG(ip->i_d.di_mode)); |
@@ -818,7 +818,7 @@ xfs_setattr_size( | |||
818 | * care about here. | 818 | * care about here. |
819 | */ | 819 | */ |
820 | if (oldsize != ip->i_d.di_size && newsize > ip->i_d.di_size) { | 820 | if (oldsize != ip->i_d.di_size && newsize > ip->i_d.di_size) { |
821 | error = -filemap_write_and_wait_range(VFS_I(ip)->i_mapping, | 821 | error = filemap_write_and_wait_range(VFS_I(ip)->i_mapping, |
822 | ip->i_d.di_size, newsize); | 822 | ip->i_d.di_size, newsize); |
823 | if (error) | 823 | if (error) |
824 | return error; | 824 | return error; |
@@ -844,7 +844,7 @@ xfs_setattr_size( | |||
844 | * much we can do about this, except to hope that the caller sees ENOMEM | 844 | * much we can do about this, except to hope that the caller sees ENOMEM |
845 | * and retries the truncate operation. | 845 | * and retries the truncate operation. |
846 | */ | 846 | */ |
847 | error = -block_truncate_page(inode->i_mapping, newsize, xfs_get_blocks); | 847 | error = block_truncate_page(inode->i_mapping, newsize, xfs_get_blocks); |
848 | if (error) | 848 | if (error) |
849 | return error; | 849 | return error; |
850 | truncate_setsize(inode, newsize); | 850 | truncate_setsize(inode, newsize); |
@@ -950,7 +950,7 @@ xfs_vn_setattr( | |||
950 | error = xfs_setattr_nonsize(ip, iattr, 0); | 950 | error = xfs_setattr_nonsize(ip, iattr, 0); |
951 | } | 951 | } |
952 | 952 | ||
953 | return -error; | 953 | return error; |
954 | } | 954 | } |
955 | 955 | ||
956 | STATIC int | 956 | STATIC int |
@@ -970,7 +970,7 @@ xfs_vn_update_time( | |||
970 | error = xfs_trans_reserve(tp, &M_RES(mp)->tr_fsyncts, 0, 0); | 970 | error = xfs_trans_reserve(tp, &M_RES(mp)->tr_fsyncts, 0, 0); |
971 | if (error) { | 971 | if (error) { |
972 | xfs_trans_cancel(tp, 0); | 972 | xfs_trans_cancel(tp, 0); |
973 | return -error; | 973 | return error; |
974 | } | 974 | } |
975 | 975 | ||
976 | xfs_ilock(ip, XFS_ILOCK_EXCL); | 976 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
@@ -991,7 +991,7 @@ xfs_vn_update_time( | |||
991 | } | 991 | } |
992 | xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); | 992 | xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); |
993 | xfs_trans_log_inode(tp, ip, XFS_ILOG_TIMESTAMP); | 993 | xfs_trans_log_inode(tp, ip, XFS_ILOG_TIMESTAMP); |
994 | return -xfs_trans_commit(tp, 0); | 994 | return xfs_trans_commit(tp, 0); |
995 | } | 995 | } |
996 | 996 | ||
997 | #define XFS_FIEMAP_FLAGS (FIEMAP_FLAG_SYNC|FIEMAP_FLAG_XATTR) | 997 | #define XFS_FIEMAP_FLAGS (FIEMAP_FLAG_SYNC|FIEMAP_FLAG_XATTR) |
@@ -1036,7 +1036,7 @@ xfs_fiemap_format( | |||
1036 | *full = 1; /* user array now full */ | 1036 | *full = 1; /* user array now full */ |
1037 | } | 1037 | } |
1038 | 1038 | ||
1039 | return -error; | 1039 | return error; |
1040 | } | 1040 | } |
1041 | 1041 | ||
1042 | STATIC int | 1042 | STATIC int |
@@ -1055,12 +1055,12 @@ xfs_vn_fiemap( | |||
1055 | return error; | 1055 | return error; |
1056 | 1056 | ||
1057 | /* Set up bmap header for xfs internal routine */ | 1057 | /* Set up bmap header for xfs internal routine */ |
1058 | bm.bmv_offset = BTOBB(start); | 1058 | bm.bmv_offset = BTOBBT(start); |
1059 | /* Special case for whole file */ | 1059 | /* Special case for whole file */ |
1060 | if (length == FIEMAP_MAX_OFFSET) | 1060 | if (length == FIEMAP_MAX_OFFSET) |
1061 | bm.bmv_length = -1LL; | 1061 | bm.bmv_length = -1LL; |
1062 | else | 1062 | else |
1063 | bm.bmv_length = BTOBB(length); | 1063 | bm.bmv_length = BTOBB(start + length) - bm.bmv_offset; |
1064 | 1064 | ||
1065 | /* We add one because in getbmap world count includes the header */ | 1065 | /* We add one because in getbmap world count includes the header */ |
1066 | bm.bmv_count = !fieinfo->fi_extents_max ? MAXEXTNUM : | 1066 | bm.bmv_count = !fieinfo->fi_extents_max ? MAXEXTNUM : |
@@ -1075,7 +1075,7 @@ xfs_vn_fiemap( | |||
1075 | 1075 | ||
1076 | error = xfs_getbmap(ip, &bm, xfs_fiemap_format, fieinfo); | 1076 | error = xfs_getbmap(ip, &bm, xfs_fiemap_format, fieinfo); |
1077 | if (error) | 1077 | if (error) |
1078 | return -error; | 1078 | return error; |
1079 | 1079 | ||
1080 | return 0; | 1080 | return 0; |
1081 | } | 1081 | } |