diff options
Diffstat (limited to 'include/linux/mount.h')
| -rw-r--r-- | include/linux/mount.h | 40 |
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 | |||
| 39 | struct vfsmount { | 41 | struct 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 | ||
| 75 | static inline int *get_mnt_writers_ptr(struct vfsmount *mnt) | 76 | static 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 | ||
| 84 | static inline struct vfsmount *mntget(struct vfsmount *mnt) | ||
| 85 | { | ||
| 86 | if (mnt) | ||
| 87 | atomic_inc(&mnt->mnt_count); | ||
| 88 | return mnt; | ||
| 89 | } | ||
| 90 | |||
| 91 | struct file; /* forward dec */ | 85 | struct file; /* forward dec */ |
| 92 | 86 | ||
| 87 | extern void vfsmount_read_lock(int cpu); | ||
| 88 | extern void vfsmount_read_unlock(int cpu); | ||
| 89 | extern void vfsmount_write_lock(void); | ||
| 90 | extern void vfsmount_write_unlock(void); | ||
| 91 | |||
| 92 | extern unsigned int count_mnt_count(struct vfsmount *mnt); | ||
| 93 | |||
| 93 | extern int mnt_want_write(struct vfsmount *mnt); | 94 | extern int mnt_want_write(struct vfsmount *mnt); |
| 94 | extern int mnt_want_write_file(struct file *file); | 95 | extern int mnt_want_write_file(struct file *file); |
| 95 | extern int mnt_clone_write(struct vfsmount *mnt); | 96 | extern int mnt_clone_write(struct vfsmount *mnt); |
| 96 | extern void mnt_drop_write(struct vfsmount *mnt); | 97 | extern void mnt_drop_write(struct vfsmount *mnt); |
| 98 | |||
| 97 | extern void mntput_no_expire(struct vfsmount *mnt); | 99 | extern void mntput_no_expire(struct vfsmount *mnt); |
| 100 | extern struct vfsmount *mntget(struct vfsmount *mnt); | ||
| 101 | extern void mntput(struct vfsmount *mnt); | ||
| 102 | |||
| 98 | extern void mnt_pin(struct vfsmount *mnt); | 103 | extern void mnt_pin(struct vfsmount *mnt); |
| 99 | extern void mnt_unpin(struct vfsmount *mnt); | 104 | extern void mnt_unpin(struct vfsmount *mnt); |
| 100 | extern int __mnt_is_readonly(struct vfsmount *mnt); | 105 | extern int __mnt_is_readonly(struct vfsmount *mnt); |
| 101 | 106 | ||
| 102 | static inline void mntput(struct vfsmount *mnt) | ||
| 103 | { | ||
| 104 | if (mnt) { | ||
| 105 | mnt->mnt_expiry_mark = 0; | ||
| 106 | mntput_no_expire(mnt); | ||
| 107 | } | ||
| 108 | } | ||
| 109 | |||
| 110 | extern struct vfsmount *do_kern_mount(const char *fstype, int flags, | 107 | extern 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 | ||
| 124 | extern void mark_mounts_for_expiry(struct list_head *mounts); | 121 | extern void mark_mounts_for_expiry(struct list_head *mounts); |
| 125 | 122 | ||
| 126 | extern spinlock_t vfsmount_lock; | ||
| 127 | extern dev_t name_to_dev_t(char *name); | 123 | extern dev_t name_to_dev_t(char *name); |
| 128 | 124 | ||
| 129 | #endif /* _LINUX_MOUNT_H */ | 125 | #endif /* _LINUX_MOUNT_H */ |
