aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifsglob.h
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2010-09-29 19:51:11 -0400
committerSteve French <sfrench@us.ibm.com>2010-10-06 12:12:44 -0400
commit7ffec372458d163492e56e663a1b3a2d7be0a0a2 (patch)
treee404e3d1000ff41e9b27d0ecb4d6a47187e110d7 /fs/cifs/cifsglob.h
parentf3983c2133e9bea9c8b4f690737d15e3e9b02491 (diff)
cifs: add refcounted and timestamped container for holding tcons
Eventually, we'll need to track the use of tcons on a per-sb basis, so that we know when it's ok to tear them down. Begin this conversion by adding a new "tcon_link" struct and accessors that get it. For now, the core data structures are untouched -- cifs_sb still just points to a single tcon and the pointers are just cast to deal with the accessor functions. A later patch will flesh this out. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/cifsglob.h')
-rw-r--r--fs/cifs/cifsglob.h51
1 files changed, 38 insertions, 13 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index c265ebdcd177..cdfd2db4e70d 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -311,6 +311,44 @@ struct cifsTconInfo {
311}; 311};
312 312
313/* 313/*
314 * This is a refcounted and timestamped container for a tcon pointer. The
315 * container holds a tcon reference. It is considered safe to free one of
316 * these when the tl_count goes to 0. The tl_time is the time of the last
317 * "get" on the container.
318 */
319struct tcon_link {
320 spinlock_t tl_lock;
321 u32 tl_count;
322 u64 tl_time;
323 struct cifsTconInfo *tl_tcon;
324};
325
326static inline struct tcon_link *
327cifs_sb_tlink(struct cifs_sb_info *cifs_sb)
328{
329 return (struct tcon_link *)cifs_sb->ptcon;
330}
331
332static inline struct cifsTconInfo *
333tlink_tcon(struct tcon_link *tlink)
334{
335 return (struct cifsTconInfo *)tlink;
336}
337
338static inline void
339cifs_put_tlink(struct tcon_link *tlink)
340{
341 return;
342}
343
344/* This function is always expected to succeed */
345static inline struct cifsTconInfo *
346cifs_sb_master_tcon(struct cifs_sb_info *cifs_sb)
347{
348 return cifs_sb->ptcon;
349}
350
351/*
314 * This info hangs off the cifsFileInfo structure, pointed to by llist. 352 * This info hangs off the cifsFileInfo structure, pointed to by llist.
315 * This is used to track byte stream locks on the file 353 * This is used to track byte stream locks on the file
316 */ 354 */
@@ -413,19 +451,6 @@ CIFS_SB(struct super_block *sb)
413 return sb->s_fs_info; 451 return sb->s_fs_info;
414} 452}
415 453
416static inline struct cifsTconInfo *
417cifs_sb_tcon(struct cifs_sb_info *cifs_sb)
418{
419 return cifs_sb->ptcon;
420}
421
422/* This function is always expected to succeed */
423static inline struct cifsTconInfo *
424cifs_sb_master_tcon(struct cifs_sb_info *cifs_sb)
425{
426 return cifs_sb->ptcon;
427}
428
429static inline char CIFS_DIR_SEP(const struct cifs_sb_info *cifs_sb) 454static inline char CIFS_DIR_SEP(const struct cifs_sb_info *cifs_sb)
430{ 455{
431 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS) 456 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS)