Skip to content

Commit

Permalink
switch minix to simple_fsync()
Browse files Browse the repository at this point in the history
* get minix_write_inode() to honour the second argument
* now we can use simple_fsync() for minixfs

Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Al Viro committed Jun 12, 2009
1 parent e1740a4 commit 0d7916d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 45 deletions.
2 changes: 1 addition & 1 deletion fs/minix/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ static int minix_readdir(struct file *, void *, filldir_t);
const struct file_operations minix_dir_operations = {
.read = generic_read_dir,
.readdir = minix_readdir,
.fsync = minix_sync_file,
.fsync = simple_fsync,
};

static inline void dir_put_page(struct page *page)
Expand Down
20 changes: 1 addition & 19 deletions fs/minix/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,24 @@
* minix regular file handling primitives
*/

#include <linux/buffer_head.h> /* for fsync_inode_buffers() */
#include "minix.h"

/*
* We have mostly NULLs here: the current defaults are OK for
* the minix filesystem.
*/
int minix_sync_file(struct file *, struct dentry *, int);

const struct file_operations minix_file_operations = {
.llseek = generic_file_llseek,
.read = do_sync_read,
.aio_read = generic_file_aio_read,
.write = do_sync_write,
.aio_write = generic_file_aio_write,
.mmap = generic_file_mmap,
.fsync = minix_sync_file,
.fsync = simple_fsync,
.splice_read = generic_file_splice_read,
};

const struct inode_operations minix_file_inode_operations = {
.truncate = minix_truncate,
.getattr = minix_getattr,
};

int minix_sync_file(struct file * file, struct dentry *dentry, int datasync)
{
struct inode *inode = dentry->d_inode;
int err;

err = sync_mapping_buffers(inode->i_mapping);
if (!(inode->i_state & I_DIRTY))
return err;
if (datasync && !(inode->i_state & I_DIRTY_DATASYNC))
return err;

err |= minix_sync_inode(inode);
return err ? -EIO : 0;
}
33 changes: 10 additions & 23 deletions fs/minix/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -556,38 +556,25 @@ static struct buffer_head * V2_minix_update_inode(struct inode * inode)
return bh;
}

static struct buffer_head *minix_update_inode(struct inode *inode)
{
if (INODE_VERSION(inode) == MINIX_V1)
return V1_minix_update_inode(inode);
else
return V2_minix_update_inode(inode);
}

static int minix_write_inode(struct inode * inode, int wait)
{
brelse(minix_update_inode(inode));
return 0;
}

int minix_sync_inode(struct inode * inode)
static int minix_write_inode(struct inode *inode, int wait)
{
int err = 0;
struct buffer_head *bh;

bh = minix_update_inode(inode);
if (bh && buffer_dirty(bh))
{
if (INODE_VERSION(inode) == MINIX_V1)
bh = V1_minix_update_inode(inode);
else
bh = V2_minix_update_inode(inode);
if (!bh)
return -EIO;
if (wait && buffer_dirty(bh)) {
sync_dirty_buffer(bh);
if (buffer_req(bh) && !buffer_uptodate(bh))
{
if (buffer_req(bh) && !buffer_uptodate(bh)) {
printk("IO error syncing minix inode [%s:%08lx]\n",
inode->i_sb->s_id, inode->i_ino);
err = -1;
err = -EIO;
}
}
else if (!bh)
err = -1;
brelse (bh);
return err;
}
Expand Down
2 changes: 0 additions & 2 deletions fs/minix/minix.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ extern int __minix_write_begin(struct file *file, struct address_space *mapping,
extern void V1_minix_truncate(struct inode *);
extern void V2_minix_truncate(struct inode *);
extern void minix_truncate(struct inode *);
extern int minix_sync_inode(struct inode *);
extern void minix_set_inode(struct inode *, dev_t);
extern int V1_minix_get_block(struct inode *, long, struct buffer_head *, int);
extern int V2_minix_get_block(struct inode *, long, struct buffer_head *, int);
Expand All @@ -72,7 +71,6 @@ extern int minix_empty_dir(struct inode*);
extern void minix_set_link(struct minix_dir_entry*, struct page*, struct inode*);
extern struct minix_dir_entry *minix_dotdot(struct inode*, struct page**);
extern ino_t minix_inode_by_name(struct dentry*);
extern int minix_sync_file(struct file *, struct dentry *, int);

extern const struct inode_operations minix_file_inode_operations;
extern const struct inode_operations minix_dir_inode_operations;
Expand Down

0 comments on commit 0d7916d

Please sign in to comment.