aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/inode.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2008-05-09 17:26:11 -0400
committerSteve French <sfrench@us.ibm.com>2008-05-11 13:45:43 -0400
commit02eadeffda169a45946c79270ec19f45eeafb8e7 (patch)
treeb416ae6cd3d48b4188716cfd7fe7b90808bb28ac /fs/cifs/inode.c
parent1b20d672188bf80baef60d515a123f556871a5ce (diff)
[CIFS] add local struct inode pointer to cifs_setattr
Clean up cifs_setattr a bit by adding a local inode pointer, and changing all of the direntry->d_inode references to it. This also adds a bit of micro-optimization. d_inode shouldn't change over the life of this function, so we only need to dereference it once. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/inode.c')
-rw-r--r--fs/cifs/inode.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 0d9d2e6d7af6..d904a037c833 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -1408,18 +1408,19 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1408 __u64 uid = 0xFFFFFFFFFFFFFFFFULL; 1408 __u64 uid = 0xFFFFFFFFFFFFFFFFULL;
1409 __u64 gid = 0xFFFFFFFFFFFFFFFFULL; 1409 __u64 gid = 0xFFFFFFFFFFFFFFFFULL;
1410 struct cifsInodeInfo *cifsInode; 1410 struct cifsInodeInfo *cifsInode;
1411 struct inode *inode = direntry->d_inode;
1411 1412
1412 xid = GetXid(); 1413 xid = GetXid();
1413 1414
1414 cFYI(1, ("setattr on file %s attrs->iavalid 0x%x", 1415 cFYI(1, ("setattr on file %s attrs->iavalid 0x%x",
1415 direntry->d_name.name, attrs->ia_valid)); 1416 direntry->d_name.name, attrs->ia_valid));
1416 1417
1417 cifs_sb = CIFS_SB(direntry->d_inode->i_sb); 1418 cifs_sb = CIFS_SB(inode->i_sb);
1418 pTcon = cifs_sb->tcon; 1419 pTcon = cifs_sb->tcon;
1419 1420
1420 if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM) == 0) { 1421 if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM) == 0) {
1421 /* check if we have permission to change attrs */ 1422 /* check if we have permission to change attrs */
1422 rc = inode_change_ok(direntry->d_inode, attrs); 1423 rc = inode_change_ok(inode, attrs);
1423 if (rc < 0) { 1424 if (rc < 0) {
1424 FreeXid(xid); 1425 FreeXid(xid);
1425 return rc; 1426 return rc;
@@ -1432,7 +1433,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1432 FreeXid(xid); 1433 FreeXid(xid);
1433 return -ENOMEM; 1434 return -ENOMEM;
1434 } 1435 }
1435 cifsInode = CIFS_I(direntry->d_inode); 1436 cifsInode = CIFS_I(inode);
1436 1437
1437 if ((attrs->ia_valid & ATTR_MTIME) || (attrs->ia_valid & ATTR_SIZE)) { 1438 if ((attrs->ia_valid & ATTR_MTIME) || (attrs->ia_valid & ATTR_SIZE)) {
1438 /* 1439 /*
@@ -1443,9 +1444,9 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1443 will be truncated anyway? Also, should we error out here if 1444 will be truncated anyway? Also, should we error out here if
1444 the flush returns error? 1445 the flush returns error?
1445 */ 1446 */
1446 rc = filemap_write_and_wait(direntry->d_inode->i_mapping); 1447 rc = filemap_write_and_wait(inode->i_mapping);
1447 if (rc != 0) { 1448 if (rc != 0) {
1448 CIFS_I(direntry->d_inode)->write_behind_rc = rc; 1449 cifsInode->write_behind_rc = rc;
1449 rc = 0; 1450 rc = 0;
1450 } 1451 }
1451 } 1452 }
@@ -1521,9 +1522,8 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1521 */ 1522 */
1522 1523
1523 if (rc == 0) { 1524 if (rc == 0) {
1524 rc = cifs_vmtruncate(direntry->d_inode, attrs->ia_size); 1525 rc = cifs_vmtruncate(inode, attrs->ia_size);
1525 cifs_truncate_page(direntry->d_inode->i_mapping, 1526 cifs_truncate_page(inode->i_mapping, inode->i_size);
1526 direntry->d_inode->i_size);
1527 } else 1527 } else
1528 goto cifs_setattr_exit; 1528 goto cifs_setattr_exit;
1529 } 1529 }
@@ -1557,7 +1557,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1557 rc = 0; 1557 rc = 0;
1558#ifdef CONFIG_CIFS_EXPERIMENTAL 1558#ifdef CONFIG_CIFS_EXPERIMENTAL
1559 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) 1559 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL)
1560 rc = mode_to_acl(direntry->d_inode, full_path, mode); 1560 rc = mode_to_acl(inode, full_path, mode);
1561 else if ((mode & S_IWUGO) == 0) { 1561 else if ((mode & S_IWUGO) == 0) {
1562#else 1562#else
1563 if ((mode & S_IWUGO) == 0) { 1563 if ((mode & S_IWUGO) == 0) {
@@ -1665,7 +1665,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1665 /* do not need local check to inode_check_ok since the server does 1665 /* do not need local check to inode_check_ok since the server does
1666 that */ 1666 that */
1667 if (!rc) 1667 if (!rc)
1668 rc = inode_setattr(direntry->d_inode, attrs); 1668 rc = inode_setattr(inode, attrs);
1669cifs_setattr_exit: 1669cifs_setattr_exit:
1670 kfree(full_path); 1670 kfree(full_path);
1671 FreeXid(xid); 1671 FreeXid(xid);