int jfs_umount_rw(struct super_block *sb) { struct jfs_sb_info *sbi = JFS_SBI(sb); struct jfs_log *log = sbi->log; if (!log) return 0; /* * close log: * * remove file system from log active file system list. */ jfs_flush_journal(log, 2); /* * Make sure all metadata makes it to disk */ dbSync(sbi->ipbmap); diSync(sbi->ipimap); fsync_inode_data_buffers(sb->s_bdev->bd_inode); updateSuper(sb, FM_CLEAN); sbi->log = NULL; return lmLogClose(sb, log); }
int ext3_sync_file(struct file * file, struct dentry *dentry, int datasync) { struct inode *inode = dentry->d_inode; int ret; J_ASSERT(ext3_journal_current_handle() == 0); /* * fsync_inode_buffers() just walks i_dirty_buffers and waits * on them. It's a no-op for full data journalling because * i_dirty_buffers will be ampty. * Really, we only need to start I/O on the dirty buffers - * we'll end up waiting on them in commit. */ ret = fsync_inode_buffers(inode); /* In writeback mode, we need to force out data buffers too. In * the other modes, ext3_force_commit takes care of forcing out * just the right data blocks. */ if (test_opt(inode->i_sb, DATA_FLAGS) == EXT3_MOUNT_WRITEBACK_DATA) ret |= fsync_inode_data_buffers(inode); ext3_force_commit(inode->i_sb); return ret; }
/* * vnode pcache layer for vnode_flushinval_pages. * 'last' parameter unused but left in for IRIX compatibility */ void fs_flushinval_pages( bhv_desc_t *bdp, xfs_off_t first, xfs_off_t last, int fiopt) { vnode_t *vp = BHV_TO_VNODE(bdp); struct inode *ip = LINVFS_GET_IP(vp); if (VN_CACHED(vp)) { filemap_fdatasync(ip->i_mapping); fsync_inode_data_buffers(ip); filemap_fdatawait(ip->i_mapping); truncate_inode_pages(ip->i_mapping, first); } }
/* * vnode pcache layer for vnode_flush_pages. * 'last' parameter unused but left in for IRIX compatibility */ int fs_flush_pages( bhv_desc_t *bdp, xfs_off_t first, xfs_off_t last, uint64_t flags, int fiopt) { vnode_t *vp = BHV_TO_VNODE(bdp); struct inode *ip = LINVFS_GET_IP(vp); if (VN_CACHED(vp)) { filemap_fdatasync(ip->i_mapping); fsync_inode_data_buffers(ip); filemap_fdatawait(ip->i_mapping); } return 0; }
/* Sync a reiserfs file. */ static int reiserfs_sync_file( struct file * p_s_filp, struct dentry * p_s_dentry, int datasync ) { struct inode * p_s_inode = p_s_dentry->d_inode; int n_err; lock_kernel() ; if (!S_ISREG(p_s_inode->i_mode)) BUG (); n_err = fsync_inode_buffers(p_s_inode) ; n_err |= fsync_inode_data_buffers(p_s_inode); reiserfs_commit_for_inode(p_s_inode) ; unlock_kernel() ; return ( n_err < 0 ) ? -EIO : 0; }
/* * NAME: jfs_umount(vfsp, flags, crp) * * FUNCTION: vfs_umount() * * PARAMETERS: vfsp - virtual file system pointer * flags - unmount for shutdown * crp - credential * * RETURN : EBUSY - device has open files */ int jfs_umount(struct super_block *sb) { struct jfs_sb_info *sbi = JFS_SBI(sb); struct inode *ipbmap = sbi->ipbmap; struct inode *ipimap = sbi->ipimap; struct inode *ipaimap = sbi->ipaimap; struct inode *ipaimap2 = sbi->ipaimap2; struct jfs_log *log; int rc = 0; jfs_info("UnMount JFS: sb:0x%p", sb); /* * update superblock and close log * * if mounted read-write and log based recovery was enabled */ if ((log = sbi->log)) /* * Wait for outstanding transactions to be written to log: */ jfs_flush_journal(log, 2); /* * close fileset inode allocation map (aka fileset inode) */ diUnmount(ipimap, 0); diFreeSpecial(ipimap); sbi->ipimap = NULL; /* * close secondary aggregate inode allocation map */ ipaimap2 = sbi->ipaimap2; if (ipaimap2) { diUnmount(ipaimap2, 0); diFreeSpecial(ipaimap2); sbi->ipaimap2 = NULL; } /* * close aggregate inode allocation map */ ipaimap = sbi->ipaimap; diUnmount(ipaimap, 0); diFreeSpecial(ipaimap); sbi->ipaimap = NULL; /* * close aggregate block allocation map */ dbUnmount(ipbmap, 0); diFreeSpecial(ipbmap); sbi->ipimap = NULL; /* * Make sure all metadata makes it to disk before we mark * the superblock as clean */ fsync_inode_data_buffers(sb->s_bdev->bd_inode); /* * ensure all file system file pages are propagated to their * home blocks on disk (and their in-memory buffer pages are * invalidated) BEFORE updating file system superblock state * (to signify file system is unmounted cleanly, and thus in * consistent state) and log superblock active file system * list (to signify skip logredo()). */ if (log) { /* log = NULL if read-only mount */ rc = updateSuper(sb, FM_CLEAN); /* * close log: * * remove file system from log active file system list. */ rc = lmLogClose(sb, log); } jfs_info("UnMount JFS Complete: rc = %d", rc); return rc; }