diff options
author | Jan Kara <jack@suse.cz> | 2017-04-12 06:24:31 -0400 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2017-04-20 14:09:55 -0400 |
commit | 71304feba33f4b007cdb5cbbbe24c0e8d87ff689 (patch) | |
tree | 843c9c5f5665287b9fec4d0d524db60fd2da5841 /fs | |
parent | 9594caf216dc0fe3e318b34af0127276db661241 (diff) |
9p: Convert to separately allocated bdi
Allocate struct backing_dev_info separately instead of embedding it
inside session. This unifies handling of bdi among users.
CC: Eric Van Hensbergen <ericvh@gmail.com>
CC: Ron Minnich <rminnich@sandia.gov>
CC: Latchesar Ionkov <lucho@ionkov.net>
CC: v9fs-developer@lists.sourceforge.net
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/9p/v9fs.c | 10 | ||||
-rw-r--r-- | fs/9p/v9fs.h | 1 | ||||
-rw-r--r-- | fs/9p/vfs_super.c | 15 |
3 files changed, 13 insertions, 13 deletions
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c index a89f3cfe3c7d..c202930086ed 100644 --- a/fs/9p/v9fs.c +++ b/fs/9p/v9fs.c | |||
@@ -333,10 +333,6 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses, | |||
333 | goto err_names; | 333 | goto err_names; |
334 | init_rwsem(&v9ses->rename_sem); | 334 | init_rwsem(&v9ses->rename_sem); |
335 | 335 | ||
336 | rc = bdi_setup_and_register(&v9ses->bdi, "9p"); | ||
337 | if (rc) | ||
338 | goto err_names; | ||
339 | |||
340 | v9ses->uid = INVALID_UID; | 336 | v9ses->uid = INVALID_UID; |
341 | v9ses->dfltuid = V9FS_DEFUID; | 337 | v9ses->dfltuid = V9FS_DEFUID; |
342 | v9ses->dfltgid = V9FS_DEFGID; | 338 | v9ses->dfltgid = V9FS_DEFGID; |
@@ -345,7 +341,7 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses, | |||
345 | if (IS_ERR(v9ses->clnt)) { | 341 | if (IS_ERR(v9ses->clnt)) { |
346 | rc = PTR_ERR(v9ses->clnt); | 342 | rc = PTR_ERR(v9ses->clnt); |
347 | p9_debug(P9_DEBUG_ERROR, "problem initializing 9p client\n"); | 343 | p9_debug(P9_DEBUG_ERROR, "problem initializing 9p client\n"); |
348 | goto err_bdi; | 344 | goto err_names; |
349 | } | 345 | } |
350 | 346 | ||
351 | v9ses->flags = V9FS_ACCESS_USER; | 347 | v9ses->flags = V9FS_ACCESS_USER; |
@@ -415,8 +411,6 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses, | |||
415 | 411 | ||
416 | err_clnt: | 412 | err_clnt: |
417 | p9_client_destroy(v9ses->clnt); | 413 | p9_client_destroy(v9ses->clnt); |
418 | err_bdi: | ||
419 | bdi_destroy(&v9ses->bdi); | ||
420 | err_names: | 414 | err_names: |
421 | kfree(v9ses->uname); | 415 | kfree(v9ses->uname); |
422 | kfree(v9ses->aname); | 416 | kfree(v9ses->aname); |
@@ -445,8 +439,6 @@ void v9fs_session_close(struct v9fs_session_info *v9ses) | |||
445 | kfree(v9ses->uname); | 439 | kfree(v9ses->uname); |
446 | kfree(v9ses->aname); | 440 | kfree(v9ses->aname); |
447 | 441 | ||
448 | bdi_destroy(&v9ses->bdi); | ||
449 | |||
450 | spin_lock(&v9fs_sessionlist_lock); | 442 | spin_lock(&v9fs_sessionlist_lock); |
451 | list_del(&v9ses->slist); | 443 | list_del(&v9ses->slist); |
452 | spin_unlock(&v9fs_sessionlist_lock); | 444 | spin_unlock(&v9fs_sessionlist_lock); |
diff --git a/fs/9p/v9fs.h b/fs/9p/v9fs.h index 443d12e02043..76eaf49abd3a 100644 --- a/fs/9p/v9fs.h +++ b/fs/9p/v9fs.h | |||
@@ -114,7 +114,6 @@ struct v9fs_session_info { | |||
114 | kuid_t uid; /* if ACCESS_SINGLE, the uid that has access */ | 114 | kuid_t uid; /* if ACCESS_SINGLE, the uid that has access */ |
115 | struct p9_client *clnt; /* 9p client */ | 115 | struct p9_client *clnt; /* 9p client */ |
116 | struct list_head slist; /* list of sessions registered with v9fs */ | 116 | struct list_head slist; /* list of sessions registered with v9fs */ |
117 | struct backing_dev_info bdi; | ||
118 | struct rw_semaphore rename_sem; | 117 | struct rw_semaphore rename_sem; |
119 | }; | 118 | }; |
120 | 119 | ||
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index de3ed8629196..a0965fb587a5 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c | |||
@@ -72,10 +72,12 @@ static int v9fs_set_super(struct super_block *s, void *data) | |||
72 | * | 72 | * |
73 | */ | 73 | */ |
74 | 74 | ||
75 | static void | 75 | static int |
76 | v9fs_fill_super(struct super_block *sb, struct v9fs_session_info *v9ses, | 76 | v9fs_fill_super(struct super_block *sb, struct v9fs_session_info *v9ses, |
77 | int flags, void *data) | 77 | int flags, void *data) |
78 | { | 78 | { |
79 | int ret; | ||
80 | |||
79 | sb->s_maxbytes = MAX_LFS_FILESIZE; | 81 | sb->s_maxbytes = MAX_LFS_FILESIZE; |
80 | sb->s_blocksize_bits = fls(v9ses->maxdata - 1); | 82 | sb->s_blocksize_bits = fls(v9ses->maxdata - 1); |
81 | sb->s_blocksize = 1 << sb->s_blocksize_bits; | 83 | sb->s_blocksize = 1 << sb->s_blocksize_bits; |
@@ -85,7 +87,11 @@ v9fs_fill_super(struct super_block *sb, struct v9fs_session_info *v9ses, | |||
85 | sb->s_xattr = v9fs_xattr_handlers; | 87 | sb->s_xattr = v9fs_xattr_handlers; |
86 | } else | 88 | } else |
87 | sb->s_op = &v9fs_super_ops; | 89 | sb->s_op = &v9fs_super_ops; |
88 | sb->s_bdi = &v9ses->bdi; | 90 | |
91 | ret = super_setup_bdi(sb); | ||
92 | if (ret) | ||
93 | return ret; | ||
94 | |||
89 | if (v9ses->cache) | 95 | if (v9ses->cache) |
90 | sb->s_bdi->ra_pages = (VM_MAX_READAHEAD * 1024)/PAGE_SIZE; | 96 | sb->s_bdi->ra_pages = (VM_MAX_READAHEAD * 1024)/PAGE_SIZE; |
91 | 97 | ||
@@ -99,6 +105,7 @@ v9fs_fill_super(struct super_block *sb, struct v9fs_session_info *v9ses, | |||
99 | #endif | 105 | #endif |
100 | 106 | ||
101 | save_mount_options(sb, data); | 107 | save_mount_options(sb, data); |
108 | return 0; | ||
102 | } | 109 | } |
103 | 110 | ||
104 | /** | 111 | /** |
@@ -138,7 +145,9 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags, | |||
138 | retval = PTR_ERR(sb); | 145 | retval = PTR_ERR(sb); |
139 | goto clunk_fid; | 146 | goto clunk_fid; |
140 | } | 147 | } |
141 | v9fs_fill_super(sb, v9ses, flags, data); | 148 | retval = v9fs_fill_super(sb, v9ses, flags, data); |
149 | if (retval) | ||
150 | goto release_sb; | ||
142 | 151 | ||
143 | if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) | 152 | if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) |
144 | sb->s_d_op = &v9fs_cached_dentry_operations; | 153 | sb->s_d_op = &v9fs_cached_dentry_operations; |