aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hfsplus
diff options
context:
space:
mode:
Diffstat (limited to 'fs/hfsplus')
-rw-r--r--fs/hfsplus/bitmap.c8
-rw-r--r--fs/hfsplus/hfsplus_fs.h3
-rw-r--r--fs/hfsplus/inode.c14
-rw-r--r--fs/hfsplus/ioctl.c1
-rw-r--r--fs/hfsplus/super.c21
5 files changed, 8 insertions, 39 deletions
diff --git a/fs/hfsplus/bitmap.c b/fs/hfsplus/bitmap.c
index c7d316455fa..9fb51632303 100644
--- a/fs/hfsplus/bitmap.c
+++ b/fs/hfsplus/bitmap.c
@@ -29,7 +29,7 @@ int hfsplus_block_allocate(struct super_block *sb, u32 size, u32 offset, u32 *ma
29 return size; 29 return size;
30 30
31 dprint(DBG_BITMAP, "block_allocate: %u,%u,%u\n", size, offset, len); 31 dprint(DBG_BITMAP, "block_allocate: %u,%u,%u\n", size, offset, len);
32 down(&HFSPLUS_SB(sb).alloc_file->i_sem); 32 mutex_lock(&HFSPLUS_SB(sb).alloc_file->i_mutex);
33 mapping = HFSPLUS_SB(sb).alloc_file->i_mapping; 33 mapping = HFSPLUS_SB(sb).alloc_file->i_mapping;
34 page = read_cache_page(mapping, offset / PAGE_CACHE_BITS, 34 page = read_cache_page(mapping, offset / PAGE_CACHE_BITS,
35 (filler_t *)mapping->a_ops->readpage, NULL); 35 (filler_t *)mapping->a_ops->readpage, NULL);
@@ -143,7 +143,7 @@ done:
143 sb->s_dirt = 1; 143 sb->s_dirt = 1;
144 dprint(DBG_BITMAP, "-> %u,%u\n", start, *max); 144 dprint(DBG_BITMAP, "-> %u,%u\n", start, *max);
145out: 145out:
146 up(&HFSPLUS_SB(sb).alloc_file->i_sem); 146 mutex_unlock(&HFSPLUS_SB(sb).alloc_file->i_mutex);
147 return start; 147 return start;
148} 148}
149 149
@@ -164,7 +164,7 @@ int hfsplus_block_free(struct super_block *sb, u32 offset, u32 count)
164 if ((offset + count) > HFSPLUS_SB(sb).total_blocks) 164 if ((offset + count) > HFSPLUS_SB(sb).total_blocks)
165 return -2; 165 return -2;
166 166
167 down(&HFSPLUS_SB(sb).alloc_file->i_sem); 167 mutex_lock(&HFSPLUS_SB(sb).alloc_file->i_mutex);
168 mapping = HFSPLUS_SB(sb).alloc_file->i_mapping; 168 mapping = HFSPLUS_SB(sb).alloc_file->i_mapping;
169 pnr = offset / PAGE_CACHE_BITS; 169 pnr = offset / PAGE_CACHE_BITS;
170 page = read_cache_page(mapping, pnr, (filler_t *)mapping->a_ops->readpage, NULL); 170 page = read_cache_page(mapping, pnr, (filler_t *)mapping->a_ops->readpage, NULL);
@@ -215,7 +215,7 @@ out:
215 kunmap(page); 215 kunmap(page);
216 HFSPLUS_SB(sb).free_blocks += len; 216 HFSPLUS_SB(sb).free_blocks += len;
217 sb->s_dirt = 1; 217 sb->s_dirt = 1;
218 up(&HFSPLUS_SB(sb).alloc_file->i_sem); 218 mutex_unlock(&HFSPLUS_SB(sb).alloc_file->i_mutex);
219 219
220 return 0; 220 return 0;
221} 221}
diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h
index df16fcbff3f..0fa1ab6250b 100644
--- a/fs/hfsplus/hfsplus_fs.h
+++ b/fs/hfsplus/hfsplus_fs.h
@@ -143,9 +143,6 @@ struct hfsplus_sb_info {
143 143
144 unsigned long flags; 144 unsigned long flags;
145 145
146 atomic_t inode_cnt;
147 u32 last_inode_cnt;
148
149 struct hlist_head rsrc_inodes; 146 struct hlist_head rsrc_inodes;
150}; 147};
151 148
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c
index fc98583cf04..7acff6c5464 100644
--- a/fs/hfsplus/inode.c
+++ b/fs/hfsplus/inode.c
@@ -182,11 +182,6 @@ static struct dentry *hfsplus_file_lookup(struct inode *dir, struct dentry *dent
182 igrab(dir); 182 igrab(dir);
183 hlist_add_head(&inode->i_hash, &HFSPLUS_SB(sb).rsrc_inodes); 183 hlist_add_head(&inode->i_hash, &HFSPLUS_SB(sb).rsrc_inodes);
184 mark_inode_dirty(inode); 184 mark_inode_dirty(inode);
185 {
186 void hfsplus_inode_check(struct super_block *sb);
187 atomic_inc(&HFSPLUS_SB(sb).inode_cnt);
188 hfsplus_inode_check(sb);
189 }
190out: 185out:
191 d_add(dentry, inode); 186 d_add(dentry, inode);
192 return NULL; 187 return NULL;
@@ -276,13 +271,13 @@ static int hfsplus_file_release(struct inode *inode, struct file *file)
276 if (atomic_read(&file->f_count) != 0) 271 if (atomic_read(&file->f_count) != 0)
277 return 0; 272 return 0;
278 if (atomic_dec_and_test(&HFSPLUS_I(inode).opencnt)) { 273 if (atomic_dec_and_test(&HFSPLUS_I(inode).opencnt)) {
279 down(&inode->i_sem); 274 mutex_lock(&inode->i_mutex);
280 hfsplus_file_truncate(inode); 275 hfsplus_file_truncate(inode);
281 if (inode->i_flags & S_DEAD) { 276 if (inode->i_flags & S_DEAD) {
282 hfsplus_delete_cat(inode->i_ino, HFSPLUS_SB(sb).hidden_dir, NULL); 277 hfsplus_delete_cat(inode->i_ino, HFSPLUS_SB(sb).hidden_dir, NULL);
283 hfsplus_delete_inode(inode); 278 hfsplus_delete_inode(inode);
284 } 279 }
285 up(&inode->i_sem); 280 mutex_unlock(&inode->i_mutex);
286 } 281 }
287 return 0; 282 return 0;
288} 283}
@@ -317,11 +312,6 @@ struct inode *hfsplus_new_inode(struct super_block *sb, int mode)
317 if (!inode) 312 if (!inode)
318 return NULL; 313 return NULL;
319 314
320 {
321 void hfsplus_inode_check(struct super_block *sb);
322 atomic_inc(&HFSPLUS_SB(sb).inode_cnt);
323 hfsplus_inode_check(sb);
324 }
325 inode->i_ino = HFSPLUS_SB(sb).next_cnid++; 315 inode->i_ino = HFSPLUS_SB(sb).next_cnid++;
326 inode->i_mode = mode; 316 inode->i_mode = mode;
327 inode->i_uid = current->fsuid; 317 inode->i_uid = current->fsuid;
diff --git a/fs/hfsplus/ioctl.c b/fs/hfsplus/ioctl.c
index e07aa096e07..13cf848ac83 100644
--- a/fs/hfsplus/ioctl.c
+++ b/fs/hfsplus/ioctl.c
@@ -12,6 +12,7 @@
12 * hfsplus ioctls 12 * hfsplus ioctls
13 */ 13 */
14 14
15#include <linux/capability.h>
15#include <linux/fs.h> 16#include <linux/fs.h>
16#include <linux/sched.h> 17#include <linux/sched.h>
17#include <linux/xattr.h> 18#include <linux/xattr.h>
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c
index 8093351bd7c..d791780def5 100644
--- a/fs/hfsplus/super.c
+++ b/fs/hfsplus/super.c
@@ -22,29 +22,12 @@ static void hfsplus_destroy_inode(struct inode *inode);
22 22
23#include "hfsplus_fs.h" 23#include "hfsplus_fs.h"
24 24
25void hfsplus_inode_check(struct super_block *sb)
26{
27#if 0
28 u32 cnt = atomic_read(&HFSPLUS_SB(sb).inode_cnt);
29 u32 last_cnt = HFSPLUS_SB(sb).last_inode_cnt;
30
31 if (cnt <= (last_cnt / 2) ||
32 cnt >= (last_cnt * 2)) {
33 HFSPLUS_SB(sb).last_inode_cnt = cnt;
34 printk("inode_check: %u,%u,%u\n", cnt, last_cnt,
35 HFSPLUS_SB(sb).cat_tree ? HFSPLUS_SB(sb).cat_tree->node_hash_cnt : 0);
36 }
37#endif
38}
39
40static void hfsplus_read_inode(struct inode *inode) 25static void hfsplus_read_inode(struct inode *inode)
41{ 26{
42 struct hfs_find_data fd; 27 struct hfs_find_data fd;
43 struct hfsplus_vh *vhdr; 28 struct hfsplus_vh *vhdr;
44 int err; 29 int err;
45 30
46 atomic_inc(&HFSPLUS_SB(inode->i_sb).inode_cnt);
47 hfsplus_inode_check(inode->i_sb);
48 INIT_LIST_HEAD(&HFSPLUS_I(inode).open_dir_list); 31 INIT_LIST_HEAD(&HFSPLUS_I(inode).open_dir_list);
49 init_MUTEX(&HFSPLUS_I(inode).extents_lock); 32 init_MUTEX(&HFSPLUS_I(inode).extents_lock);
50 HFSPLUS_I(inode).flags = 0; 33 HFSPLUS_I(inode).flags = 0;
@@ -155,12 +138,10 @@ static int hfsplus_write_inode(struct inode *inode, int unused)
155static void hfsplus_clear_inode(struct inode *inode) 138static void hfsplus_clear_inode(struct inode *inode)
156{ 139{
157 dprint(DBG_INODE, "hfsplus_clear_inode: %lu\n", inode->i_ino); 140 dprint(DBG_INODE, "hfsplus_clear_inode: %lu\n", inode->i_ino);
158 atomic_dec(&HFSPLUS_SB(inode->i_sb).inode_cnt);
159 if (HFSPLUS_IS_RSRC(inode)) { 141 if (HFSPLUS_IS_RSRC(inode)) {
160 HFSPLUS_I(HFSPLUS_I(inode).rsrc_inode).rsrc_inode = NULL; 142 HFSPLUS_I(HFSPLUS_I(inode).rsrc_inode).rsrc_inode = NULL;
161 iput(HFSPLUS_I(inode).rsrc_inode); 143 iput(HFSPLUS_I(inode).rsrc_inode);
162 } 144 }
163 hfsplus_inode_check(inode->i_sb);
164} 145}
165 146
166static void hfsplus_write_super(struct super_block *sb) 147static void hfsplus_write_super(struct super_block *sb)
@@ -320,7 +301,7 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent)
320 /* temporarily use utf8 to correctly find the hidden dir below */ 301 /* temporarily use utf8 to correctly find the hidden dir below */
321 nls = sbi->nls; 302 nls = sbi->nls;
322 sbi->nls = load_nls("utf8"); 303 sbi->nls = load_nls("utf8");
323 if (!nls) { 304 if (!sbi->nls) {
324 printk("HFS+: unable to load nls for utf8\n"); 305 printk("HFS+: unable to load nls for utf8\n");
325 err = -EINVAL; 306 err = -EINVAL;
326 goto cleanup; 307 goto cleanup;