aboutsummaryrefslogtreecommitdiffstats
path: root/fs/minix
diff options
context:
space:
mode:
Diffstat (limited to 'fs/minix')
-rw-r--r--fs/minix/bitmap.c10
-rw-r--r--fs/minix/dir.c2
-rw-r--r--fs/minix/file.c2
-rw-r--r--fs/minix/inode.c29
-rw-r--r--fs/minix/itree_v1.c4
-rw-r--r--fs/minix/itree_v2.c4
-rw-r--r--fs/minix/minix.h4
-rw-r--r--fs/minix/namei.c48
8 files changed, 46 insertions, 57 deletions
diff --git a/fs/minix/bitmap.c b/fs/minix/bitmap.c
index dc6a4e4abcdc..4a6abc49418e 100644
--- a/fs/minix/bitmap.c
+++ b/fs/minix/bitmap.c
@@ -56,7 +56,7 @@ void minix_free_block(struct inode * inode, int block)
56 unsigned int bit,zone; 56 unsigned int bit,zone;
57 57
58 if (block < sbi->s_firstdatazone || block >= sbi->s_nzones) { 58 if (block < sbi->s_firstdatazone || block >= sbi->s_nzones) {
59 printk("trying to free block not in datazone\n"); 59 printk("Trying to free block not in datazone\n");
60 return; 60 return;
61 } 61 }
62 zone = block - sbi->s_firstdatazone + 1; 62 zone = block - sbi->s_firstdatazone + 1;
@@ -124,7 +124,7 @@ minix_V1_raw_inode(struct super_block *sb, ino_t ino, struct buffer_head **bh)
124 ino / MINIX_INODES_PER_BLOCK; 124 ino / MINIX_INODES_PER_BLOCK;
125 *bh = sb_bread(sb, block); 125 *bh = sb_bread(sb, block);
126 if (!*bh) { 126 if (!*bh) {
127 printk("unable to read i-node block\n"); 127 printk("Unable to read inode block\n");
128 return NULL; 128 return NULL;
129 } 129 }
130 p = (void *)(*bh)->b_data; 130 p = (void *)(*bh)->b_data;
@@ -149,7 +149,7 @@ minix_V2_raw_inode(struct super_block *sb, ino_t ino, struct buffer_head **bh)
149 ino / MINIX2_INODES_PER_BLOCK; 149 ino / MINIX2_INODES_PER_BLOCK;
150 *bh = sb_bread(sb, block); 150 *bh = sb_bread(sb, block);
151 if (!*bh) { 151 if (!*bh) {
152 printk("unable to read i-node block\n"); 152 printk("Unable to read inode block\n");
153 return NULL; 153 return NULL;
154 } 154 }
155 p = (void *)(*bh)->b_data; 155 p = (void *)(*bh)->b_data;
@@ -204,7 +204,7 @@ void minix_free_inode(struct inode * inode)
204 bh = sbi->s_imap[ino >> 13]; 204 bh = sbi->s_imap[ino >> 13];
205 lock_kernel(); 205 lock_kernel();
206 if (!minix_test_and_clear_bit(ino & 8191, bh->b_data)) 206 if (!minix_test_and_clear_bit(ino & 8191, bh->b_data))
207 printk("minix_free_inode: bit %lu already cleared.\n", ino); 207 printk("minix_free_inode: bit %lu already cleared\n", ino);
208 unlock_kernel(); 208 unlock_kernel();
209 mark_buffer_dirty(bh); 209 mark_buffer_dirty(bh);
210 out: 210 out:
@@ -238,7 +238,7 @@ struct inode * minix_new_inode(const struct inode * dir, int * error)
238 return NULL; 238 return NULL;
239 } 239 }
240 if (minix_test_and_set_bit(j,bh->b_data)) { /* shouldn't happen */ 240 if (minix_test_and_set_bit(j,bh->b_data)) { /* shouldn't happen */
241 printk("new_inode: bit already set"); 241 printk("new_inode: bit already set\n");
242 unlock_kernel(); 242 unlock_kernel();
243 iput(inode); 243 iput(inode);
244 return NULL; 244 return NULL;
diff --git a/fs/minix/dir.c b/fs/minix/dir.c
index 732502aabc05..69224d1fe043 100644
--- a/fs/minix/dir.c
+++ b/fs/minix/dir.c
@@ -14,7 +14,7 @@ typedef struct minix_dir_entry minix_dirent;
14 14
15static int minix_readdir(struct file *, void *, filldir_t); 15static int minix_readdir(struct file *, void *, filldir_t);
16 16
17struct file_operations minix_dir_operations = { 17const struct file_operations minix_dir_operations = {
18 .read = generic_read_dir, 18 .read = generic_read_dir,
19 .readdir = minix_readdir, 19 .readdir = minix_readdir,
20 .fsync = minix_sync_file, 20 .fsync = minix_sync_file,
diff --git a/fs/minix/file.c b/fs/minix/file.c
index f1d77acb3f01..420b32882a10 100644
--- a/fs/minix/file.c
+++ b/fs/minix/file.c
@@ -15,7 +15,7 @@
15 */ 15 */
16int minix_sync_file(struct file *, struct dentry *, int); 16int minix_sync_file(struct file *, struct dentry *, int);
17 17
18struct file_operations minix_file_operations = { 18const struct file_operations minix_file_operations = {
19 .llseek = generic_file_llseek, 19 .llseek = generic_file_llseek,
20 .read = generic_file_read, 20 .read = generic_file_read,
21 .write = generic_file_write, 21 .write = generic_file_write,
diff --git a/fs/minix/inode.c b/fs/minix/inode.c
index 790cc0d0e970..2dcccf1d1b7f 100644
--- a/fs/minix/inode.c
+++ b/fs/minix/inode.c
@@ -80,7 +80,8 @@ static int init_inodecache(void)
80{ 80{
81 minix_inode_cachep = kmem_cache_create("minix_inode_cache", 81 minix_inode_cachep = kmem_cache_create("minix_inode_cache",
82 sizeof(struct minix_inode_info), 82 sizeof(struct minix_inode_info),
83 0, SLAB_RECLAIM_ACCOUNT, 83 0, (SLAB_RECLAIM_ACCOUNT|
84 SLAB_MEM_SPREAD),
84 init_once, NULL); 85 init_once, NULL);
85 if (minix_inode_cachep == NULL) 86 if (minix_inode_cachep == NULL)
86 return -ENOMEM; 87 return -ENOMEM;
@@ -126,11 +127,11 @@ static int minix_remount (struct super_block * sb, int * flags, char * data)
126 mark_buffer_dirty(sbi->s_sbh); 127 mark_buffer_dirty(sbi->s_sbh);
127 128
128 if (!(sbi->s_mount_state & MINIX_VALID_FS)) 129 if (!(sbi->s_mount_state & MINIX_VALID_FS))
129 printk ("MINIX-fs warning: remounting unchecked fs, " 130 printk("MINIX-fs warning: remounting unchecked fs, "
130 "running fsck is recommended.\n"); 131 "running fsck is recommended\n");
131 else if ((sbi->s_mount_state & MINIX_ERROR_FS)) 132 else if ((sbi->s_mount_state & MINIX_ERROR_FS))
132 printk ("MINIX-fs warning: remounting fs with errors, " 133 printk("MINIX-fs warning: remounting fs with errors, "
133 "running fsck is recommended.\n"); 134 "running fsck is recommended\n");
134 } 135 }
135 return 0; 136 return 0;
136} 137}
@@ -244,11 +245,11 @@ static int minix_fill_super(struct super_block *s, void *data, int silent)
244 mark_buffer_dirty(bh); 245 mark_buffer_dirty(bh);
245 } 246 }
246 if (!(sbi->s_mount_state & MINIX_VALID_FS)) 247 if (!(sbi->s_mount_state & MINIX_VALID_FS))
247 printk ("MINIX-fs: mounting unchecked file system, " 248 printk("MINIX-fs: mounting unchecked file system, "
248 "running fsck is recommended.\n"); 249 "running fsck is recommended\n");
249 else if (sbi->s_mount_state & MINIX_ERROR_FS) 250 else if (sbi->s_mount_state & MINIX_ERROR_FS)
250 printk ("MINIX-fs: mounting file system with errors, " 251 printk("MINIX-fs: mounting file system with errors, "
251 "running fsck is recommended.\n"); 252 "running fsck is recommended\n");
252 return 0; 253 return 0;
253 254
254out_iput: 255out_iput:
@@ -272,19 +273,19 @@ out_no_bitmap:
272 273
273out_no_map: 274out_no_map:
274 if (!silent) 275 if (!silent)
275 printk ("MINIX-fs: can't allocate map\n"); 276 printk("MINIX-fs: can't allocate map\n");
276 goto out_release; 277 goto out_release;
277 278
278out_no_fs: 279out_no_fs:
279 if (!silent) 280 if (!silent)
280 printk("VFS: Can't find a Minix or Minix V2 filesystem on device " 281 printk("VFS: Can't find a Minix or Minix V2 filesystem "
281 "%s.\n", s->s_id); 282 "on device %s\n", s->s_id);
282 out_release: 283 out_release:
283 brelse(bh); 284 brelse(bh);
284 goto out; 285 goto out;
285 286
286out_bad_hblock: 287out_bad_hblock:
287 printk("MINIX-fs: blocksize too small for device.\n"); 288 printk("MINIX-fs: blocksize too small for device\n");
288 goto out; 289 goto out;
289 290
290out_bad_sb: 291out_bad_sb:
@@ -523,7 +524,7 @@ int minix_sync_inode(struct inode * inode)
523 sync_dirty_buffer(bh); 524 sync_dirty_buffer(bh);
524 if (buffer_req(bh) && !buffer_uptodate(bh)) 525 if (buffer_req(bh) && !buffer_uptodate(bh))
525 { 526 {
526 printk ("IO error syncing minix inode [%s:%08lx]\n", 527 printk("IO error syncing minix inode [%s:%08lx]\n",
527 inode->i_sb->s_id, inode->i_ino); 528 inode->i_sb->s_id, inode->i_ino);
528 err = -1; 529 err = -1;
529 } 530 }
diff --git a/fs/minix/itree_v1.c b/fs/minix/itree_v1.c
index ba06aef4aca1..656b1347a25b 100644
--- a/fs/minix/itree_v1.c
+++ b/fs/minix/itree_v1.c
@@ -25,9 +25,9 @@ static int block_to_path(struct inode * inode, long block, int offsets[DEPTH])
25 int n = 0; 25 int n = 0;
26 26
27 if (block < 0) { 27 if (block < 0) {
28 printk("minix_bmap: block<0"); 28 printk("minix_bmap: block<0\n");
29 } else if (block >= (minix_sb(inode->i_sb)->s_max_size/BLOCK_SIZE)) { 29 } else if (block >= (minix_sb(inode->i_sb)->s_max_size/BLOCK_SIZE)) {
30 printk("minix_bmap: block>big"); 30 printk("minix_bmap: block>big\n");
31 } else if (block < 7) { 31 } else if (block < 7) {
32 offsets[n++] = block; 32 offsets[n++] = block;
33 } else if ((block -= 7) < 512) { 33 } else if ((block -= 7) < 512) {
diff --git a/fs/minix/itree_v2.c b/fs/minix/itree_v2.c
index 3adc7675560f..9adcdc754e0f 100644
--- a/fs/minix/itree_v2.c
+++ b/fs/minix/itree_v2.c
@@ -25,9 +25,9 @@ static int block_to_path(struct inode * inode, long block, int offsets[DEPTH])
25 int n = 0; 25 int n = 0;
26 26
27 if (block < 0) { 27 if (block < 0) {
28 printk("minix_bmap: block<0"); 28 printk("minix_bmap: block<0\n");
29 } else if (block >= (minix_sb(inode->i_sb)->s_max_size/BLOCK_SIZE)) { 29 } else if (block >= (minix_sb(inode->i_sb)->s_max_size/BLOCK_SIZE)) {
30 printk("minix_bmap: block>big"); 30 printk("minix_bmap: block>big\n");
31 } else if (block < 7) { 31 } else if (block < 7) {
32 offsets[n++] = block; 32 offsets[n++] = block;
33 } else if ((block -= 7) < 256) { 33 } else if ((block -= 7) < 256) {
diff --git a/fs/minix/minix.h b/fs/minix/minix.h
index e42a8bb89001..c55b77cdcc8e 100644
--- a/fs/minix/minix.h
+++ b/fs/minix/minix.h
@@ -81,8 +81,8 @@ extern int minix_sync_file(struct file *, struct dentry *, int);
81 81
82extern struct inode_operations minix_file_inode_operations; 82extern struct inode_operations minix_file_inode_operations;
83extern struct inode_operations minix_dir_inode_operations; 83extern struct inode_operations minix_dir_inode_operations;
84extern struct file_operations minix_file_operations; 84extern const struct file_operations minix_file_operations;
85extern struct file_operations minix_dir_operations; 85extern const struct file_operations minix_dir_operations;
86extern struct dentry_operations minix_dentry_operations; 86extern struct dentry_operations minix_dentry_operations;
87 87
88static inline struct minix_sb_info *minix_sb(struct super_block *sb) 88static inline struct minix_sb_info *minix_sb(struct super_block *sb)
diff --git a/fs/minix/namei.c b/fs/minix/namei.c
index b25bca5bdb57..5b6a4540a05b 100644
--- a/fs/minix/namei.c
+++ b/fs/minix/namei.c
@@ -6,18 +6,6 @@
6 6
7#include "minix.h" 7#include "minix.h"
8 8
9static inline void inc_count(struct inode *inode)
10{
11 inode->i_nlink++;
12 mark_inode_dirty(inode);
13}
14
15static inline void dec_count(struct inode *inode)
16{
17 inode->i_nlink--;
18 mark_inode_dirty(inode);
19}
20
21static int add_nondir(struct dentry *dentry, struct inode *inode) 9static int add_nondir(struct dentry *dentry, struct inode *inode)
22{ 10{
23 int err = minix_add_link(dentry, inode); 11 int err = minix_add_link(dentry, inode);
@@ -25,7 +13,7 @@ static int add_nondir(struct dentry *dentry, struct inode *inode)
25 d_instantiate(dentry, inode); 13 d_instantiate(dentry, inode);
26 return 0; 14 return 0;
27 } 15 }
28 dec_count(inode); 16 inode_dec_link_count(inode);
29 iput(inode); 17 iput(inode);
30 return err; 18 return err;
31} 19}
@@ -125,7 +113,7 @@ out:
125 return err; 113 return err;
126 114
127out_fail: 115out_fail:
128 dec_count(inode); 116 inode_dec_link_count(inode);
129 iput(inode); 117 iput(inode);
130 goto out; 118 goto out;
131} 119}
@@ -139,7 +127,7 @@ static int minix_link(struct dentry * old_dentry, struct inode * dir,
139 return -EMLINK; 127 return -EMLINK;
140 128
141 inode->i_ctime = CURRENT_TIME_SEC; 129 inode->i_ctime = CURRENT_TIME_SEC;
142 inc_count(inode); 130 inode_inc_link_count(inode);
143 atomic_inc(&inode->i_count); 131 atomic_inc(&inode->i_count);
144 return add_nondir(dentry, inode); 132 return add_nondir(dentry, inode);
145} 133}
@@ -152,7 +140,7 @@ static int minix_mkdir(struct inode * dir, struct dentry *dentry, int mode)
152 if (dir->i_nlink >= minix_sb(dir->i_sb)->s_link_max) 140 if (dir->i_nlink >= minix_sb(dir->i_sb)->s_link_max)
153 goto out; 141 goto out;
154 142
155 inc_count(dir); 143 inode_inc_link_count(dir);
156 144
157 inode = minix_new_inode(dir, &err); 145 inode = minix_new_inode(dir, &err);
158 if (!inode) 146 if (!inode)
@@ -163,7 +151,7 @@ static int minix_mkdir(struct inode * dir, struct dentry *dentry, int mode)
163 inode->i_mode |= S_ISGID; 151 inode->i_mode |= S_ISGID;
164 minix_set_inode(inode, 0); 152 minix_set_inode(inode, 0);
165 153
166 inc_count(inode); 154 inode_inc_link_count(inode);
167 155
168 err = minix_make_empty(inode, dir); 156 err = minix_make_empty(inode, dir);
169 if (err) 157 if (err)
@@ -178,11 +166,11 @@ out:
178 return err; 166 return err;
179 167
180out_fail: 168out_fail:
181 dec_count(inode); 169 inode_dec_link_count(inode);
182 dec_count(inode); 170 inode_dec_link_count(inode);
183 iput(inode); 171 iput(inode);
184out_dir: 172out_dir:
185 dec_count(dir); 173 inode_dec_link_count(dir);
186 goto out; 174 goto out;
187} 175}
188 176
@@ -202,7 +190,7 @@ static int minix_unlink(struct inode * dir, struct dentry *dentry)
202 goto end_unlink; 190 goto end_unlink;
203 191
204 inode->i_ctime = dir->i_ctime; 192 inode->i_ctime = dir->i_ctime;
205 dec_count(inode); 193 inode_dec_link_count(inode);
206end_unlink: 194end_unlink:
207 return err; 195 return err;
208} 196}
@@ -215,8 +203,8 @@ static int minix_rmdir(struct inode * dir, struct dentry *dentry)
215 if (minix_empty_dir(inode)) { 203 if (minix_empty_dir(inode)) {
216 err = minix_unlink(dir, dentry); 204 err = minix_unlink(dir, dentry);
217 if (!err) { 205 if (!err) {
218 dec_count(dir); 206 inode_dec_link_count(dir);
219 dec_count(inode); 207 inode_dec_link_count(inode);
220 } 208 }
221 } 209 }
222 return err; 210 return err;
@@ -257,34 +245,34 @@ static int minix_rename(struct inode * old_dir, struct dentry *old_dentry,
257 new_de = minix_find_entry(new_dentry, &new_page); 245 new_de = minix_find_entry(new_dentry, &new_page);
258 if (!new_de) 246 if (!new_de)
259 goto out_dir; 247 goto out_dir;
260 inc_count(old_inode); 248 inode_inc_link_count(old_inode);
261 minix_set_link(new_de, new_page, old_inode); 249 minix_set_link(new_de, new_page, old_inode);
262 new_inode->i_ctime = CURRENT_TIME_SEC; 250 new_inode->i_ctime = CURRENT_TIME_SEC;
263 if (dir_de) 251 if (dir_de)
264 new_inode->i_nlink--; 252 new_inode->i_nlink--;
265 dec_count(new_inode); 253 inode_dec_link_count(new_inode);
266 } else { 254 } else {
267 if (dir_de) { 255 if (dir_de) {
268 err = -EMLINK; 256 err = -EMLINK;
269 if (new_dir->i_nlink >= info->s_link_max) 257 if (new_dir->i_nlink >= info->s_link_max)
270 goto out_dir; 258 goto out_dir;
271 } 259 }
272 inc_count(old_inode); 260 inode_inc_link_count(old_inode);
273 err = minix_add_link(new_dentry, old_inode); 261 err = minix_add_link(new_dentry, old_inode);
274 if (err) { 262 if (err) {
275 dec_count(old_inode); 263 inode_dec_link_count(old_inode);
276 goto out_dir; 264 goto out_dir;
277 } 265 }
278 if (dir_de) 266 if (dir_de)
279 inc_count(new_dir); 267 inode_inc_link_count(new_dir);
280 } 268 }
281 269
282 minix_delete_entry(old_de, old_page); 270 minix_delete_entry(old_de, old_page);
283 dec_count(old_inode); 271 inode_dec_link_count(old_inode);
284 272
285 if (dir_de) { 273 if (dir_de) {
286 minix_set_link(dir_de, dir_page, new_dir); 274 minix_set_link(dir_de, dir_page, new_dir);
287 dec_count(old_dir); 275 inode_dec_link_count(old_dir);
288 } 276 }
289 return 0; 277 return 0;
290 278