aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/minix/dir.c2
-rw-r--r--fs/minix/file.c20
-rw-r--r--fs/minix/inode.c33
-rw-r--r--fs/minix/minix.h2
4 files changed, 12 insertions, 45 deletions
diff --git a/fs/minix/dir.c b/fs/minix/dir.c
index d4946c4c90e2..e5f206467e40 100644
--- a/fs/minix/dir.c
+++ b/fs/minix/dir.c
@@ -22,7 +22,7 @@ static int minix_readdir(struct file *, void *, filldir_t);
22const struct file_operations minix_dir_operations = { 22const struct file_operations minix_dir_operations = {
23 .read = generic_read_dir, 23 .read = generic_read_dir,
24 .readdir = minix_readdir, 24 .readdir = minix_readdir,
25 .fsync = minix_sync_file, 25 .fsync = simple_fsync,
26}; 26};
27 27
28static inline void dir_put_page(struct page *page) 28static inline void dir_put_page(struct page *page)
diff --git a/fs/minix/file.c b/fs/minix/file.c
index 17765f697e50..3eec3e607a87 100644
--- a/fs/minix/file.c
+++ b/fs/minix/file.c
@@ -6,15 +6,12 @@
6 * minix regular file handling primitives 6 * minix regular file handling primitives
7 */ 7 */
8 8
9#include <linux/buffer_head.h> /* for fsync_inode_buffers() */
10#include "minix.h" 9#include "minix.h"
11 10
12/* 11/*
13 * We have mostly NULLs here: the current defaults are OK for 12 * We have mostly NULLs here: the current defaults are OK for
14 * the minix filesystem. 13 * the minix filesystem.
15 */ 14 */
16int minix_sync_file(struct file *, struct dentry *, int);
17
18const struct file_operations minix_file_operations = { 15const struct file_operations minix_file_operations = {
19 .llseek = generic_file_llseek, 16 .llseek = generic_file_llseek,
20 .read = do_sync_read, 17 .read = do_sync_read,
@@ -22,7 +19,7 @@ const struct file_operations minix_file_operations = {
22 .write = do_sync_write, 19 .write = do_sync_write,
23 .aio_write = generic_file_aio_write, 20 .aio_write = generic_file_aio_write,
24 .mmap = generic_file_mmap, 21 .mmap = generic_file_mmap,
25 .fsync = minix_sync_file, 22 .fsync = simple_fsync,
26 .splice_read = generic_file_splice_read, 23 .splice_read = generic_file_splice_read,
27}; 24};
28 25
@@ -30,18 +27,3 @@ const struct inode_operations minix_file_inode_operations = {
30 .truncate = minix_truncate, 27 .truncate = minix_truncate,
31 .getattr = minix_getattr, 28 .getattr = minix_getattr,
32}; 29};
33
34int minix_sync_file(struct file * file, struct dentry *dentry, int datasync)
35{
36 struct inode *inode = dentry->d_inode;
37 int err;
38
39 err = sync_mapping_buffers(inode->i_mapping);
40 if (!(inode->i_state & I_DIRTY))
41 return err;
42 if (datasync && !(inode->i_state & I_DIRTY_DATASYNC))
43 return err;
44
45 err |= minix_sync_inode(inode);
46 return err ? -EIO : 0;
47}
diff --git a/fs/minix/inode.c b/fs/minix/inode.c
index 7eb53970f4bc..f91a23693597 100644
--- a/fs/minix/inode.c
+++ b/fs/minix/inode.c
@@ -556,38 +556,25 @@ static struct buffer_head * V2_minix_update_inode(struct inode * inode)
556 return bh; 556 return bh;
557} 557}
558 558
559static struct buffer_head *minix_update_inode(struct inode *inode) 559static int minix_write_inode(struct inode *inode, int wait)
560{
561 if (INODE_VERSION(inode) == MINIX_V1)
562 return V1_minix_update_inode(inode);
563 else
564 return V2_minix_update_inode(inode);
565}
566
567static int minix_write_inode(struct inode * inode, int wait)
568{
569 brelse(minix_update_inode(inode));
570 return 0;
571}
572
573int minix_sync_inode(struct inode * inode)
574{ 560{
575 int err = 0; 561 int err = 0;
576 struct buffer_head *bh; 562 struct buffer_head *bh;
577 563
578 bh = minix_update_inode(inode); 564 if (INODE_VERSION(inode) == MINIX_V1)
579 if (bh && buffer_dirty(bh)) 565 bh = V1_minix_update_inode(inode);
580 { 566 else
567 bh = V2_minix_update_inode(inode);
568 if (!bh)
569 return -EIO;
570 if (wait && buffer_dirty(bh)) {
581 sync_dirty_buffer(bh); 571 sync_dirty_buffer(bh);
582 if (buffer_req(bh) && !buffer_uptodate(bh)) 572 if (buffer_req(bh) && !buffer_uptodate(bh)) {
583 {
584 printk("IO error syncing minix inode [%s:%08lx]\n", 573 printk("IO error syncing minix inode [%s:%08lx]\n",
585 inode->i_sb->s_id, inode->i_ino); 574 inode->i_sb->s_id, inode->i_ino);
586 err = -1; 575 err = -EIO;
587 } 576 }
588 } 577 }
589 else if (!bh)
590 err = -1;
591 brelse (bh); 578 brelse (bh);
592 return err; 579 return err;
593} 580}
diff --git a/fs/minix/minix.h b/fs/minix/minix.h
index e6a0b193bea4..cb7fdd11f9a5 100644
--- a/fs/minix/minix.h
+++ b/fs/minix/minix.h
@@ -57,7 +57,6 @@ extern int __minix_write_begin(struct file *file, struct address_space *mapping,
57extern void V1_minix_truncate(struct inode *); 57extern void V1_minix_truncate(struct inode *);
58extern void V2_minix_truncate(struct inode *); 58extern void V2_minix_truncate(struct inode *);
59extern void minix_truncate(struct inode *); 59extern void minix_truncate(struct inode *);
60extern int minix_sync_inode(struct inode *);
61extern void minix_set_inode(struct inode *, dev_t); 60extern void minix_set_inode(struct inode *, dev_t);
62extern int V1_minix_get_block(struct inode *, long, struct buffer_head *, int); 61extern int V1_minix_get_block(struct inode *, long, struct buffer_head *, int);
63extern int V2_minix_get_block(struct inode *, long, struct buffer_head *, int); 62extern int V2_minix_get_block(struct inode *, long, struct buffer_head *, int);
@@ -72,7 +71,6 @@ extern int minix_empty_dir(struct inode*);
72extern void minix_set_link(struct minix_dir_entry*, struct page*, struct inode*); 71extern void minix_set_link(struct minix_dir_entry*, struct page*, struct inode*);
73extern struct minix_dir_entry *minix_dotdot(struct inode*, struct page**); 72extern struct minix_dir_entry *minix_dotdot(struct inode*, struct page**);
74extern ino_t minix_inode_by_name(struct dentry*); 73extern ino_t minix_inode_by_name(struct dentry*);
75extern int minix_sync_file(struct file *, struct dentry *, int);
76 74
77extern const struct inode_operations minix_file_inode_operations; 75extern const struct inode_operations minix_file_inode_operations;
78extern const struct inode_operations minix_dir_inode_operations; 76extern const struct inode_operations minix_dir_inode_operations;