aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6/xfs_iops.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2008-06-22 23:25:25 -0400
committerNiv Sardi <xaiki@debian.org>2008-07-28 02:59:00 -0400
commite5700704b2b0853c059e424284cceeff3032ea28 (patch)
treef1b4a42cdbf7a745491cbcb3966f300ad52401f0 /fs/xfs/linux-2.6/xfs_iops.c
parent8f112e3bc3508afc8d1612868d178359446c08fd (diff)
[XFS] Don't update i_size for directories and special files
The core kernel uses vfs_getattr to look at the inode size and similar attributes, so there is no need to keep i_size uptodate for directories or special files. This means we can remove xfs_validate_fields because the I/O path already keeps i_size uptodate for regular files. SGI-PV: 981498 SGI-Modid: xfs-linux-melb:xfs-kern:31336a Signed-off-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: Barry Naujok <bnaujok@sgi.com> Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_iops.c')
-rw-r--r--fs/xfs/linux-2.6/xfs_iops.c61
1 files changed, 13 insertions, 48 deletions
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c
index 1f89c19cd4c4..7b42569968fe 100644
--- a/fs/xfs/linux-2.6/xfs_iops.c
+++ b/fs/xfs/linux-2.6/xfs_iops.c
@@ -181,23 +181,6 @@ xfs_ichgtime_fast(
181 mark_inode_dirty_sync(inode); 181 mark_inode_dirty_sync(inode);
182} 182}
183 183
184
185/*
186 * Pull the link count and size up from the xfs inode to the linux inode
187 */
188STATIC void
189xfs_validate_fields(
190 struct inode *inode)
191{
192 struct xfs_inode *ip = XFS_I(inode);
193 loff_t size;
194
195 /* we're under i_sem so i_size can't change under us */
196 size = XFS_ISIZE(ip);
197 if (i_size_read(inode) != size)
198 i_size_write(inode, size);
199}
200
201/* 184/*
202 * Hook in SELinux. This is not quite correct yet, what we really need 185 * Hook in SELinux. This is not quite correct yet, what we really need
203 * here (as we do for default ACLs) is a mechanism by which creation of 186 * here (as we do for default ACLs) is a mechanism by which creation of
@@ -331,10 +314,7 @@ xfs_vn_mknod(
331 } 314 }
332 315
333 316
334 if (S_ISDIR(mode))
335 xfs_validate_fields(inode);
336 d_instantiate(dentry, inode); 317 d_instantiate(dentry, inode);
337 xfs_validate_fields(dir);
338 return -error; 318 return -error;
339 319
340 out_cleanup_inode: 320 out_cleanup_inode:
@@ -450,7 +430,6 @@ xfs_vn_link(
450 } 430 }
451 431
452 xfs_iflags_set(XFS_I(dir), XFS_IMODIFIED); 432 xfs_iflags_set(XFS_I(dir), XFS_IMODIFIED);
453 xfs_validate_fields(inode);
454 d_instantiate(dentry, inode); 433 d_instantiate(dentry, inode);
455 return 0; 434 return 0;
456} 435}
@@ -460,26 +439,23 @@ xfs_vn_unlink(
460 struct inode *dir, 439 struct inode *dir,
461 struct dentry *dentry) 440 struct dentry *dentry)
462{ 441{
463 struct inode *inode;
464 struct xfs_name name; 442 struct xfs_name name;
465 int error; 443 int error;
466 444
467 inode = dentry->d_inode;
468 xfs_dentry_to_name(&name, dentry); 445 xfs_dentry_to_name(&name, dentry);
469 446
470 error = xfs_remove(XFS_I(dir), &name, XFS_I(inode)); 447 error = -xfs_remove(XFS_I(dir), &name, XFS_I(dentry->d_inode));
471 if (likely(!error)) { 448 if (error)
472 xfs_validate_fields(dir); /* size needs update */ 449 return error;
473 xfs_validate_fields(inode); 450
474 /* 451 /*
475 * With unlink, the VFS makes the dentry "negative": no inode, 452 * With unlink, the VFS makes the dentry "negative": no inode,
476 * but still hashed. This is incompatible with case-insensitive 453 * but still hashed. This is incompatible with case-insensitive
477 * mode, so invalidate (unhash) the dentry in CI-mode. 454 * mode, so invalidate (unhash) the dentry in CI-mode.
478 */ 455 */
479 if (xfs_sb_version_hasasciici(&XFS_M(dir->i_sb)->m_sb)) 456 if (xfs_sb_version_hasasciici(&XFS_M(dir->i_sb)->m_sb))
480 d_invalidate(dentry); 457 d_invalidate(dentry);
481 } 458 return 0;
482 return -error;
483} 459}
484 460
485STATIC int 461STATIC int
@@ -509,8 +485,6 @@ xfs_vn_symlink(
509 goto out_cleanup_inode; 485 goto out_cleanup_inode;
510 486
511 d_instantiate(dentry, inode); 487 d_instantiate(dentry, inode);
512 xfs_validate_fields(dir);
513 xfs_validate_fields(inode);
514 return 0; 488 return 0;
515 489
516 out_cleanup_inode: 490 out_cleanup_inode:
@@ -529,22 +503,13 @@ xfs_vn_rename(
529 struct inode *new_inode = ndentry->d_inode; 503 struct inode *new_inode = ndentry->d_inode;
530 struct xfs_name oname; 504 struct xfs_name oname;
531 struct xfs_name nname; 505 struct xfs_name nname;
532 int error;
533 506
534 xfs_dentry_to_name(&oname, odentry); 507 xfs_dentry_to_name(&oname, odentry);
535 xfs_dentry_to_name(&nname, ndentry); 508 xfs_dentry_to_name(&nname, ndentry);
536 509
537 error = xfs_rename(XFS_I(odir), &oname, XFS_I(odentry->d_inode), 510 return -xfs_rename(XFS_I(odir), &oname, XFS_I(odentry->d_inode),
538 XFS_I(ndir), &nname, new_inode ? 511 XFS_I(ndir), &nname, new_inode ?
539 XFS_I(new_inode) : NULL); 512 XFS_I(new_inode) : NULL);
540 if (likely(!error)) {
541 if (new_inode)
542 xfs_validate_fields(new_inode);
543 xfs_validate_fields(odir);
544 if (ndir != odir)
545 xfs_validate_fields(ndir);
546 }
547 return -error;
548} 513}
549 514
550/* 515/*