diff options
Diffstat (limited to 'fs/libfs.c')
-rw-r--r-- | fs/libfs.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/fs/libfs.c b/fs/libfs.c index 7d487047dbb8..d93842d3c0a0 100644 --- a/fs/libfs.c +++ b/fs/libfs.c | |||
@@ -190,6 +190,10 @@ const struct inode_operations simple_dir_inode_operations = { | |||
190 | .lookup = simple_lookup, | 190 | .lookup = simple_lookup, |
191 | }; | 191 | }; |
192 | 192 | ||
193 | static const struct super_operations simple_super_operations = { | ||
194 | .statfs = simple_statfs, | ||
195 | }; | ||
196 | |||
193 | /* | 197 | /* |
194 | * Common helper for pseudo-filesystems (sockfs, pipefs, bdev - stuff that | 198 | * Common helper for pseudo-filesystems (sockfs, pipefs, bdev - stuff that |
195 | * will never be mountable) | 199 | * will never be mountable) |
@@ -199,7 +203,6 @@ int get_sb_pseudo(struct file_system_type *fs_type, char *name, | |||
199 | struct vfsmount *mnt) | 203 | struct vfsmount *mnt) |
200 | { | 204 | { |
201 | struct super_block *s = sget(fs_type, NULL, set_anon_super, NULL); | 205 | struct super_block *s = sget(fs_type, NULL, set_anon_super, NULL); |
202 | static const struct super_operations default_ops = {.statfs = simple_statfs}; | ||
203 | struct dentry *dentry; | 206 | struct dentry *dentry; |
204 | struct inode *root; | 207 | struct inode *root; |
205 | struct qstr d_name = {.name = name, .len = strlen(name)}; | 208 | struct qstr d_name = {.name = name, .len = strlen(name)}; |
@@ -212,7 +215,7 @@ int get_sb_pseudo(struct file_system_type *fs_type, char *name, | |||
212 | s->s_blocksize = 1024; | 215 | s->s_blocksize = 1024; |
213 | s->s_blocksize_bits = 10; | 216 | s->s_blocksize_bits = 10; |
214 | s->s_magic = magic; | 217 | s->s_magic = magic; |
215 | s->s_op = ops ? ops : &default_ops; | 218 | s->s_op = ops ? ops : &simple_super_operations; |
216 | s->s_time_gran = 1; | 219 | s->s_time_gran = 1; |
217 | root = new_inode(s); | 220 | root = new_inode(s); |
218 | if (!root) | 221 | if (!root) |
@@ -335,17 +338,18 @@ int simple_prepare_write(struct file *file, struct page *page, | |||
335 | flush_dcache_page(page); | 338 | flush_dcache_page(page); |
336 | kunmap_atomic(kaddr, KM_USER0); | 339 | kunmap_atomic(kaddr, KM_USER0); |
337 | } | 340 | } |
338 | SetPageUptodate(page); | ||
339 | } | 341 | } |
340 | return 0; | 342 | return 0; |
341 | } | 343 | } |
342 | 344 | ||
343 | int simple_commit_write(struct file *file, struct page *page, | 345 | int simple_commit_write(struct file *file, struct page *page, |
344 | unsigned offset, unsigned to) | 346 | unsigned from, unsigned to) |
345 | { | 347 | { |
346 | struct inode *inode = page->mapping->host; | 348 | struct inode *inode = page->mapping->host; |
347 | loff_t pos = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to; | 349 | loff_t pos = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to; |
348 | 350 | ||
351 | if (!PageUptodate(page)) | ||
352 | SetPageUptodate(page); | ||
349 | /* | 353 | /* |
350 | * No need to use i_size_read() here, the i_size | 354 | * No need to use i_size_read() here, the i_size |
351 | * cannot change under us because we hold the i_mutex. | 355 | * cannot change under us because we hold the i_mutex. |
@@ -358,7 +362,6 @@ int simple_commit_write(struct file *file, struct page *page, | |||
358 | 362 | ||
359 | int simple_fill_super(struct super_block *s, int magic, struct tree_descr *files) | 363 | int simple_fill_super(struct super_block *s, int magic, struct tree_descr *files) |
360 | { | 364 | { |
361 | static struct super_operations s_ops = {.statfs = simple_statfs}; | ||
362 | struct inode *inode; | 365 | struct inode *inode; |
363 | struct dentry *root; | 366 | struct dentry *root; |
364 | struct dentry *dentry; | 367 | struct dentry *dentry; |
@@ -367,7 +370,7 @@ int simple_fill_super(struct super_block *s, int magic, struct tree_descr *files | |||
367 | s->s_blocksize = PAGE_CACHE_SIZE; | 370 | s->s_blocksize = PAGE_CACHE_SIZE; |
368 | s->s_blocksize_bits = PAGE_CACHE_SHIFT; | 371 | s->s_blocksize_bits = PAGE_CACHE_SHIFT; |
369 | s->s_magic = magic; | 372 | s->s_magic = magic; |
370 | s->s_op = &s_ops; | 373 | s->s_op = &simple_super_operations; |
371 | s->s_time_gran = 1; | 374 | s->s_time_gran = 1; |
372 | 375 | ||
373 | inode = new_inode(s); | 376 | inode = new_inode(s); |