[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>

authored by Jeff Layton and committed by Steve French 02eadeff 1b20d672

+11 -11
+1 -1
fs/cifs/connect.c
··· 1339 1339 memcmp(&ses->server->addr.sockAddr6.sin6_addr, 1340 1340 target_ip6_addr, sizeof(*target_ip6_addr))) 1341 1341 continue; 1342 - /* BB lock server and tcp session and increment use count here?? */ 1342 + /* BB lock server and tcp session; increment use count here?? */ 1343 1343 1344 1344 /* found a match on the TCP session */ 1345 1345 *psrvTcp = ses->server;
+10 -10
fs/cifs/inode.c
··· 1408 1408 __u64 uid = 0xFFFFFFFFFFFFFFFFULL; 1409 1409 __u64 gid = 0xFFFFFFFFFFFFFFFFULL; 1410 1410 struct cifsInodeInfo *cifsInode; 1411 + struct inode *inode = direntry->d_inode; 1411 1412 1412 1413 xid = GetXid(); 1413 1414 1414 1415 cFYI(1, ("setattr on file %s attrs->iavalid 0x%x", 1415 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 1419 pTcon = cifs_sb->tcon; 1419 1420 1420 1421 if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM) == 0) { 1421 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 1424 if (rc < 0) { 1424 1425 FreeXid(xid); 1425 1426 return rc; ··· 1433 1432 FreeXid(xid); 1434 1433 return -ENOMEM; 1435 1434 } 1436 - cifsInode = CIFS_I(direntry->d_inode); 1435 + cifsInode = CIFS_I(inode); 1437 1436 1438 1437 if ((attrs->ia_valid & ATTR_MTIME) || (attrs->ia_valid & ATTR_SIZE)) { 1439 1438 /* ··· 1444 1443 will be truncated anyway? Also, should we error out here if 1445 1444 the flush returns error? 1446 1445 */ 1447 - rc = filemap_write_and_wait(direntry->d_inode->i_mapping); 1446 + rc = filemap_write_and_wait(inode->i_mapping); 1448 1447 if (rc != 0) { 1449 - CIFS_I(direntry->d_inode)->write_behind_rc = rc; 1448 + cifsInode->write_behind_rc = rc; 1450 1449 rc = 0; 1451 1450 } 1452 1451 } ··· 1522 1521 */ 1523 1522 1524 1523 if (rc == 0) { 1525 - rc = cifs_vmtruncate(direntry->d_inode, attrs->ia_size); 1526 - cifs_truncate_page(direntry->d_inode->i_mapping, 1527 - direntry->d_inode->i_size); 1524 + rc = cifs_vmtruncate(inode, attrs->ia_size); 1525 + cifs_truncate_page(inode->i_mapping, inode->i_size); 1528 1526 } else 1529 1527 goto cifs_setattr_exit; 1530 1528 } ··· 1557 1557 rc = 0; 1558 1558 #ifdef CONFIG_CIFS_EXPERIMENTAL 1559 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 1561 else if ((mode & S_IWUGO) == 0) { 1562 1562 #else 1563 1563 if ((mode & S_IWUGO) == 0) { ··· 1665 1665 /* do not need local check to inode_check_ok since the server does 1666 1666 that */ 1667 1667 if (!rc) 1668 - rc = inode_setattr(direntry->d_inode, attrs); 1668 + rc = inode_setattr(inode, attrs); 1669 1669 cifs_setattr_exit: 1670 1670 kfree(full_path); 1671 1671 FreeXid(xid);