aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nilfs2/the_nilfs.h
diff options
context:
space:
mode:
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2010-09-08 13:07:56 -0400
committerRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2010-10-22 20:24:36 -0400
commit348fe8da13621b3d14ab2d156e74551611997017 (patch)
tree82e60058d2af36e5f6e8bb7851b5b25ba3e72909 /fs/nilfs2/the_nilfs.h
parentf11459ad7dab9e9eb5a05b8bd3bec338ea8f485d (diff)
nilfs2: simplify life cycle management of nilfs object
This stops pre-allocating nilfs object in nilfs_get_sb routine, and stops managing its life cycle by reference counting. nilfs_find_or_create_nilfs() function, nilfs->ns_mount_mutex, nilfs_objects list, and the reference counter will be removed through the simplification. Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs/nilfs2/the_nilfs.h')
-rw-r--r--fs/nilfs2/the_nilfs.h16
1 files changed, 2 insertions, 14 deletions
diff --git a/fs/nilfs2/the_nilfs.h b/fs/nilfs2/the_nilfs.h
index 7b43693a69c5..1908dc7bbd8f 100644
--- a/fs/nilfs2/the_nilfs.h
+++ b/fs/nilfs2/the_nilfs.h
@@ -46,13 +46,10 @@ enum {
46/** 46/**
47 * struct the_nilfs - struct to supervise multiple nilfs mount points 47 * struct the_nilfs - struct to supervise multiple nilfs mount points
48 * @ns_flags: flags 48 * @ns_flags: flags
49 * @ns_count: reference count
50 * @ns_list: list head for nilfs_list
51 * @ns_bdev: block device 49 * @ns_bdev: block device
52 * @ns_bdi: backing dev info 50 * @ns_bdi: backing dev info
53 * @ns_writer: back pointer to writable nilfs_sb_info 51 * @ns_writer: back pointer to writable nilfs_sb_info
54 * @ns_sem: semaphore for shared states 52 * @ns_sem: semaphore for shared states
55 * @ns_mount_mutex: mutex protecting mount process of nilfs
56 * @ns_writer_sem: semaphore protecting ns_writer attach/detach 53 * @ns_writer_sem: semaphore protecting ns_writer attach/detach
57 * @ns_sbh: buffer heads of on-disk super blocks 54 * @ns_sbh: buffer heads of on-disk super blocks
58 * @ns_sbp: pointers to super block data 55 * @ns_sbp: pointers to super block data
@@ -94,14 +91,11 @@ enum {
94 */ 91 */
95struct the_nilfs { 92struct the_nilfs {
96 unsigned long ns_flags; 93 unsigned long ns_flags;
97 atomic_t ns_count;
98 struct list_head ns_list;
99 94
100 struct block_device *ns_bdev; 95 struct block_device *ns_bdev;
101 struct backing_dev_info *ns_bdi; 96 struct backing_dev_info *ns_bdi;
102 struct nilfs_sb_info *ns_writer; 97 struct nilfs_sb_info *ns_writer;
103 struct rw_semaphore ns_sem; 98 struct rw_semaphore ns_sem;
104 struct mutex ns_mount_mutex;
105 struct rw_semaphore ns_writer_sem; 99 struct rw_semaphore ns_writer_sem;
106 100
107 /* 101 /*
@@ -239,8 +233,8 @@ static inline int nilfs_sb_will_flip(struct the_nilfs *nilfs)
239} 233}
240 234
241void nilfs_set_last_segment(struct the_nilfs *, sector_t, u64, __u64); 235void nilfs_set_last_segment(struct the_nilfs *, sector_t, u64, __u64);
242struct the_nilfs *find_or_create_nilfs(struct block_device *); 236struct the_nilfs *alloc_nilfs(struct block_device *bdev);
243void put_nilfs(struct the_nilfs *); 237void destroy_nilfs(struct the_nilfs *nilfs);
244int init_nilfs(struct the_nilfs *, struct nilfs_sb_info *, char *); 238int init_nilfs(struct the_nilfs *, struct nilfs_sb_info *, char *);
245int load_nilfs(struct the_nilfs *, struct nilfs_sb_info *); 239int load_nilfs(struct the_nilfs *, struct nilfs_sb_info *);
246int nilfs_discard_segments(struct the_nilfs *, __u64 *, size_t); 240int nilfs_discard_segments(struct the_nilfs *, __u64 *, size_t);
@@ -256,12 +250,6 @@ void nilfs_fall_back_super_block(struct the_nilfs *);
256void nilfs_swap_super_block(struct the_nilfs *); 250void nilfs_swap_super_block(struct the_nilfs *);
257 251
258 252
259static inline void get_nilfs(struct the_nilfs *nilfs)
260{
261 /* Caller must have at least one reference of the_nilfs. */
262 atomic_inc(&nilfs->ns_count);
263}
264
265static inline void nilfs_get_root(struct nilfs_root *root) 253static inline void nilfs_get_root(struct nilfs_root *root)
266{ 254{
267 atomic_inc(&root->count); 255 atomic_inc(&root->count);