diff options
author | Jeff Layton <jlayton@redhat.com> | 2010-09-20 19:01:33 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2010-09-29 15:04:32 -0400 |
commit | a6e8a8455c94565c53e1a1756d2ab9d9e3a902b8 (patch) | |
tree | 544628293da6aa14a136c915d887d0abdc689a03 /fs/cifs/inode.c | |
parent | ba00ba64cf0895e4c2ac507e56306363dc125a90 (diff) |
cifs: add function to get a tcon from cifs_sb
When we convert cifs to do multiple sessions per mount, we'll need more
than one tcon per superblock. At that point "cifs_sb->tcon" will make
no sense. Add a new accessor function that gets a tcon given a cifs_sb.
For now, it just returns cifs_sb->tcon. Later it'll do more.
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.c | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 0fa145596fcf..dce2d598927e 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -52,7 +52,7 @@ static void cifs_set_ops(struct inode *inode, const bool is_dfs_referral) | |||
52 | 52 | ||
53 | 53 | ||
54 | /* check if server can support readpages */ | 54 | /* check if server can support readpages */ |
55 | if (cifs_sb->tcon->ses->server->maxBuf < | 55 | if (cifs_sb_tcon(cifs_sb)->ses->server->maxBuf < |
56 | PAGE_CACHE_SIZE + MAX_CIFS_HDR_SIZE) | 56 | PAGE_CACHE_SIZE + MAX_CIFS_HDR_SIZE) |
57 | inode->i_data.a_ops = &cifs_addr_ops_smallbuf; | 57 | inode->i_data.a_ops = &cifs_addr_ops_smallbuf; |
58 | else | 58 | else |
@@ -315,7 +315,8 @@ int cifs_get_inode_info_unix(struct inode **pinode, | |||
315 | struct cifsTconInfo *tcon; | 315 | struct cifsTconInfo *tcon; |
316 | struct cifs_sb_info *cifs_sb = CIFS_SB(sb); | 316 | struct cifs_sb_info *cifs_sb = CIFS_SB(sb); |
317 | 317 | ||
318 | tcon = cifs_sb->tcon; | 318 | tcon = cifs_sb_tcon(cifs_sb); |
319 | |||
319 | cFYI(1, "Getting info on %s", full_path); | 320 | cFYI(1, "Getting info on %s", full_path); |
320 | 321 | ||
321 | /* could have done a find first instead but this returns more info */ | 322 | /* could have done a find first instead but this returns more info */ |
@@ -360,7 +361,7 @@ cifs_sfu_type(struct cifs_fattr *fattr, const unsigned char *path, | |||
360 | int rc; | 361 | int rc; |
361 | int oplock = 0; | 362 | int oplock = 0; |
362 | __u16 netfid; | 363 | __u16 netfid; |
363 | struct cifsTconInfo *pTcon = cifs_sb->tcon; | 364 | struct cifsTconInfo *pTcon = cifs_sb_tcon(cifs_sb); |
364 | char buf[24]; | 365 | char buf[24]; |
365 | unsigned int bytes_read; | 366 | unsigned int bytes_read; |
366 | char *pbuf; | 367 | char *pbuf; |
@@ -449,7 +450,7 @@ static int cifs_sfu_mode(struct cifs_fattr *fattr, const unsigned char *path, | |||
449 | char ea_value[4]; | 450 | char ea_value[4]; |
450 | __u32 mode; | 451 | __u32 mode; |
451 | 452 | ||
452 | rc = CIFSSMBQAllEAs(xid, cifs_sb->tcon, path, "SETFILEBITS", | 453 | rc = CIFSSMBQAllEAs(xid, cifs_sb_tcon(cifs_sb), path, "SETFILEBITS", |
453 | ea_value, 4 /* size of buf */, cifs_sb->local_nls, | 454 | ea_value, 4 /* size of buf */, cifs_sb->local_nls, |
454 | cifs_sb->mnt_cifs_flags & | 455 | cifs_sb->mnt_cifs_flags & |
455 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 456 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
@@ -489,8 +490,8 @@ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info, | |||
489 | fattr->cf_mtime = cifs_NTtimeToUnix(info->LastWriteTime); | 490 | fattr->cf_mtime = cifs_NTtimeToUnix(info->LastWriteTime); |
490 | 491 | ||
491 | if (adjust_tz) { | 492 | if (adjust_tz) { |
492 | fattr->cf_ctime.tv_sec += cifs_sb->tcon->ses->server->timeAdj; | 493 | fattr->cf_ctime.tv_sec += cifs_sb_tcon(cifs_sb)->ses->server->timeAdj; |
493 | fattr->cf_mtime.tv_sec += cifs_sb->tcon->ses->server->timeAdj; | 494 | fattr->cf_mtime.tv_sec += cifs_sb_tcon(cifs_sb)->ses->server->timeAdj; |
494 | } | 495 | } |
495 | 496 | ||
496 | fattr->cf_eof = le64_to_cpu(info->EndOfFile); | 497 | fattr->cf_eof = le64_to_cpu(info->EndOfFile); |
@@ -566,7 +567,7 @@ int cifs_get_inode_info(struct inode **pinode, | |||
566 | bool adjustTZ = false; | 567 | bool adjustTZ = false; |
567 | struct cifs_fattr fattr; | 568 | struct cifs_fattr fattr; |
568 | 569 | ||
569 | pTcon = cifs_sb->tcon; | 570 | pTcon = cifs_sb_tcon(cifs_sb); |
570 | cFYI(1, "Getting info on %s", full_path); | 571 | cFYI(1, "Getting info on %s", full_path); |
571 | 572 | ||
572 | if ((pfindData == NULL) && (*pinode != NULL)) { | 573 | if ((pfindData == NULL) && (*pinode != NULL)) { |
@@ -706,8 +707,8 @@ char *cifs_build_path_to_root(struct cifs_sb_info *cifs_sb) | |||
706 | return full_path; | 707 | return full_path; |
707 | } | 708 | } |
708 | 709 | ||
709 | if (cifs_sb->tcon && (cifs_sb->tcon->Flags & SMB_SHARE_IS_IN_DFS)) | 710 | if (cifs_sb_tcon(cifs_sb) && (cifs_sb_tcon(cifs_sb)->Flags & SMB_SHARE_IS_IN_DFS)) |
710 | dfsplen = strnlen(cifs_sb->tcon->treeName, MAX_TREE_SIZE + 1); | 711 | dfsplen = strnlen(cifs_sb_tcon(cifs_sb)->treeName, MAX_TREE_SIZE + 1); |
711 | else | 712 | else |
712 | dfsplen = 0; | 713 | dfsplen = 0; |
713 | 714 | ||
@@ -716,7 +717,7 @@ char *cifs_build_path_to_root(struct cifs_sb_info *cifs_sb) | |||
716 | return full_path; | 717 | return full_path; |
717 | 718 | ||
718 | if (dfsplen) { | 719 | if (dfsplen) { |
719 | strncpy(full_path, cifs_sb->tcon->treeName, dfsplen); | 720 | strncpy(full_path, cifs_sb_tcon(cifs_sb)->treeName, dfsplen); |
720 | /* switch slash direction in prepath depending on whether | 721 | /* switch slash direction in prepath depending on whether |
721 | * windows or posix style path names | 722 | * windows or posix style path names |
722 | */ | 723 | */ |
@@ -841,7 +842,7 @@ struct inode *cifs_root_iget(struct super_block *sb, unsigned long ino) | |||
841 | return ERR_PTR(-ENOMEM); | 842 | return ERR_PTR(-ENOMEM); |
842 | 843 | ||
843 | xid = GetXid(); | 844 | xid = GetXid(); |
844 | if (cifs_sb->tcon->unix_ext) | 845 | if (cifs_sb_tcon(cifs_sb)->unix_ext) |
845 | rc = cifs_get_inode_info_unix(&inode, full_path, sb, xid); | 846 | rc = cifs_get_inode_info_unix(&inode, full_path, sb, xid); |
846 | else | 847 | else |
847 | rc = cifs_get_inode_info(&inode, full_path, NULL, sb, | 848 | rc = cifs_get_inode_info(&inode, full_path, NULL, sb, |
@@ -852,10 +853,10 @@ struct inode *cifs_root_iget(struct super_block *sb, unsigned long ino) | |||
852 | 853 | ||
853 | #ifdef CONFIG_CIFS_FSCACHE | 854 | #ifdef CONFIG_CIFS_FSCACHE |
854 | /* populate tcon->resource_id */ | 855 | /* populate tcon->resource_id */ |
855 | cifs_sb->tcon->resource_id = CIFS_I(inode)->uniqueid; | 856 | cifs_sb_tcon(cifs_sb)->resource_id = CIFS_I(inode)->uniqueid; |
856 | #endif | 857 | #endif |
857 | 858 | ||
858 | if (rc && cifs_sb->tcon->ipc) { | 859 | if (rc && cifs_sb_tcon(cifs_sb)->ipc) { |
859 | cFYI(1, "ipc connection - fake read inode"); | 860 | cFYI(1, "ipc connection - fake read inode"); |
860 | inode->i_mode |= S_IFDIR; | 861 | inode->i_mode |= S_IFDIR; |
861 | inode->i_nlink = 2; | 862 | inode->i_nlink = 2; |
@@ -938,7 +939,7 @@ cifs_set_file_info(struct inode *inode, struct iattr *attrs, int xid, | |||
938 | goto set_via_filehandle; | 939 | goto set_via_filehandle; |
939 | } | 940 | } |
940 | 941 | ||
941 | pTcon = cifs_sb->tcon; | 942 | pTcon = cifs_sb_tcon(cifs_sb); |
942 | 943 | ||
943 | /* | 944 | /* |
944 | * NT4 apparently returns success on this call, but it doesn't | 945 | * NT4 apparently returns success on this call, but it doesn't |
@@ -1000,7 +1001,7 @@ cifs_rename_pending_delete(char *full_path, struct dentry *dentry, int xid) | |||
1000 | struct inode *inode = dentry->d_inode; | 1001 | struct inode *inode = dentry->d_inode; |
1001 | struct cifsInodeInfo *cifsInode = CIFS_I(inode); | 1002 | struct cifsInodeInfo *cifsInode = CIFS_I(inode); |
1002 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); | 1003 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); |
1003 | struct cifsTconInfo *tcon = cifs_sb->tcon; | 1004 | struct cifsTconInfo *tcon = cifs_sb_tcon(cifs_sb); |
1004 | __u32 dosattr, origattr; | 1005 | __u32 dosattr, origattr; |
1005 | FILE_BASIC_INFO *info_buf = NULL; | 1006 | FILE_BASIC_INFO *info_buf = NULL; |
1006 | 1007 | ||
@@ -1111,7 +1112,7 @@ int cifs_unlink(struct inode *dir, struct dentry *dentry) | |||
1111 | struct cifsInodeInfo *cifs_inode; | 1112 | struct cifsInodeInfo *cifs_inode; |
1112 | struct super_block *sb = dir->i_sb; | 1113 | struct super_block *sb = dir->i_sb; |
1113 | struct cifs_sb_info *cifs_sb = CIFS_SB(sb); | 1114 | struct cifs_sb_info *cifs_sb = CIFS_SB(sb); |
1114 | struct cifsTconInfo *tcon = cifs_sb->tcon; | 1115 | struct cifsTconInfo *tcon = cifs_sb_tcon(cifs_sb); |
1115 | struct iattr *attrs = NULL; | 1116 | struct iattr *attrs = NULL; |
1116 | __u32 dosattr = 0, origattr = 0; | 1117 | __u32 dosattr = 0, origattr = 0; |
1117 | 1118 | ||
@@ -1213,7 +1214,7 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode) | |||
1213 | xid = GetXid(); | 1214 | xid = GetXid(); |
1214 | 1215 | ||
1215 | cifs_sb = CIFS_SB(inode->i_sb); | 1216 | cifs_sb = CIFS_SB(inode->i_sb); |
1216 | pTcon = cifs_sb->tcon; | 1217 | pTcon = cifs_sb_tcon(cifs_sb); |
1217 | 1218 | ||
1218 | full_path = build_path_from_dentry(direntry); | 1219 | full_path = build_path_from_dentry(direntry); |
1219 | if (full_path == NULL) { | 1220 | if (full_path == NULL) { |
@@ -1394,7 +1395,7 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry) | |||
1394 | xid = GetXid(); | 1395 | xid = GetXid(); |
1395 | 1396 | ||
1396 | cifs_sb = CIFS_SB(inode->i_sb); | 1397 | cifs_sb = CIFS_SB(inode->i_sb); |
1397 | pTcon = cifs_sb->tcon; | 1398 | pTcon = cifs_sb_tcon(cifs_sb); |
1398 | 1399 | ||
1399 | full_path = build_path_from_dentry(direntry); | 1400 | full_path = build_path_from_dentry(direntry); |
1400 | if (full_path == NULL) { | 1401 | if (full_path == NULL) { |
@@ -1435,7 +1436,7 @@ cifs_do_rename(int xid, struct dentry *from_dentry, const char *fromPath, | |||
1435 | struct dentry *to_dentry, const char *toPath) | 1436 | struct dentry *to_dentry, const char *toPath) |
1436 | { | 1437 | { |
1437 | struct cifs_sb_info *cifs_sb = CIFS_SB(from_dentry->d_sb); | 1438 | struct cifs_sb_info *cifs_sb = CIFS_SB(from_dentry->d_sb); |
1438 | struct cifsTconInfo *pTcon = cifs_sb->tcon; | 1439 | struct cifsTconInfo *pTcon = cifs_sb_tcon(cifs_sb); |
1439 | __u16 srcfid; | 1440 | __u16 srcfid; |
1440 | int oplock, rc; | 1441 | int oplock, rc; |
1441 | 1442 | ||
@@ -1486,7 +1487,7 @@ int cifs_rename(struct inode *source_dir, struct dentry *source_dentry, | |||
1486 | int xid, rc, tmprc; | 1487 | int xid, rc, tmprc; |
1487 | 1488 | ||
1488 | cifs_sb = CIFS_SB(source_dir->i_sb); | 1489 | cifs_sb = CIFS_SB(source_dir->i_sb); |
1489 | tcon = cifs_sb->tcon; | 1490 | tcon = cifs_sb_tcon(cifs_sb); |
1490 | 1491 | ||
1491 | xid = GetXid(); | 1492 | xid = GetXid(); |
1492 | 1493 | ||
@@ -1660,7 +1661,7 @@ int cifs_revalidate_dentry(struct dentry *dentry) | |||
1660 | "jiffies %ld", full_path, inode, inode->i_count.counter, | 1661 | "jiffies %ld", full_path, inode, inode->i_count.counter, |
1661 | dentry, dentry->d_time, jiffies); | 1662 | dentry, dentry->d_time, jiffies); |
1662 | 1663 | ||
1663 | if (CIFS_SB(sb)->tcon->unix_ext) | 1664 | if (cifs_sb_tcon(CIFS_SB(sb))->unix_ext) |
1664 | rc = cifs_get_inode_info_unix(&inode, full_path, sb, xid); | 1665 | rc = cifs_get_inode_info_unix(&inode, full_path, sb, xid); |
1665 | else | 1666 | else |
1666 | rc = cifs_get_inode_info(&inode, full_path, NULL, sb, | 1667 | rc = cifs_get_inode_info(&inode, full_path, NULL, sb, |
@@ -1755,7 +1756,7 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs, | |||
1755 | 1756 | ||
1756 | if (rc != 0) { | 1757 | if (rc != 0) { |
1757 | if (pTcon == NULL) | 1758 | if (pTcon == NULL) |
1758 | pTcon = cifs_sb->tcon; | 1759 | pTcon = cifs_sb_tcon(cifs_sb); |
1759 | 1760 | ||
1760 | /* Set file size by pathname rather than by handle | 1761 | /* Set file size by pathname rather than by handle |
1761 | either because no valid, writeable file handle for | 1762 | either because no valid, writeable file handle for |
@@ -1901,7 +1902,7 @@ cifs_setattr_unix(struct dentry *direntry, struct iattr *attrs) | |||
1901 | rc = CIFSSMBUnixSetFileInfo(xid, pTcon, args, nfid, npid); | 1902 | rc = CIFSSMBUnixSetFileInfo(xid, pTcon, args, nfid, npid); |
1902 | cifsFileInfo_put(open_file); | 1903 | cifsFileInfo_put(open_file); |
1903 | } else { | 1904 | } else { |
1904 | pTcon = cifs_sb->tcon; | 1905 | pTcon = cifs_sb_tcon(cifs_sb); |
1905 | rc = CIFSSMBUnixSetPathInfo(xid, pTcon, full_path, args, | 1906 | rc = CIFSSMBUnixSetPathInfo(xid, pTcon, full_path, args, |
1906 | cifs_sb->local_nls, | 1907 | cifs_sb->local_nls, |
1907 | cifs_sb->mnt_cifs_flags & | 1908 | cifs_sb->mnt_cifs_flags & |
@@ -2086,7 +2087,7 @@ cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
2086 | { | 2087 | { |
2087 | struct inode *inode = direntry->d_inode; | 2088 | struct inode *inode = direntry->d_inode; |
2088 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); | 2089 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); |
2089 | struct cifsTconInfo *pTcon = cifs_sb->tcon; | 2090 | struct cifsTconInfo *pTcon = cifs_sb_tcon(cifs_sb); |
2090 | 2091 | ||
2091 | if (pTcon->unix_ext) | 2092 | if (pTcon->unix_ext) |
2092 | return cifs_setattr_unix(direntry, attrs); | 2093 | return cifs_setattr_unix(direntry, attrs); |