aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2010-09-20 19:01:33 -0400
committerSteve French <sfrench@us.ibm.com>2010-09-29 15:04:32 -0400
commita6e8a8455c94565c53e1a1756d2ab9d9e3a902b8 (patch)
tree544628293da6aa14a136c915d887d0abdc689a03
parentba00ba64cf0895e4c2ac507e56306363dc125a90 (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>
-rw-r--r--fs/cifs/cifs_dfs_ref.c2
-rw-r--r--fs/cifs/cifsacl.c16
-rw-r--r--fs/cifs/cifsfs.c11
-rw-r--r--fs/cifs/cifsglob.h6
-rw-r--r--fs/cifs/connect.c4
-rw-r--r--fs/cifs/dir.c20
-rw-r--r--fs/cifs/file.c4
-rw-r--r--fs/cifs/fscache.c7
-rw-r--r--fs/cifs/inode.c49
-rw-r--r--fs/cifs/link.c8
-rw-r--r--fs/cifs/misc.c2
-rw-r--r--fs/cifs/readdir.c8
-rw-r--r--fs/cifs/xattr.c8
13 files changed, 74 insertions, 71 deletions
diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c
index d6ced7aa23cf..f1e13ea45a17 100644
--- a/fs/cifs/cifs_dfs_ref.c
+++ b/fs/cifs/cifs_dfs_ref.c
@@ -316,7 +316,7 @@ cifs_dfs_follow_mountpoint(struct dentry *dentry, struct nameidata *nd)
316 nd->path.dentry = dget(dentry); 316 nd->path.dentry = dget(dentry);
317 317
318 cifs_sb = CIFS_SB(dentry->d_inode->i_sb); 318 cifs_sb = CIFS_SB(dentry->d_inode->i_sb);
319 ses = cifs_sb->tcon->ses; 319 ses = cifs_sb_tcon(cifs_sb)->ses;
320 320
321 if (!ses) { 321 if (!ses) {
322 rc = -EINVAL; 322 rc = -EINVAL;
diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c
index 85d7cf7ff2c8..32f244909a0d 100644
--- a/fs/cifs/cifsacl.c
+++ b/fs/cifs/cifsacl.c
@@ -559,7 +559,7 @@ static struct cifs_ntsd *get_cifs_acl_by_fid(struct cifs_sb_info *cifs_sb,
559 int xid, rc; 559 int xid, rc;
560 560
561 xid = GetXid(); 561 xid = GetXid();
562 rc = CIFSSMBGetCIFSACL(xid, cifs_sb->tcon, fid, &pntsd, pacllen); 562 rc = CIFSSMBGetCIFSACL(xid, cifs_sb_tcon(cifs_sb), fid, &pntsd, pacllen);
563 FreeXid(xid); 563 FreeXid(xid);
564 564
565 565
@@ -577,7 +577,7 @@ static struct cifs_ntsd *get_cifs_acl_by_path(struct cifs_sb_info *cifs_sb,
577 577
578 xid = GetXid(); 578 xid = GetXid();
579 579
580 rc = CIFSSMBOpen(xid, cifs_sb->tcon, path, FILE_OPEN, READ_CONTROL, 0, 580 rc = CIFSSMBOpen(xid, cifs_sb_tcon(cifs_sb), path, FILE_OPEN, READ_CONTROL, 0,
581 &fid, &oplock, NULL, cifs_sb->local_nls, 581 &fid, &oplock, NULL, cifs_sb->local_nls,
582 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); 582 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
583 if (rc) { 583 if (rc) {
@@ -585,10 +585,10 @@ static struct cifs_ntsd *get_cifs_acl_by_path(struct cifs_sb_info *cifs_sb,
585 goto out; 585 goto out;
586 } 586 }
587 587
588 rc = CIFSSMBGetCIFSACL(xid, cifs_sb->tcon, fid, &pntsd, pacllen); 588 rc = CIFSSMBGetCIFSACL(xid, cifs_sb_tcon(cifs_sb), fid, &pntsd, pacllen);
589 cFYI(1, "GetCIFSACL rc = %d ACL len %d", rc, *pacllen); 589 cFYI(1, "GetCIFSACL rc = %d ACL len %d", rc, *pacllen);
590 590
591 CIFSSMBClose(xid, cifs_sb->tcon, fid); 591 CIFSSMBClose(xid, cifs_sb_tcon(cifs_sb), fid);
592 out: 592 out:
593 FreeXid(xid); 593 FreeXid(xid);
594 return pntsd; 594 return pntsd;
@@ -618,7 +618,7 @@ static int set_cifs_acl_by_fid(struct cifs_sb_info *cifs_sb, __u16 fid,
618 int xid, rc; 618 int xid, rc;
619 619
620 xid = GetXid(); 620 xid = GetXid();
621 rc = CIFSSMBSetCIFSACL(xid, cifs_sb->tcon, fid, pnntsd, acllen); 621 rc = CIFSSMBSetCIFSACL(xid, cifs_sb_tcon(cifs_sb), fid, pnntsd, acllen);
622 FreeXid(xid); 622 FreeXid(xid);
623 623
624 cFYI(DBG2, "SetCIFSACL rc = %d", rc); 624 cFYI(DBG2, "SetCIFSACL rc = %d", rc);
@@ -634,7 +634,7 @@ static int set_cifs_acl_by_path(struct cifs_sb_info *cifs_sb, const char *path,
634 634
635 xid = GetXid(); 635 xid = GetXid();
636 636
637 rc = CIFSSMBOpen(xid, cifs_sb->tcon, path, FILE_OPEN, WRITE_DAC, 0, 637 rc = CIFSSMBOpen(xid, cifs_sb_tcon(cifs_sb), path, FILE_OPEN, WRITE_DAC, 0,
638 &fid, &oplock, NULL, cifs_sb->local_nls, 638 &fid, &oplock, NULL, cifs_sb->local_nls,
639 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); 639 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
640 if (rc) { 640 if (rc) {
@@ -642,10 +642,10 @@ static int set_cifs_acl_by_path(struct cifs_sb_info *cifs_sb, const char *path,
642 goto out; 642 goto out;
643 } 643 }
644 644
645 rc = CIFSSMBSetCIFSACL(xid, cifs_sb->tcon, fid, pnntsd, acllen); 645 rc = CIFSSMBSetCIFSACL(xid, cifs_sb_tcon(cifs_sb), fid, pnntsd, acllen);
646 cFYI(DBG2, "SetCIFSACL rc = %d", rc); 646 cFYI(DBG2, "SetCIFSACL rc = %d", rc);
647 647
648 CIFSSMBClose(xid, cifs_sb->tcon, fid); 648 CIFSSMBClose(xid, cifs_sb_tcon(cifs_sb), fid);
649 out: 649 out:
650 FreeXid(xid); 650 FreeXid(xid);
651 return rc; 651 return rc;
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 7193494efc03..b9624abb7261 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -137,9 +137,6 @@ cifs_read_super(struct super_block *sb, void *data,
137 sb->s_magic = CIFS_MAGIC_NUMBER; 137 sb->s_magic = CIFS_MAGIC_NUMBER;
138 sb->s_op = &cifs_super_ops; 138 sb->s_op = &cifs_super_ops;
139 sb->s_bdi = &cifs_sb->bdi; 139 sb->s_bdi = &cifs_sb->bdi;
140/* if (cifs_sb->tcon->ses->server->maxBuf > MAX_CIFS_HDR_SIZE + 512)
141 sb->s_blocksize =
142 cifs_sb->tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE; */
143 sb->s_blocksize = CIFS_MAX_MSGSIZE; 140 sb->s_blocksize = CIFS_MAX_MSGSIZE;
144 sb->s_blocksize_bits = 14; /* default 2**14 = CIFS_MAX_MSGSIZE */ 141 sb->s_blocksize_bits = 14; /* default 2**14 = CIFS_MAX_MSGSIZE */
145 inode = cifs_root_iget(sb, ROOT_I); 142 inode = cifs_root_iget(sb, ROOT_I);
@@ -225,7 +222,7 @@ cifs_statfs(struct dentry *dentry, struct kstatfs *buf)
225{ 222{
226 struct super_block *sb = dentry->d_sb; 223 struct super_block *sb = dentry->d_sb;
227 struct cifs_sb_info *cifs_sb = CIFS_SB(sb); 224 struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
228 struct cifsTconInfo *tcon = cifs_sb->tcon; 225 struct cifsTconInfo *tcon = cifs_sb_tcon(cifs_sb);
229 int rc = -EOPNOTSUPP; 226 int rc = -EOPNOTSUPP;
230 int xid; 227 int xid;
231 228
@@ -367,7 +364,7 @@ static int
367cifs_show_options(struct seq_file *s, struct vfsmount *m) 364cifs_show_options(struct seq_file *s, struct vfsmount *m)
368{ 365{
369 struct cifs_sb_info *cifs_sb = CIFS_SB(m->mnt_sb); 366 struct cifs_sb_info *cifs_sb = CIFS_SB(m->mnt_sb);
370 struct cifsTconInfo *tcon = cifs_sb->tcon; 367 struct cifsTconInfo *tcon = cifs_sb_tcon(cifs_sb);
371 struct sockaddr *srcaddr; 368 struct sockaddr *srcaddr;
372 srcaddr = (struct sockaddr *)&tcon->ses->server->srcaddr; 369 srcaddr = (struct sockaddr *)&tcon->ses->server->srcaddr;
373 370
@@ -458,9 +455,7 @@ static void cifs_umount_begin(struct super_block *sb)
458 if (cifs_sb == NULL) 455 if (cifs_sb == NULL)
459 return; 456 return;
460 457
461 tcon = cifs_sb->tcon; 458 tcon = cifs_sb_tcon(cifs_sb);
462 if (tcon == NULL)
463 return;
464 459
465 read_lock(&cifs_tcp_ses_lock); 460 read_lock(&cifs_tcp_ses_lock);
466 if ((tcon->tc_count > 1) || (tcon->tidStatus == CifsExiting)) { 461 if ((tcon->tc_count > 1) || (tcon->tidStatus == CifsExiting)) {
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 6f3968a5fea4..c3510168438e 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -413,6 +413,12 @@ CIFS_SB(struct super_block *sb)
413 return sb->s_fs_info; 413 return sb->s_fs_info;
414} 414}
415 415
416static inline struct cifsTconInfo *
417cifs_sb_tcon(struct cifs_sb_info *cifs_sb)
418{
419 return cifs_sb->tcon;
420}
421
416static inline char CIFS_DIR_SEP(const struct cifs_sb_info *cifs_sb) 422static inline char CIFS_DIR_SEP(const struct cifs_sb_info *cifs_sb)
417{ 423{
418 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS) 424 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS)
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 230410e0a453..c42d37fb5b7c 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -3026,8 +3026,8 @@ cifs_umount(struct super_block *sb, struct cifs_sb_info *cifs_sb)
3026 int rc = 0; 3026 int rc = 0;
3027 char *tmp; 3027 char *tmp;
3028 3028
3029 if (cifs_sb->tcon) 3029 if (cifs_sb_tcon(cifs_sb))
3030 cifs_put_tcon(cifs_sb->tcon); 3030 cifs_put_tcon(cifs_sb_tcon(cifs_sb));
3031 3031
3032 cifs_sb->tcon = NULL; 3032 cifs_sb->tcon = NULL;
3033 tmp = cifs_sb->prepath; 3033 tmp = cifs_sb->prepath;
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index 613589cf5172..f660a15eb14f 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -64,8 +64,8 @@ build_path_from_dentry(struct dentry *direntry)
64 cifs_sb = CIFS_SB(direntry->d_sb); 64 cifs_sb = CIFS_SB(direntry->d_sb);
65 dirsep = CIFS_DIR_SEP(cifs_sb); 65 dirsep = CIFS_DIR_SEP(cifs_sb);
66 pplen = cifs_sb->prepathlen; 66 pplen = cifs_sb->prepathlen;
67 if (cifs_sb->tcon && (cifs_sb->tcon->Flags & SMB_SHARE_IS_IN_DFS)) 67 if (cifs_sb_tcon(cifs_sb) && (cifs_sb_tcon(cifs_sb)->Flags & SMB_SHARE_IS_IN_DFS))
68 dfsplen = strnlen(cifs_sb->tcon->treeName, MAX_TREE_SIZE + 1); 68 dfsplen = strnlen(cifs_sb_tcon(cifs_sb)->treeName, MAX_TREE_SIZE + 1);
69 else 69 else
70 dfsplen = 0; 70 dfsplen = 0;
71cifs_bp_rename_retry: 71cifs_bp_rename_retry:
@@ -117,7 +117,7 @@ cifs_bp_rename_retry:
117 /* BB test paths to Windows with '/' in the midst of prepath */ 117 /* BB test paths to Windows with '/' in the midst of prepath */
118 118
119 if (dfsplen) { 119 if (dfsplen) {
120 strncpy(full_path, cifs_sb->tcon->treeName, dfsplen); 120 strncpy(full_path, cifs_sb_tcon(cifs_sb)->treeName, dfsplen);
121 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS) { 121 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS) {
122 int i; 122 int i;
123 for (i = 0; i < dfsplen; i++) { 123 for (i = 0; i < dfsplen; i++) {
@@ -150,7 +150,7 @@ cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle,
150 pCifsFile->pfile = file; 150 pCifsFile->pfile = file;
151 pCifsFile->invalidHandle = false; 151 pCifsFile->invalidHandle = false;
152 pCifsFile->closePend = false; 152 pCifsFile->closePend = false;
153 pCifsFile->tcon = cifs_sb->tcon; 153 pCifsFile->tcon = cifs_sb_tcon(cifs_sb);
154 mutex_init(&pCifsFile->fh_mutex); 154 mutex_init(&pCifsFile->fh_mutex);
155 mutex_init(&pCifsFile->lock_mutex); 155 mutex_init(&pCifsFile->lock_mutex);
156 INIT_LIST_HEAD(&pCifsFile->llist); 156 INIT_LIST_HEAD(&pCifsFile->llist);
@@ -158,7 +158,7 @@ cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle,
158 INIT_WORK(&pCifsFile->oplock_break, cifs_oplock_break); 158 INIT_WORK(&pCifsFile->oplock_break, cifs_oplock_break);
159 159
160 write_lock(&GlobalSMBSeslock); 160 write_lock(&GlobalSMBSeslock);
161 list_add(&pCifsFile->tlist, &cifs_sb->tcon->openFileList); 161 list_add(&pCifsFile->tlist, &cifs_sb_tcon(cifs_sb)->openFileList);
162 pCifsInode = CIFS_I(newinode); 162 pCifsInode = CIFS_I(newinode);
163 if (pCifsInode) { 163 if (pCifsInode) {
164 /* if readable file instance put first in list*/ 164 /* if readable file instance put first in list*/
@@ -225,7 +225,7 @@ int cifs_posix_open(char *full_path, struct inode **pinode,
225 posix_flags |= SMB_O_DIRECT; 225 posix_flags |= SMB_O_DIRECT;
226 226
227 mode &= ~current_umask(); 227 mode &= ~current_umask();
228 rc = CIFSPOSIXCreate(xid, cifs_sb->tcon, posix_flags, mode, 228 rc = CIFSPOSIXCreate(xid, cifs_sb_tcon(cifs_sb), posix_flags, mode,
229 pnetfid, presp_data, poplock, full_path, 229 pnetfid, presp_data, poplock, full_path,
230 cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & 230 cifs_sb->local_nls, cifs_sb->mnt_cifs_flags &
231 CIFS_MOUNT_MAP_SPECIAL_CHR); 231 CIFS_MOUNT_MAP_SPECIAL_CHR);
@@ -298,7 +298,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
298 xid = GetXid(); 298 xid = GetXid();
299 299
300 cifs_sb = CIFS_SB(inode->i_sb); 300 cifs_sb = CIFS_SB(inode->i_sb);
301 tcon = cifs_sb->tcon; 301 tcon = cifs_sb_tcon(cifs_sb);
302 302
303 full_path = build_path_from_dentry(direntry); 303 full_path = build_path_from_dentry(direntry);
304 if (full_path == NULL) { 304 if (full_path == NULL) {
@@ -373,7 +373,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
373 if (!tcon->unix_ext && (mode & S_IWUGO) == 0) 373 if (!tcon->unix_ext && (mode & S_IWUGO) == 0)
374 create_options |= CREATE_OPTION_READONLY; 374 create_options |= CREATE_OPTION_READONLY;
375 375
376 if (cifs_sb->tcon->ses->capabilities & CAP_NT_SMBS) 376 if (tcon->ses->capabilities & CAP_NT_SMBS)
377 rc = CIFSSMBOpen(xid, tcon, full_path, disposition, 377 rc = CIFSSMBOpen(xid, tcon, full_path, disposition,
378 desiredAccess, create_options, 378 desiredAccess, create_options,
379 &fileHandle, &oplock, buf, cifs_sb->local_nls, 379 &fileHandle, &oplock, buf, cifs_sb->local_nls,
@@ -504,7 +504,7 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode,
504 xid = GetXid(); 504 xid = GetXid();
505 505
506 cifs_sb = CIFS_SB(inode->i_sb); 506 cifs_sb = CIFS_SB(inode->i_sb);
507 pTcon = cifs_sb->tcon; 507 pTcon = cifs_sb_tcon(cifs_sb);
508 508
509 full_path = build_path_from_dentry(direntry); 509 full_path = build_path_from_dentry(direntry);
510 if (full_path == NULL) { 510 if (full_path == NULL) {
@@ -631,7 +631,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
631 /* check whether path exists */ 631 /* check whether path exists */
632 632
633 cifs_sb = CIFS_SB(parent_dir_inode->i_sb); 633 cifs_sb = CIFS_SB(parent_dir_inode->i_sb);
634 pTcon = cifs_sb->tcon; 634 pTcon = cifs_sb_tcon(cifs_sb);
635 635
636 /* 636 /*
637 * Don't allow the separator character in a path component. 637 * Don't allow the separator character in a path component.
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 84979fc77862..6712c2b0a0ae 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -235,7 +235,7 @@ int cifs_open(struct inode *inode, struct file *file)
235 xid = GetXid(); 235 xid = GetXid();
236 236
237 cifs_sb = CIFS_SB(inode->i_sb); 237 cifs_sb = CIFS_SB(inode->i_sb);
238 tcon = cifs_sb->tcon; 238 tcon = cifs_sb_tcon(cifs_sb);
239 239
240 pCifsInode = CIFS_I(file->f_path.dentry->d_inode); 240 pCifsInode = CIFS_I(file->f_path.dentry->d_inode);
241 241
@@ -345,7 +345,7 @@ int cifs_open(struct inode *inode, struct file *file)
345 goto out; 345 goto out;
346 } 346 }
347 347
348 if (cifs_sb->tcon->ses->capabilities & CAP_NT_SMBS) 348 if (tcon->ses->capabilities & CAP_NT_SMBS)
349 rc = CIFSSMBOpen(xid, tcon, full_path, disposition, 349 rc = CIFSSMBOpen(xid, tcon, full_path, disposition,
350 desiredAccess, CREATE_NOT_DIR, &netfid, &oplock, buf, 350 desiredAccess, CREATE_NOT_DIR, &netfid, &oplock, buf,
351 cifs_sb->local_nls, cifs_sb->mnt_cifs_flags 351 cifs_sb->local_nls, cifs_sb->mnt_cifs_flags
diff --git a/fs/cifs/fscache.c b/fs/cifs/fscache.c
index 9f3f5c4be161..ec4318b019cc 100644
--- a/fs/cifs/fscache.c
+++ b/fs/cifs/fscache.c
@@ -66,11 +66,11 @@ static void cifs_fscache_enable_inode_cookie(struct inode *inode)
66 if (cifsi->fscache) 66 if (cifsi->fscache)
67 return; 67 return;
68 68
69 cifsi->fscache = fscache_acquire_cookie(cifs_sb->tcon->fscache, 69 cifsi->fscache = fscache_acquire_cookie(cifs_sb_tcon(cifs_sb)->fscache,
70 &cifs_fscache_inode_object_def, 70 &cifs_fscache_inode_object_def,
71 cifsi); 71 cifsi);
72 cFYI(1, "CIFS: got FH cookie (0x%p/0x%p)", 72 cFYI(1, "CIFS: got FH cookie (0x%p/0x%p)",
73 cifs_sb->tcon->fscache, cifsi->fscache); 73 cifs_sb_tcon(cifs_sb)->fscache, cifsi->fscache);
74} 74}
75 75
76void cifs_fscache_release_inode_cookie(struct inode *inode) 76void cifs_fscache_release_inode_cookie(struct inode *inode)
@@ -117,7 +117,8 @@ void cifs_fscache_reset_inode_cookie(struct inode *inode)
117 /* retire the current fscache cache and get a new one */ 117 /* retire the current fscache cache and get a new one */
118 fscache_relinquish_cookie(cifsi->fscache, 1); 118 fscache_relinquish_cookie(cifsi->fscache, 1);
119 119
120 cifsi->fscache = fscache_acquire_cookie(cifs_sb->tcon->fscache, 120 cifsi->fscache = fscache_acquire_cookie(
121 cifs_sb_tcon(cifs_sb)->fscache,
121 &cifs_fscache_inode_object_def, 122 &cifs_fscache_inode_object_def,
122 cifsi); 123 cifsi);
123 cFYI(1, "CIFS: new cookie 0x%p oldcookie 0x%p", 124 cFYI(1, "CIFS: new cookie 0x%p oldcookie 0x%p",
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);
diff --git a/fs/cifs/link.c b/fs/cifs/link.c
index cbf7b112287b..66db2d61fa43 100644
--- a/fs/cifs/link.c
+++ b/fs/cifs/link.c
@@ -249,7 +249,7 @@ CIFSCheckMFSymlink(struct cifs_fattr *fattr,
249 int rc; 249 int rc;
250 int oplock = 0; 250 int oplock = 0;
251 __u16 netfid = 0; 251 __u16 netfid = 0;
252 struct cifsTconInfo *pTcon = cifs_sb->tcon; 252 struct cifsTconInfo *pTcon = cifs_sb_tcon(cifs_sb);
253 u8 *buf; 253 u8 *buf;
254 char *pbuf; 254 char *pbuf;
255 unsigned int bytes_read = 0; 255 unsigned int bytes_read = 0;
@@ -321,7 +321,7 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode,
321 xid = GetXid(); 321 xid = GetXid();
322 322
323 cifs_sb_target = CIFS_SB(inode->i_sb); 323 cifs_sb_target = CIFS_SB(inode->i_sb);
324 pTcon = cifs_sb_target->tcon; 324 pTcon = cifs_sb_tcon(cifs_sb_target);
325 325
326/* No need to check for cross device links since server will do that 326/* No need to check for cross device links since server will do that
327 BB note DFS case in future though (when we may have to check) */ 327 BB note DFS case in future though (when we may have to check) */
@@ -390,7 +390,7 @@ cifs_follow_link(struct dentry *direntry, struct nameidata *nd)
390 char *full_path = NULL; 390 char *full_path = NULL;
391 char *target_path = NULL; 391 char *target_path = NULL;
392 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); 392 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
393 struct cifsTconInfo *tcon = cifs_sb->tcon; 393 struct cifsTconInfo *tcon = cifs_sb_tcon(cifs_sb);
394 394
395 xid = GetXid(); 395 xid = GetXid();
396 396
@@ -459,7 +459,7 @@ cifs_symlink(struct inode *inode, struct dentry *direntry, const char *symname)
459 xid = GetXid(); 459 xid = GetXid();
460 460
461 cifs_sb = CIFS_SB(inode->i_sb); 461 cifs_sb = CIFS_SB(inode->i_sb);
462 pTcon = cifs_sb->tcon; 462 pTcon = cifs_sb_tcon(cifs_sb);
463 463
464 full_path = build_path_from_dentry(direntry); 464 full_path = build_path_from_dentry(direntry);
465 465
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c
index 3ccadc1326d6..c5cbfdb2a58b 100644
--- a/fs/cifs/misc.c
+++ b/fs/cifs/misc.c
@@ -729,6 +729,6 @@ cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb)
729 "properly. Hardlinks will not be recognized on this " 729 "properly. Hardlinks will not be recognized on this "
730 "mount. Consider mounting with the \"noserverino\" " 730 "mount. Consider mounting with the \"noserverino\" "
731 "option to silence this message.", 731 "option to silence this message.",
732 cifs_sb->tcon->treeName); 732 cifs_sb_tcon(cifs_sb)->treeName);
733 } 733 }
734} 734}
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index d7784a95134f..3efc2424964f 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -102,7 +102,7 @@ cifs_readdir_lookup(struct dentry *parent, struct qstr *name,
102 return NULL; 102 return NULL;
103 } 103 }
104 104
105 if (CIFS_SB(sb)->tcon->nocase) 105 if (cifs_sb_tcon(CIFS_SB(sb))->nocase)
106 dentry->d_op = &cifs_ci_dentry_ops; 106 dentry->d_op = &cifs_ci_dentry_ops;
107 else 107 else
108 dentry->d_op = &cifs_dentry_ops; 108 dentry->d_op = &cifs_dentry_ops;
@@ -171,7 +171,7 @@ static void
171cifs_std_info_to_fattr(struct cifs_fattr *fattr, FIND_FILE_STANDARD_INFO *info, 171cifs_std_info_to_fattr(struct cifs_fattr *fattr, FIND_FILE_STANDARD_INFO *info,
172 struct cifs_sb_info *cifs_sb) 172 struct cifs_sb_info *cifs_sb)
173{ 173{
174 int offset = cifs_sb->tcon->ses->server->timeAdj; 174 int offset = cifs_sb_tcon(cifs_sb)->ses->server->timeAdj;
175 175
176 memset(fattr, 0, sizeof(*fattr)); 176 memset(fattr, 0, sizeof(*fattr));
177 fattr->cf_atime = cnvrtDosUnixTm(info->LastAccessDate, 177 fattr->cf_atime = cnvrtDosUnixTm(info->LastAccessDate,
@@ -199,7 +199,7 @@ int get_symlink_reparse_path(char *full_path, struct cifs_sb_info *cifs_sb,
199 int len; 199 int len;
200 int oplock = 0; 200 int oplock = 0;
201 int rc; 201 int rc;
202 struct cifsTconInfo *ptcon = cifs_sb->tcon; 202 struct cifsTconInfo *ptcon = cifs_sb_tcon(cifs_sb);
203 char *tmpbuffer; 203 char *tmpbuffer;
204 204
205 rc = CIFSSMBOpen(xid, ptcon, full_path, FILE_OPEN, GENERIC_READ, 205 rc = CIFSSMBOpen(xid, ptcon, full_path, FILE_OPEN, GENERIC_READ,
@@ -241,7 +241,7 @@ static int initiate_cifs_search(const int xid, struct file *file)
241 cifsFile = file->private_data; 241 cifsFile = file->private_data;
242 cifsFile->invalidHandle = true; 242 cifsFile->invalidHandle = true;
243 cifsFile->srch_inf.endOfSearch = false; 243 cifsFile->srch_inf.endOfSearch = false;
244 cifsFile->tcon = cifs_sb->tcon; 244 cifsFile->tcon = cifs_sb_tcon(cifs_sb);
245 pTcon = cifsFile->tcon; 245 pTcon = cifsFile->tcon;
246 if (pTcon == NULL) 246 if (pTcon == NULL)
247 return -EINVAL; 247 return -EINVAL;
diff --git a/fs/cifs/xattr.c b/fs/cifs/xattr.c
index a1509207bfa6..41f95bf67977 100644
--- a/fs/cifs/xattr.c
+++ b/fs/cifs/xattr.c
@@ -61,7 +61,7 @@ int cifs_removexattr(struct dentry *direntry, const char *ea_name)
61 xid = GetXid(); 61 xid = GetXid();
62 62
63 cifs_sb = CIFS_SB(sb); 63 cifs_sb = CIFS_SB(sb);
64 pTcon = cifs_sb->tcon; 64 pTcon = cifs_sb_tcon(cifs_sb);
65 65
66 full_path = build_path_from_dentry(direntry); 66 full_path = build_path_from_dentry(direntry);
67 if (full_path == NULL) { 67 if (full_path == NULL) {
@@ -116,7 +116,7 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name,
116 xid = GetXid(); 116 xid = GetXid();
117 117
118 cifs_sb = CIFS_SB(sb); 118 cifs_sb = CIFS_SB(sb);
119 pTcon = cifs_sb->tcon; 119 pTcon = cifs_sb_tcon(cifs_sb);
120 120
121 full_path = build_path_from_dentry(direntry); 121 full_path = build_path_from_dentry(direntry);
122 if (full_path == NULL) { 122 if (full_path == NULL) {
@@ -224,7 +224,7 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name,
224 xid = GetXid(); 224 xid = GetXid();
225 225
226 cifs_sb = CIFS_SB(sb); 226 cifs_sb = CIFS_SB(sb);
227 pTcon = cifs_sb->tcon; 227 pTcon = cifs_sb_tcon(cifs_sb);
228 228
229 full_path = build_path_from_dentry(direntry); 229 full_path = build_path_from_dentry(direntry);
230 if (full_path == NULL) { 230 if (full_path == NULL) {
@@ -346,7 +346,7 @@ ssize_t cifs_listxattr(struct dentry *direntry, char *data, size_t buf_size)
346 return -EIO; 346 return -EIO;
347 347
348 cifs_sb = CIFS_SB(sb); 348 cifs_sb = CIFS_SB(sb);
349 pTcon = cifs_sb->tcon; 349 pTcon = cifs_sb_tcon(cifs_sb);
350 350
351 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR) 351 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR)
352 return -EOPNOTSUPP; 352 return -EOPNOTSUPP;