···11-/*22- * linux/fs/ext2/fsync.c33- *44- * Copyright (C) 1993 Stephen Tweedie (sct@dcs.ed.ac.uk)55- * from66- * Copyright (C) 1992 Remy Card (card@masi.ibp.fr)77- * Laboratoire MASI - Institut Blaise Pascal88- * Universite Pierre et Marie Curie (Paris VI)99- * from1010- * linux/fs/minix/truncate.c Copyright (C) 1991, 1992 Linus Torvalds1111- * 1212- * ext2fs fsync primitive1313- *1414- * Big-endian to little-endian byte-swapping/bitmaps by1515- * David S. Miller (davem@caip.rutgers.edu), 19951616- * 1717- * Removed unnecessary code duplication for little endian machines1818- * and excessive __inline__s. 1919- * Andi Kleen, 19972020- *2121- * Major simplications and cleanup - we only need to do the metadata, because2222- * we can depend on generic_block_fdatasync() to sync the data blocks.2323- */2424-2525-#include "ext2.h"2626-#include <linux/buffer_head.h> /* for sync_mapping_buffers() */2727-2828-2929-/*3030- * File may be NULL when we are called. Perhaps we shouldn't3131- * even pass file to fsync ?3232- */3333-3434-int ext2_sync_file(struct file *file, struct dentry *dentry, int datasync)3535-{3636- struct inode *inode = dentry->d_inode;3737- int err;3838- int ret;3939-4040- ret = sync_mapping_buffers(inode->i_mapping);4141- if (!(inode->i_state & I_DIRTY))4242- return ret;4343- if (datasync && !(inode->i_state & I_DIRTY_DATASYNC))4444- return ret;4545-4646- err = ext2_sync_inode(inode);4747- if (ret == 0)4848- ret = err;4949- return ret;5050-}
+2-9
fs/ext2/inode.c
···4141MODULE_DESCRIPTION("Second Extended Filesystem");4242MODULE_LICENSE("GPL");43434444-static int ext2_update_inode(struct inode * inode, int do_sync);4545-4644/*4745 * Test whether an inode is a fast symlink.4846 */···6466 goto no_delete;6567 EXT2_I(inode)->i_dtime = get_seconds();6668 mark_inode_dirty(inode);6767- ext2_update_inode(inode, inode_needs_sync(inode));6969+ ext2_write_inode(inode, inode_needs_sync(inode));68706971 inode->i_size = 0;7072 if (inode->i_blocks)···13351337 return ERR_PTR(ret);13361338}1337133913381338-static int ext2_update_inode(struct inode * inode, int do_sync)13401340+int ext2_write_inode(struct inode *inode, int do_sync)13391341{13401342 struct ext2_inode_info *ei = EXT2_I(inode);13411343 struct super_block *sb = inode->i_sb;···14381440 ei->i_state &= ~EXT2_STATE_NEW;14391441 brelse (bh);14401442 return err;14411441-}14421442-14431443-int ext2_write_inode(struct inode *inode, int wait)14441444-{14451445- return ext2_update_inode(inode, wait);14461443}1447144414481445int ext2_sync_inode(struct inode *inode)