|
@@ -29,38 +29,9 @@ static struct kmem_cache *hfs_inode_cachep;
|
|
|
|
|
|
MODULE_LICENSE("GPL");
|
|
MODULE_LICENSE("GPL");
|
|
|
|
|
|
-/*
|
|
|
|
- * hfs_write_super()
|
|
|
|
- *
|
|
|
|
- * Description:
|
|
|
|
- * This function is called by the VFS only. When the filesystem
|
|
|
|
- * is mounted r/w it updates the MDB on disk.
|
|
|
|
- * Input Variable(s):
|
|
|
|
- * struct super_block *sb: Pointer to the hfs superblock
|
|
|
|
- * Output Variable(s):
|
|
|
|
- * NONE
|
|
|
|
- * Returns:
|
|
|
|
- * void
|
|
|
|
- * Preconditions:
|
|
|
|
- * 'sb' points to a "valid" (struct super_block).
|
|
|
|
- * Postconditions:
|
|
|
|
- * The MDB is marked 'unsuccessfully unmounted' by clearing bit 8 of drAtrb
|
|
|
|
- * (hfs_put_super() must set this flag!). Some MDB fields are updated
|
|
|
|
- * and the MDB buffer is written to disk by calling hfs_mdb_commit().
|
|
|
|
- */
|
|
|
|
-static void hfs_write_super(struct super_block *sb)
|
|
|
|
-{
|
|
|
|
- sb->s_dirt = 0;
|
|
|
|
-
|
|
|
|
- /* sync everything to the buffers */
|
|
|
|
- hfs_mdb_commit(sb);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
static int hfs_sync_fs(struct super_block *sb, int wait)
|
|
static int hfs_sync_fs(struct super_block *sb, int wait)
|
|
{
|
|
{
|
|
hfs_mdb_commit(sb);
|
|
hfs_mdb_commit(sb);
|
|
- sb->s_dirt = 0;
|
|
|
|
-
|
|
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -73,11 +44,44 @@ static int hfs_sync_fs(struct super_block *sb, int wait)
|
|
*/
|
|
*/
|
|
static void hfs_put_super(struct super_block *sb)
|
|
static void hfs_put_super(struct super_block *sb)
|
|
{
|
|
{
|
|
|
|
+ cancel_delayed_work_sync(&HFS_SB(sb)->mdb_work);
|
|
hfs_mdb_close(sb);
|
|
hfs_mdb_close(sb);
|
|
/* release the MDB's resources */
|
|
/* release the MDB's resources */
|
|
hfs_mdb_put(sb);
|
|
hfs_mdb_put(sb);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static void flush_mdb(struct work_struct *work)
|
|
|
|
+{
|
|
|
|
+ struct hfs_sb_info *sbi;
|
|
|
|
+ struct super_block *sb;
|
|
|
|
+
|
|
|
|
+ sbi = container_of(work, struct hfs_sb_info, mdb_work.work);
|
|
|
|
+ sb = sbi->sb;
|
|
|
|
+
|
|
|
|
+ spin_lock(&sbi->work_lock);
|
|
|
|
+ sbi->work_queued = 0;
|
|
|
|
+ spin_unlock(&sbi->work_lock);
|
|
|
|
+
|
|
|
|
+ hfs_mdb_commit(sb);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void hfs_mark_mdb_dirty(struct super_block *sb)
|
|
|
|
+{
|
|
|
|
+ struct hfs_sb_info *sbi = HFS_SB(sb);
|
|
|
|
+ unsigned long delay;
|
|
|
|
+
|
|
|
|
+ if (sb->s_flags & MS_RDONLY)
|
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
+ spin_lock(&sbi->work_lock);
|
|
|
|
+ if (!sbi->work_queued) {
|
|
|
|
+ delay = msecs_to_jiffies(dirty_writeback_interval * 10);
|
|
|
|
+ queue_delayed_work(system_long_wq, &sbi->mdb_work, delay);
|
|
|
|
+ sbi->work_queued = 1;
|
|
|
|
+ }
|
|
|
|
+ spin_unlock(&sbi->work_lock);
|
|
|
|
+}
|
|
|
|
+
|
|
/*
|
|
/*
|
|
* hfs_statfs()
|
|
* hfs_statfs()
|
|
*
|
|
*
|
|
@@ -177,7 +181,6 @@ static const struct super_operations hfs_super_operations = {
|
|
.write_inode = hfs_write_inode,
|
|
.write_inode = hfs_write_inode,
|
|
.evict_inode = hfs_evict_inode,
|
|
.evict_inode = hfs_evict_inode,
|
|
.put_super = hfs_put_super,
|
|
.put_super = hfs_put_super,
|
|
- .write_super = hfs_write_super,
|
|
|
|
.sync_fs = hfs_sync_fs,
|
|
.sync_fs = hfs_sync_fs,
|
|
.statfs = hfs_statfs,
|
|
.statfs = hfs_statfs,
|
|
.remount_fs = hfs_remount,
|
|
.remount_fs = hfs_remount,
|
|
@@ -382,6 +385,8 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent)
|
|
|
|
|
|
sbi->sb = sb;
|
|
sbi->sb = sb;
|
|
sb->s_fs_info = sbi;
|
|
sb->s_fs_info = sbi;
|
|
|
|
+ spin_lock_init(&sbi->work_lock);
|
|
|
|
+ INIT_DELAYED_WORK(&sbi->mdb_work, flush_mdb);
|
|
|
|
|
|
res = -EINVAL;
|
|
res = -EINVAL;
|
|
if (!parse_options((char *)data, sbi)) {
|
|
if (!parse_options((char *)data, sbi)) {
|