aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mount.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/mount.h')
-rw-r--r--include/linux/mount.h40
1 files changed, 18 insertions, 22 deletions
diff --git a/include/linux/mount.h b/include/linux/mount.h
index 5d5275364867..849e70535047 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -31,11 +31,13 @@ struct mnt_namespace;
31 31
32#define MNT_SHRINKABLE 0x100 32#define MNT_SHRINKABLE 0x100
33#define MNT_WRITE_HOLD 0x200 33#define MNT_WRITE_HOLD 0x200
34#define MNT_MOUNTED 0x400
34 35
35#define MNT_SHARED 0x1000 /* if the vfsmount is a shared mount */ 36#define MNT_SHARED 0x1000 /* if the vfsmount is a shared mount */
36#define MNT_UNBINDABLE 0x2000 /* if the vfsmount is a unbindable mount */ 37#define MNT_UNBINDABLE 0x2000 /* if the vfsmount is a unbindable mount */
37#define MNT_PNODE_MASK 0x3000 /* propagation flag mask */ 38#define MNT_PNODE_MASK 0x3000 /* propagation flag mask */
38 39
40
39struct vfsmount { 41struct vfsmount {
40 struct list_head mnt_hash; 42 struct list_head mnt_hash;
41 struct vfsmount *mnt_parent; /* fs we are mounted on */ 43 struct vfsmount *mnt_parent; /* fs we are mounted on */
@@ -56,12 +58,6 @@ struct vfsmount {
56 struct mnt_namespace *mnt_ns; /* containing namespace */ 58 struct mnt_namespace *mnt_ns; /* containing namespace */
57 int mnt_id; /* mount identifier */ 59 int mnt_id; /* mount identifier */
58 int mnt_group_id; /* peer group identifier */ 60 int mnt_group_id; /* peer group identifier */
59 /*
60 * We put mnt_count & mnt_expiry_mark at the end of struct vfsmount
61 * to let these frequently modified fields in a separate cache line
62 * (so that reads of mnt_flags wont ping-pong on SMP machines)
63 */
64 atomic_t mnt_count;
65 int mnt_expiry_mark; /* true if marked for expiry */ 61 int mnt_expiry_mark; /* true if marked for expiry */
66 int mnt_pinned; 62 int mnt_pinned;
67 int mnt_ghosts; 63 int mnt_ghosts;
@@ -70,6 +66,11 @@ struct vfsmount {
70#else 66#else
71 int mnt_writers; 67 int mnt_writers;
72#endif 68#endif
69#ifdef CONFIG_SMP
70 int *mnt_count;
71#else
72 int mnt_count;
73#endif
73}; 74};
74 75
75static inline int *get_mnt_writers_ptr(struct vfsmount *mnt) 76static inline int *get_mnt_writers_ptr(struct vfsmount *mnt)
@@ -81,32 +82,28 @@ static inline int *get_mnt_writers_ptr(struct vfsmount *mnt)
81#endif 82#endif
82} 83}
83 84
84static inline struct vfsmount *mntget(struct vfsmount *mnt)
85{
86 if (mnt)
87 atomic_inc(&mnt->mnt_count);
88 return mnt;
89}
90
91struct file; /* forward dec */ 85struct file; /* forward dec */
92 86
87extern void vfsmount_read_lock(int cpu);
88extern void vfsmount_read_unlock(int cpu);
89extern void vfsmount_write_lock(void);
90extern void vfsmount_write_unlock(void);
91
92extern unsigned int count_mnt_count(struct vfsmount *mnt);
93
93extern int mnt_want_write(struct vfsmount *mnt); 94extern int mnt_want_write(struct vfsmount *mnt);
94extern int mnt_want_write_file(struct file *file); 95extern int mnt_want_write_file(struct file *file);
95extern int mnt_clone_write(struct vfsmount *mnt); 96extern int mnt_clone_write(struct vfsmount *mnt);
96extern void mnt_drop_write(struct vfsmount *mnt); 97extern void mnt_drop_write(struct vfsmount *mnt);
98
97extern void mntput_no_expire(struct vfsmount *mnt); 99extern void mntput_no_expire(struct vfsmount *mnt);
100extern struct vfsmount *mntget(struct vfsmount *mnt);
101extern void mntput(struct vfsmount *mnt);
102
98extern void mnt_pin(struct vfsmount *mnt); 103extern void mnt_pin(struct vfsmount *mnt);
99extern void mnt_unpin(struct vfsmount *mnt); 104extern void mnt_unpin(struct vfsmount *mnt);
100extern int __mnt_is_readonly(struct vfsmount *mnt); 105extern int __mnt_is_readonly(struct vfsmount *mnt);
101 106
102static inline void mntput(struct vfsmount *mnt)
103{
104 if (mnt) {
105 mnt->mnt_expiry_mark = 0;
106 mntput_no_expire(mnt);
107 }
108}
109
110extern struct vfsmount *do_kern_mount(const char *fstype, int flags, 107extern struct vfsmount *do_kern_mount(const char *fstype, int flags,
111 const char *name, void *data); 108 const char *name, void *data);
112 109
@@ -123,7 +120,6 @@ extern int do_add_mount(struct vfsmount *newmnt, struct path *path,
123 120
124extern void mark_mounts_for_expiry(struct list_head *mounts); 121extern void mark_mounts_for_expiry(struct list_head *mounts);
125 122
126extern spinlock_t vfsmount_lock;
127extern dev_t name_to_dev_t(char *name); 123extern dev_t name_to_dev_t(char *name);
128 124
129#endif /* _LINUX_MOUNT_H */ 125#endif /* _LINUX_MOUNT_H */