diff options
Diffstat (limited to 'fs/ext3')
-rw-r--r-- | fs/ext3/balloc.c | 2 | ||||
-rw-r--r-- | fs/ext3/bitmap.c | 12 | ||||
-rw-r--r-- | fs/ext3/fsync.c | 9 | ||||
-rw-r--r-- | fs/ext3/inode.c | 25 | ||||
-rw-r--r-- | fs/ext3/super.c | 14 |
5 files changed, 25 insertions, 37 deletions
diff --git a/fs/ext3/balloc.c b/fs/ext3/balloc.c index 7c6a31d44daf..7320a66e958f 100644 --- a/fs/ext3/balloc.c +++ b/fs/ext3/balloc.c | |||
@@ -1813,7 +1813,7 @@ ext3_fsblk_t ext3_count_free_blocks(struct super_block *sb) | |||
1813 | brelse(bitmap_bh); | 1813 | brelse(bitmap_bh); |
1814 | printk("ext3_count_free_blocks: stored = "E3FSBLK | 1814 | printk("ext3_count_free_blocks: stored = "E3FSBLK |
1815 | ", computed = "E3FSBLK", "E3FSBLK"\n", | 1815 | ", computed = "E3FSBLK", "E3FSBLK"\n", |
1816 | le32_to_cpu(es->s_free_blocks_count), | 1816 | (ext3_fsblk_t)le32_to_cpu(es->s_free_blocks_count), |
1817 | desc_count, bitmap_count); | 1817 | desc_count, bitmap_count); |
1818 | return bitmap_count; | 1818 | return bitmap_count; |
1819 | #else | 1819 | #else |
diff --git a/fs/ext3/bitmap.c b/fs/ext3/bitmap.c index 909d13e26560..ef9c643e8e9d 100644 --- a/fs/ext3/bitmap.c +++ b/fs/ext3/bitmap.c | |||
@@ -11,19 +11,9 @@ | |||
11 | 11 | ||
12 | #ifdef EXT3FS_DEBUG | 12 | #ifdef EXT3FS_DEBUG |
13 | 13 | ||
14 | static const int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0}; | ||
15 | |||
16 | unsigned long ext3_count_free (struct buffer_head * map, unsigned int numchars) | 14 | unsigned long ext3_count_free (struct buffer_head * map, unsigned int numchars) |
17 | { | 15 | { |
18 | unsigned int i; | 16 | return numchars * BITS_PER_BYTE - memweight(map->b_data, numchars); |
19 | unsigned long sum = 0; | ||
20 | |||
21 | if (!map) | ||
22 | return (0); | ||
23 | for (i = 0; i < numchars; i++) | ||
24 | sum += nibblemap[map->b_data[i] & 0xf] + | ||
25 | nibblemap[(map->b_data[i] >> 4) & 0xf]; | ||
26 | return (sum); | ||
27 | } | 17 | } |
28 | 18 | ||
29 | #endif /* EXT3FS_DEBUG */ | 19 | #endif /* EXT3FS_DEBUG */ |
diff --git a/fs/ext3/fsync.c b/fs/ext3/fsync.c index d4dff278cbd8..b31dbd4c46ad 100644 --- a/fs/ext3/fsync.c +++ b/fs/ext3/fsync.c | |||
@@ -92,8 +92,13 @@ int ext3_sync_file(struct file *file, loff_t start, loff_t end, int datasync) | |||
92 | * disk caches manually so that data really is on persistent | 92 | * disk caches manually so that data really is on persistent |
93 | * storage | 93 | * storage |
94 | */ | 94 | */ |
95 | if (needs_barrier) | 95 | if (needs_barrier) { |
96 | blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL); | 96 | int err; |
97 | |||
98 | err = blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL); | ||
99 | if (!ret) | ||
100 | ret = err; | ||
101 | } | ||
97 | out: | 102 | out: |
98 | trace_ext3_sync_file_exit(inode, ret); | 103 | trace_ext3_sync_file_exit(inode, ret); |
99 | return ret; | 104 | return ret; |
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c index 3aff616d4d03..7e87e37a372a 100644 --- a/fs/ext3/inode.c +++ b/fs/ext3/inode.c | |||
@@ -3072,6 +3072,8 @@ static int ext3_do_update_inode(handle_t *handle, | |||
3072 | struct ext3_inode_info *ei = EXT3_I(inode); | 3072 | struct ext3_inode_info *ei = EXT3_I(inode); |
3073 | struct buffer_head *bh = iloc->bh; | 3073 | struct buffer_head *bh = iloc->bh; |
3074 | int err = 0, rc, block; | 3074 | int err = 0, rc, block; |
3075 | int need_datasync = 0; | ||
3076 | __le32 disksize; | ||
3075 | uid_t i_uid; | 3077 | uid_t i_uid; |
3076 | gid_t i_gid; | 3078 | gid_t i_gid; |
3077 | 3079 | ||
@@ -3113,7 +3115,11 @@ again: | |||
3113 | raw_inode->i_gid_high = 0; | 3115 | raw_inode->i_gid_high = 0; |
3114 | } | 3116 | } |
3115 | raw_inode->i_links_count = cpu_to_le16(inode->i_nlink); | 3117 | raw_inode->i_links_count = cpu_to_le16(inode->i_nlink); |
3116 | raw_inode->i_size = cpu_to_le32(ei->i_disksize); | 3118 | disksize = cpu_to_le32(ei->i_disksize); |
3119 | if (disksize != raw_inode->i_size) { | ||
3120 | need_datasync = 1; | ||
3121 | raw_inode->i_size = disksize; | ||
3122 | } | ||
3117 | raw_inode->i_atime = cpu_to_le32(inode->i_atime.tv_sec); | 3123 | raw_inode->i_atime = cpu_to_le32(inode->i_atime.tv_sec); |
3118 | raw_inode->i_ctime = cpu_to_le32(inode->i_ctime.tv_sec); | 3124 | raw_inode->i_ctime = cpu_to_le32(inode->i_ctime.tv_sec); |
3119 | raw_inode->i_mtime = cpu_to_le32(inode->i_mtime.tv_sec); | 3125 | raw_inode->i_mtime = cpu_to_le32(inode->i_mtime.tv_sec); |
@@ -3129,8 +3135,11 @@ again: | |||
3129 | if (!S_ISREG(inode->i_mode)) { | 3135 | if (!S_ISREG(inode->i_mode)) { |
3130 | raw_inode->i_dir_acl = cpu_to_le32(ei->i_dir_acl); | 3136 | raw_inode->i_dir_acl = cpu_to_le32(ei->i_dir_acl); |
3131 | } else { | 3137 | } else { |
3132 | raw_inode->i_size_high = | 3138 | disksize = cpu_to_le32(ei->i_disksize >> 32); |
3133 | cpu_to_le32(ei->i_disksize >> 32); | 3139 | if (disksize != raw_inode->i_size_high) { |
3140 | raw_inode->i_size_high = disksize; | ||
3141 | need_datasync = 1; | ||
3142 | } | ||
3134 | if (ei->i_disksize > 0x7fffffffULL) { | 3143 | if (ei->i_disksize > 0x7fffffffULL) { |
3135 | struct super_block *sb = inode->i_sb; | 3144 | struct super_block *sb = inode->i_sb; |
3136 | if (!EXT3_HAS_RO_COMPAT_FEATURE(sb, | 3145 | if (!EXT3_HAS_RO_COMPAT_FEATURE(sb, |
@@ -3183,6 +3192,8 @@ again: | |||
3183 | ext3_clear_inode_state(inode, EXT3_STATE_NEW); | 3192 | ext3_clear_inode_state(inode, EXT3_STATE_NEW); |
3184 | 3193 | ||
3185 | atomic_set(&ei->i_sync_tid, handle->h_transaction->t_tid); | 3194 | atomic_set(&ei->i_sync_tid, handle->h_transaction->t_tid); |
3195 | if (need_datasync) | ||
3196 | atomic_set(&ei->i_datasync_tid, handle->h_transaction->t_tid); | ||
3186 | out_brelse: | 3197 | out_brelse: |
3187 | brelse (bh); | 3198 | brelse (bh); |
3188 | ext3_std_error(inode->i_sb, err); | 3199 | ext3_std_error(inode->i_sb, err); |
@@ -3459,14 +3470,6 @@ ext3_reserve_inode_write(handle_t *handle, struct inode *inode, | |||
3459 | * inode out, but prune_icache isn't a user-visible syncing function. | 3470 | * inode out, but prune_icache isn't a user-visible syncing function. |
3460 | * Whenever the user wants stuff synced (sys_sync, sys_msync, sys_fsync) | 3471 | * Whenever the user wants stuff synced (sys_sync, sys_msync, sys_fsync) |
3461 | * we start and wait on commits. | 3472 | * we start and wait on commits. |
3462 | * | ||
3463 | * Is this efficient/effective? Well, we're being nice to the system | ||
3464 | * by cleaning up our inodes proactively so they can be reaped | ||
3465 | * without I/O. But we are potentially leaving up to five seconds' | ||
3466 | * worth of inodes floating about which prune_icache wants us to | ||
3467 | * write out. One way to fix that would be to get prune_icache() | ||
3468 | * to do a write_super() to free up some memory. It has the desired | ||
3469 | * effect. | ||
3470 | */ | 3473 | */ |
3471 | int ext3_mark_inode_dirty(handle_t *handle, struct inode *inode) | 3474 | int ext3_mark_inode_dirty(handle_t *handle, struct inode *inode) |
3472 | { | 3475 | { |
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index 4ac304c55c53..8c892e93d8e7 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -64,11 +64,6 @@ static int ext3_freeze(struct super_block *sb); | |||
64 | 64 | ||
65 | /* | 65 | /* |
66 | * Wrappers for journal_start/end. | 66 | * Wrappers for journal_start/end. |
67 | * | ||
68 | * The only special thing we need to do here is to make sure that all | ||
69 | * journal_end calls result in the superblock being marked dirty, so | ||
70 | * that sync() will call the filesystem's write_super callback if | ||
71 | * appropriate. | ||
72 | */ | 67 | */ |
73 | handle_t *ext3_journal_start_sb(struct super_block *sb, int nblocks) | 68 | handle_t *ext3_journal_start_sb(struct super_block *sb, int nblocks) |
74 | { | 69 | { |
@@ -90,12 +85,6 @@ handle_t *ext3_journal_start_sb(struct super_block *sb, int nblocks) | |||
90 | return journal_start(journal, nblocks); | 85 | return journal_start(journal, nblocks); |
91 | } | 86 | } |
92 | 87 | ||
93 | /* | ||
94 | * The only special thing we need to do here is to make sure that all | ||
95 | * journal_stop calls result in the superblock being marked dirty, so | ||
96 | * that sync() will call the filesystem's write_super callback if | ||
97 | * appropriate. | ||
98 | */ | ||
99 | int __ext3_journal_stop(const char *where, handle_t *handle) | 88 | int __ext3_journal_stop(const char *where, handle_t *handle) |
100 | { | 89 | { |
101 | struct super_block *sb; | 90 | struct super_block *sb; |
@@ -2058,7 +2047,8 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
2058 | goto failed_mount3; | 2047 | goto failed_mount3; |
2059 | } | 2048 | } |
2060 | 2049 | ||
2061 | ext3_setup_super (sb, es, sb->s_flags & MS_RDONLY); | 2050 | if (ext3_setup_super(sb, es, sb->s_flags & MS_RDONLY)) |
2051 | sb->s_flags |= MS_RDONLY; | ||
2062 | 2052 | ||
2063 | EXT3_SB(sb)->s_mount_state |= EXT3_ORPHAN_FS; | 2053 | EXT3_SB(sb)->s_mount_state |= EXT3_ORPHAN_FS; |
2064 | ext3_orphan_cleanup(sb, es); | 2054 | ext3_orphan_cleanup(sb, es); |