diff options
Diffstat (limited to 'fs')
85 files changed, 1111 insertions, 803 deletions
diff --git a/fs/affs/affs.h b/fs/affs/affs.h index 25b23b1e7f22..9bca88159725 100644 --- a/fs/affs/affs.h +++ b/fs/affs/affs.h | |||
@@ -1,3 +1,9 @@ | |||
1 | #ifdef pr_fmt | ||
2 | #undef pr_fmt | ||
3 | #endif | ||
4 | |||
5 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
6 | |||
1 | #include <linux/types.h> | 7 | #include <linux/types.h> |
2 | #include <linux/fs.h> | 8 | #include <linux/fs.h> |
3 | #include <linux/buffer_head.h> | 9 | #include <linux/buffer_head.h> |
@@ -206,7 +212,7 @@ affs_set_blocksize(struct super_block *sb, int size) | |||
206 | static inline struct buffer_head * | 212 | static inline struct buffer_head * |
207 | affs_bread(struct super_block *sb, int block) | 213 | affs_bread(struct super_block *sb, int block) |
208 | { | 214 | { |
209 | pr_debug("affs_bread: %d\n", block); | 215 | pr_debug("%s: %d\n", __func__, block); |
210 | if (block >= AFFS_SB(sb)->s_reserved && block < AFFS_SB(sb)->s_partition_size) | 216 | if (block >= AFFS_SB(sb)->s_reserved && block < AFFS_SB(sb)->s_partition_size) |
211 | return sb_bread(sb, block); | 217 | return sb_bread(sb, block); |
212 | return NULL; | 218 | return NULL; |
@@ -214,7 +220,7 @@ affs_bread(struct super_block *sb, int block) | |||
214 | static inline struct buffer_head * | 220 | static inline struct buffer_head * |
215 | affs_getblk(struct super_block *sb, int block) | 221 | affs_getblk(struct super_block *sb, int block) |
216 | { | 222 | { |
217 | pr_debug("affs_getblk: %d\n", block); | 223 | pr_debug("%s: %d\n", __func__, block); |
218 | if (block >= AFFS_SB(sb)->s_reserved && block < AFFS_SB(sb)->s_partition_size) | 224 | if (block >= AFFS_SB(sb)->s_reserved && block < AFFS_SB(sb)->s_partition_size) |
219 | return sb_getblk(sb, block); | 225 | return sb_getblk(sb, block); |
220 | return NULL; | 226 | return NULL; |
@@ -223,7 +229,7 @@ static inline struct buffer_head * | |||
223 | affs_getzeroblk(struct super_block *sb, int block) | 229 | affs_getzeroblk(struct super_block *sb, int block) |
224 | { | 230 | { |
225 | struct buffer_head *bh; | 231 | struct buffer_head *bh; |
226 | pr_debug("affs_getzeroblk: %d\n", block); | 232 | pr_debug("%s: %d\n", __func__, block); |
227 | if (block >= AFFS_SB(sb)->s_reserved && block < AFFS_SB(sb)->s_partition_size) { | 233 | if (block >= AFFS_SB(sb)->s_reserved && block < AFFS_SB(sb)->s_partition_size) { |
228 | bh = sb_getblk(sb, block); | 234 | bh = sb_getblk(sb, block); |
229 | lock_buffer(bh); | 235 | lock_buffer(bh); |
@@ -238,7 +244,7 @@ static inline struct buffer_head * | |||
238 | affs_getemptyblk(struct super_block *sb, int block) | 244 | affs_getemptyblk(struct super_block *sb, int block) |
239 | { | 245 | { |
240 | struct buffer_head *bh; | 246 | struct buffer_head *bh; |
241 | pr_debug("affs_getemptyblk: %d\n", block); | 247 | pr_debug("%s: %d\n", __func__, block); |
242 | if (block >= AFFS_SB(sb)->s_reserved && block < AFFS_SB(sb)->s_partition_size) { | 248 | if (block >= AFFS_SB(sb)->s_reserved && block < AFFS_SB(sb)->s_partition_size) { |
243 | bh = sb_getblk(sb, block); | 249 | bh = sb_getblk(sb, block); |
244 | wait_on_buffer(bh); | 250 | wait_on_buffer(bh); |
@@ -251,7 +257,7 @@ static inline void | |||
251 | affs_brelse(struct buffer_head *bh) | 257 | affs_brelse(struct buffer_head *bh) |
252 | { | 258 | { |
253 | if (bh) | 259 | if (bh) |
254 | pr_debug("affs_brelse: %lld\n", (long long) bh->b_blocknr); | 260 | pr_debug("%s: %lld\n", __func__, (long long) bh->b_blocknr); |
255 | brelse(bh); | 261 | brelse(bh); |
256 | } | 262 | } |
257 | 263 | ||
diff --git a/fs/affs/amigaffs.c b/fs/affs/amigaffs.c index 533a322c41c0..406b29836b19 100644 --- a/fs/affs/amigaffs.c +++ b/fs/affs/amigaffs.c | |||
@@ -34,7 +34,7 @@ affs_insert_hash(struct inode *dir, struct buffer_head *bh) | |||
34 | ino = bh->b_blocknr; | 34 | ino = bh->b_blocknr; |
35 | offset = affs_hash_name(sb, AFFS_TAIL(sb, bh)->name + 1, AFFS_TAIL(sb, bh)->name[0]); | 35 | offset = affs_hash_name(sb, AFFS_TAIL(sb, bh)->name + 1, AFFS_TAIL(sb, bh)->name[0]); |
36 | 36 | ||
37 | pr_debug("AFFS: insert_hash(dir=%u, ino=%d)\n", (u32)dir->i_ino, ino); | 37 | pr_debug("%s(dir=%u, ino=%d)\n", __func__, (u32)dir->i_ino, ino); |
38 | 38 | ||
39 | dir_bh = affs_bread(sb, dir->i_ino); | 39 | dir_bh = affs_bread(sb, dir->i_ino); |
40 | if (!dir_bh) | 40 | if (!dir_bh) |
@@ -84,7 +84,8 @@ affs_remove_hash(struct inode *dir, struct buffer_head *rem_bh) | |||
84 | sb = dir->i_sb; | 84 | sb = dir->i_sb; |
85 | rem_ino = rem_bh->b_blocknr; | 85 | rem_ino = rem_bh->b_blocknr; |
86 | offset = affs_hash_name(sb, AFFS_TAIL(sb, rem_bh)->name+1, AFFS_TAIL(sb, rem_bh)->name[0]); | 86 | offset = affs_hash_name(sb, AFFS_TAIL(sb, rem_bh)->name+1, AFFS_TAIL(sb, rem_bh)->name[0]); |
87 | pr_debug("AFFS: remove_hash(dir=%d, ino=%d, hashval=%d)\n", (u32)dir->i_ino, rem_ino, offset); | 87 | pr_debug("%s(dir=%d, ino=%d, hashval=%d)\n", |
88 | __func__, (u32)dir->i_ino, rem_ino, offset); | ||
88 | 89 | ||
89 | bh = affs_bread(sb, dir->i_ino); | 90 | bh = affs_bread(sb, dir->i_ino); |
90 | if (!bh) | 91 | if (!bh) |
@@ -147,7 +148,7 @@ affs_remove_link(struct dentry *dentry) | |||
147 | u32 link_ino, ino; | 148 | u32 link_ino, ino; |
148 | int retval; | 149 | int retval; |
149 | 150 | ||
150 | pr_debug("AFFS: remove_link(key=%ld)\n", inode->i_ino); | 151 | pr_debug("%s(key=%ld)\n", __func__, inode->i_ino); |
151 | retval = -EIO; | 152 | retval = -EIO; |
152 | bh = affs_bread(sb, inode->i_ino); | 153 | bh = affs_bread(sb, inode->i_ino); |
153 | if (!bh) | 154 | if (!bh) |
@@ -279,7 +280,7 @@ affs_remove_header(struct dentry *dentry) | |||
279 | if (!inode) | 280 | if (!inode) |
280 | goto done; | 281 | goto done; |
281 | 282 | ||
282 | pr_debug("AFFS: remove_header(key=%ld)\n", inode->i_ino); | 283 | pr_debug("%s(key=%ld)\n", __func__, inode->i_ino); |
283 | retval = -EIO; | 284 | retval = -EIO; |
284 | bh = affs_bread(sb, (u32)(long)dentry->d_fsdata); | 285 | bh = affs_bread(sb, (u32)(long)dentry->d_fsdata); |
285 | if (!bh) | 286 | if (!bh) |
@@ -451,10 +452,10 @@ affs_error(struct super_block *sb, const char *function, const char *fmt, ...) | |||
451 | vsnprintf(ErrorBuffer,sizeof(ErrorBuffer),fmt,args); | 452 | vsnprintf(ErrorBuffer,sizeof(ErrorBuffer),fmt,args); |
452 | va_end(args); | 453 | va_end(args); |
453 | 454 | ||
454 | printk(KERN_CRIT "AFFS error (device %s): %s(): %s\n", sb->s_id, | 455 | pr_crit("error (device %s): %s(): %s\n", sb->s_id, |
455 | function,ErrorBuffer); | 456 | function,ErrorBuffer); |
456 | if (!(sb->s_flags & MS_RDONLY)) | 457 | if (!(sb->s_flags & MS_RDONLY)) |
457 | printk(KERN_WARNING "AFFS: Remounting filesystem read-only\n"); | 458 | pr_warn("Remounting filesystem read-only\n"); |
458 | sb->s_flags |= MS_RDONLY; | 459 | sb->s_flags |= MS_RDONLY; |
459 | } | 460 | } |
460 | 461 | ||
@@ -467,7 +468,7 @@ affs_warning(struct super_block *sb, const char *function, const char *fmt, ...) | |||
467 | vsnprintf(ErrorBuffer,sizeof(ErrorBuffer),fmt,args); | 468 | vsnprintf(ErrorBuffer,sizeof(ErrorBuffer),fmt,args); |
468 | va_end(args); | 469 | va_end(args); |
469 | 470 | ||
470 | printk(KERN_WARNING "AFFS warning (device %s): %s(): %s\n", sb->s_id, | 471 | pr_warn("(device %s): %s(): %s\n", sb->s_id, |
471 | function,ErrorBuffer); | 472 | function,ErrorBuffer); |
472 | } | 473 | } |
473 | 474 | ||
diff --git a/fs/affs/bitmap.c b/fs/affs/bitmap.c index a32246b8359e..c8de51185c23 100644 --- a/fs/affs/bitmap.c +++ b/fs/affs/bitmap.c | |||
@@ -17,7 +17,7 @@ affs_count_free_blocks(struct super_block *sb) | |||
17 | u32 free; | 17 | u32 free; |
18 | int i; | 18 | int i; |
19 | 19 | ||
20 | pr_debug("AFFS: count_free_blocks()\n"); | 20 | pr_debug("%s()\n", __func__); |
21 | 21 | ||
22 | if (sb->s_flags & MS_RDONLY) | 22 | if (sb->s_flags & MS_RDONLY) |
23 | return 0; | 23 | return 0; |
@@ -43,7 +43,7 @@ affs_free_block(struct super_block *sb, u32 block) | |||
43 | u32 blk, bmap, bit, mask, tmp; | 43 | u32 blk, bmap, bit, mask, tmp; |
44 | __be32 *data; | 44 | __be32 *data; |
45 | 45 | ||
46 | pr_debug("AFFS: free_block(%u)\n", block); | 46 | pr_debug("%s(%u)\n", __func__, block); |
47 | 47 | ||
48 | if (block > sbi->s_partition_size) | 48 | if (block > sbi->s_partition_size) |
49 | goto err_range; | 49 | goto err_range; |
@@ -125,7 +125,7 @@ affs_alloc_block(struct inode *inode, u32 goal) | |||
125 | sb = inode->i_sb; | 125 | sb = inode->i_sb; |
126 | sbi = AFFS_SB(sb); | 126 | sbi = AFFS_SB(sb); |
127 | 127 | ||
128 | pr_debug("AFFS: balloc(inode=%lu,goal=%u): ", inode->i_ino, goal); | 128 | pr_debug("balloc(inode=%lu,goal=%u): ", inode->i_ino, goal); |
129 | 129 | ||
130 | if (AFFS_I(inode)->i_pa_cnt) { | 130 | if (AFFS_I(inode)->i_pa_cnt) { |
131 | pr_debug("%d\n", AFFS_I(inode)->i_lastalloc+1); | 131 | pr_debug("%d\n", AFFS_I(inode)->i_lastalloc+1); |
@@ -254,8 +254,7 @@ int affs_init_bitmap(struct super_block *sb, int *flags) | |||
254 | return 0; | 254 | return 0; |
255 | 255 | ||
256 | if (!AFFS_ROOT_TAIL(sb, sbi->s_root_bh)->bm_flag) { | 256 | if (!AFFS_ROOT_TAIL(sb, sbi->s_root_bh)->bm_flag) { |
257 | printk(KERN_NOTICE "AFFS: Bitmap invalid - mounting %s read only\n", | 257 | pr_notice("Bitmap invalid - mounting %s read only\n", sb->s_id); |
258 | sb->s_id); | ||
259 | *flags |= MS_RDONLY; | 258 | *flags |= MS_RDONLY; |
260 | return 0; | 259 | return 0; |
261 | } | 260 | } |
@@ -268,7 +267,7 @@ int affs_init_bitmap(struct super_block *sb, int *flags) | |||
268 | size = sbi->s_bmap_count * sizeof(*bm); | 267 | size = sbi->s_bmap_count * sizeof(*bm); |
269 | bm = sbi->s_bitmap = kzalloc(size, GFP_KERNEL); | 268 | bm = sbi->s_bitmap = kzalloc(size, GFP_KERNEL); |
270 | if (!sbi->s_bitmap) { | 269 | if (!sbi->s_bitmap) { |
271 | printk(KERN_ERR "AFFS: Bitmap allocation failed\n"); | 270 | pr_err("Bitmap allocation failed\n"); |
272 | return -ENOMEM; | 271 | return -ENOMEM; |
273 | } | 272 | } |
274 | 273 | ||
@@ -282,17 +281,17 @@ int affs_init_bitmap(struct super_block *sb, int *flags) | |||
282 | bm->bm_key = be32_to_cpu(bmap_blk[blk]); | 281 | bm->bm_key = be32_to_cpu(bmap_blk[blk]); |
283 | bh = affs_bread(sb, bm->bm_key); | 282 | bh = affs_bread(sb, bm->bm_key); |
284 | if (!bh) { | 283 | if (!bh) { |
285 | printk(KERN_ERR "AFFS: Cannot read bitmap\n"); | 284 | pr_err("Cannot read bitmap\n"); |
286 | res = -EIO; | 285 | res = -EIO; |
287 | goto out; | 286 | goto out; |
288 | } | 287 | } |
289 | if (affs_checksum_block(sb, bh)) { | 288 | if (affs_checksum_block(sb, bh)) { |
290 | printk(KERN_WARNING "AFFS: Bitmap %u invalid - mounting %s read only.\n", | 289 | pr_warn("Bitmap %u invalid - mounting %s read only.\n", |
291 | bm->bm_key, sb->s_id); | 290 | bm->bm_key, sb->s_id); |
292 | *flags |= MS_RDONLY; | 291 | *flags |= MS_RDONLY; |
293 | goto out; | 292 | goto out; |
294 | } | 293 | } |
295 | pr_debug("AFFS: read bitmap block %d: %d\n", blk, bm->bm_key); | 294 | pr_debug("read bitmap block %d: %d\n", blk, bm->bm_key); |
296 | bm->bm_free = memweight(bh->b_data + 4, sb->s_blocksize - 4); | 295 | bm->bm_free = memweight(bh->b_data + 4, sb->s_blocksize - 4); |
297 | 296 | ||
298 | /* Don't try read the extension if this is the last block, | 297 | /* Don't try read the extension if this is the last block, |
@@ -304,7 +303,7 @@ int affs_init_bitmap(struct super_block *sb, int *flags) | |||
304 | affs_brelse(bmap_bh); | 303 | affs_brelse(bmap_bh); |
305 | bmap_bh = affs_bread(sb, be32_to_cpu(bmap_blk[blk])); | 304 | bmap_bh = affs_bread(sb, be32_to_cpu(bmap_blk[blk])); |
306 | if (!bmap_bh) { | 305 | if (!bmap_bh) { |
307 | printk(KERN_ERR "AFFS: Cannot read bitmap extension\n"); | 306 | pr_err("Cannot read bitmap extension\n"); |
308 | res = -EIO; | 307 | res = -EIO; |
309 | goto out; | 308 | goto out; |
310 | } | 309 | } |
diff --git a/fs/affs/dir.c b/fs/affs/dir.c index cbbda476a805..59f07bec92a6 100644 --- a/fs/affs/dir.c +++ b/fs/affs/dir.c | |||
@@ -54,8 +54,8 @@ affs_readdir(struct file *file, struct dir_context *ctx) | |||
54 | u32 ino; | 54 | u32 ino; |
55 | int error = 0; | 55 | int error = 0; |
56 | 56 | ||
57 | pr_debug("AFFS: readdir(ino=%lu,f_pos=%lx)\n", | 57 | pr_debug("%s(ino=%lu,f_pos=%lx)\n", |
58 | inode->i_ino, (unsigned long)ctx->pos); | 58 | __func__, inode->i_ino, (unsigned long)ctx->pos); |
59 | 59 | ||
60 | if (ctx->pos < 2) { | 60 | if (ctx->pos < 2) { |
61 | file->private_data = (void *)0; | 61 | file->private_data = (void *)0; |
@@ -81,7 +81,7 @@ affs_readdir(struct file *file, struct dir_context *ctx) | |||
81 | */ | 81 | */ |
82 | ino = (u32)(long)file->private_data; | 82 | ino = (u32)(long)file->private_data; |
83 | if (ino && file->f_version == inode->i_version) { | 83 | if (ino && file->f_version == inode->i_version) { |
84 | pr_debug("AFFS: readdir() left off=%d\n", ino); | 84 | pr_debug("readdir() left off=%d\n", ino); |
85 | goto inside; | 85 | goto inside; |
86 | } | 86 | } |
87 | 87 | ||
@@ -117,7 +117,7 @@ inside: | |||
117 | 117 | ||
118 | namelen = min(AFFS_TAIL(sb, fh_bh)->name[0], (u8)30); | 118 | namelen = min(AFFS_TAIL(sb, fh_bh)->name[0], (u8)30); |
119 | name = AFFS_TAIL(sb, fh_bh)->name + 1; | 119 | name = AFFS_TAIL(sb, fh_bh)->name + 1; |
120 | pr_debug("AFFS: readdir(): dir_emit(\"%.*s\", " | 120 | pr_debug("readdir(): dir_emit(\"%.*s\", " |
121 | "ino=%u), hash=%d, f_pos=%x\n", | 121 | "ino=%u), hash=%d, f_pos=%x\n", |
122 | namelen, name, ino, hash_pos, (u32)ctx->pos); | 122 | namelen, name, ino, hash_pos, (u32)ctx->pos); |
123 | 123 | ||
diff --git a/fs/affs/file.c b/fs/affs/file.c index 8669b6ecddee..0270303388ee 100644 --- a/fs/affs/file.c +++ b/fs/affs/file.c | |||
@@ -45,7 +45,7 @@ const struct inode_operations affs_file_inode_operations = { | |||
45 | static int | 45 | static int |
46 | affs_file_open(struct inode *inode, struct file *filp) | 46 | affs_file_open(struct inode *inode, struct file *filp) |
47 | { | 47 | { |
48 | pr_debug("AFFS: open(%lu,%d)\n", | 48 | pr_debug("open(%lu,%d)\n", |
49 | inode->i_ino, atomic_read(&AFFS_I(inode)->i_opencnt)); | 49 | inode->i_ino, atomic_read(&AFFS_I(inode)->i_opencnt)); |
50 | atomic_inc(&AFFS_I(inode)->i_opencnt); | 50 | atomic_inc(&AFFS_I(inode)->i_opencnt); |
51 | return 0; | 51 | return 0; |
@@ -54,7 +54,7 @@ affs_file_open(struct inode *inode, struct file *filp) | |||
54 | static int | 54 | static int |
55 | affs_file_release(struct inode *inode, struct file *filp) | 55 | affs_file_release(struct inode *inode, struct file *filp) |
56 | { | 56 | { |
57 | pr_debug("AFFS: release(%lu, %d)\n", | 57 | pr_debug("release(%lu, %d)\n", |
58 | inode->i_ino, atomic_read(&AFFS_I(inode)->i_opencnt)); | 58 | inode->i_ino, atomic_read(&AFFS_I(inode)->i_opencnt)); |
59 | 59 | ||
60 | if (atomic_dec_and_test(&AFFS_I(inode)->i_opencnt)) { | 60 | if (atomic_dec_and_test(&AFFS_I(inode)->i_opencnt)) { |
@@ -324,7 +324,8 @@ affs_get_block(struct inode *inode, sector_t block, struct buffer_head *bh_resul | |||
324 | struct buffer_head *ext_bh; | 324 | struct buffer_head *ext_bh; |
325 | u32 ext; | 325 | u32 ext; |
326 | 326 | ||
327 | pr_debug("AFFS: get_block(%u, %lu)\n", (u32)inode->i_ino, (unsigned long)block); | 327 | pr_debug("%s(%u, %lu)\n", |
328 | __func__, (u32)inode->i_ino, (unsigned long)block); | ||
328 | 329 | ||
329 | BUG_ON(block > (sector_t)0x7fffffffUL); | 330 | BUG_ON(block > (sector_t)0x7fffffffUL); |
330 | 331 | ||
@@ -498,34 +499,36 @@ affs_getemptyblk_ino(struct inode *inode, int block) | |||
498 | } | 499 | } |
499 | 500 | ||
500 | static int | 501 | static int |
501 | affs_do_readpage_ofs(struct file *file, struct page *page, unsigned from, unsigned to) | 502 | affs_do_readpage_ofs(struct page *page, unsigned to) |
502 | { | 503 | { |
503 | struct inode *inode = page->mapping->host; | 504 | struct inode *inode = page->mapping->host; |
504 | struct super_block *sb = inode->i_sb; | 505 | struct super_block *sb = inode->i_sb; |
505 | struct buffer_head *bh; | 506 | struct buffer_head *bh; |
506 | char *data; | 507 | char *data; |
508 | unsigned pos = 0; | ||
507 | u32 bidx, boff, bsize; | 509 | u32 bidx, boff, bsize; |
508 | u32 tmp; | 510 | u32 tmp; |
509 | 511 | ||
510 | pr_debug("AFFS: read_page(%u, %ld, %d, %d)\n", (u32)inode->i_ino, page->index, from, to); | 512 | pr_debug("%s(%u, %ld, 0, %d)\n", __func__, (u32)inode->i_ino, |
511 | BUG_ON(from > to || to > PAGE_CACHE_SIZE); | 513 | page->index, to); |
514 | BUG_ON(to > PAGE_CACHE_SIZE); | ||
512 | kmap(page); | 515 | kmap(page); |
513 | data = page_address(page); | 516 | data = page_address(page); |
514 | bsize = AFFS_SB(sb)->s_data_blksize; | 517 | bsize = AFFS_SB(sb)->s_data_blksize; |
515 | tmp = (page->index << PAGE_CACHE_SHIFT) + from; | 518 | tmp = page->index << PAGE_CACHE_SHIFT; |
516 | bidx = tmp / bsize; | 519 | bidx = tmp / bsize; |
517 | boff = tmp % bsize; | 520 | boff = tmp % bsize; |
518 | 521 | ||
519 | while (from < to) { | 522 | while (pos < to) { |
520 | bh = affs_bread_ino(inode, bidx, 0); | 523 | bh = affs_bread_ino(inode, bidx, 0); |
521 | if (IS_ERR(bh)) | 524 | if (IS_ERR(bh)) |
522 | return PTR_ERR(bh); | 525 | return PTR_ERR(bh); |
523 | tmp = min(bsize - boff, to - from); | 526 | tmp = min(bsize - boff, to - pos); |
524 | BUG_ON(from + tmp > to || tmp > bsize); | 527 | BUG_ON(pos + tmp > to || tmp > bsize); |
525 | memcpy(data + from, AFFS_DATA(bh) + boff, tmp); | 528 | memcpy(data + pos, AFFS_DATA(bh) + boff, tmp); |
526 | affs_brelse(bh); | 529 | affs_brelse(bh); |
527 | bidx++; | 530 | bidx++; |
528 | from += tmp; | 531 | pos += tmp; |
529 | boff = 0; | 532 | boff = 0; |
530 | } | 533 | } |
531 | flush_dcache_page(page); | 534 | flush_dcache_page(page); |
@@ -542,7 +545,7 @@ affs_extent_file_ofs(struct inode *inode, u32 newsize) | |||
542 | u32 size, bsize; | 545 | u32 size, bsize; |
543 | u32 tmp; | 546 | u32 tmp; |
544 | 547 | ||
545 | pr_debug("AFFS: extent_file(%u, %d)\n", (u32)inode->i_ino, newsize); | 548 | pr_debug("%s(%u, %d)\n", __func__, (u32)inode->i_ino, newsize); |
546 | bsize = AFFS_SB(sb)->s_data_blksize; | 549 | bsize = AFFS_SB(sb)->s_data_blksize; |
547 | bh = NULL; | 550 | bh = NULL; |
548 | size = AFFS_I(inode)->mmu_private; | 551 | size = AFFS_I(inode)->mmu_private; |
@@ -608,14 +611,14 @@ affs_readpage_ofs(struct file *file, struct page *page) | |||
608 | u32 to; | 611 | u32 to; |
609 | int err; | 612 | int err; |
610 | 613 | ||
611 | pr_debug("AFFS: read_page(%u, %ld)\n", (u32)inode->i_ino, page->index); | 614 | pr_debug("%s(%u, %ld)\n", __func__, (u32)inode->i_ino, page->index); |
612 | to = PAGE_CACHE_SIZE; | 615 | to = PAGE_CACHE_SIZE; |
613 | if (((page->index + 1) << PAGE_CACHE_SHIFT) > inode->i_size) { | 616 | if (((page->index + 1) << PAGE_CACHE_SHIFT) > inode->i_size) { |
614 | to = inode->i_size & ~PAGE_CACHE_MASK; | 617 | to = inode->i_size & ~PAGE_CACHE_MASK; |
615 | memset(page_address(page) + to, 0, PAGE_CACHE_SIZE - to); | 618 | memset(page_address(page) + to, 0, PAGE_CACHE_SIZE - to); |
616 | } | 619 | } |
617 | 620 | ||
618 | err = affs_do_readpage_ofs(file, page, 0, to); | 621 | err = affs_do_readpage_ofs(page, to); |
619 | if (!err) | 622 | if (!err) |
620 | SetPageUptodate(page); | 623 | SetPageUptodate(page); |
621 | unlock_page(page); | 624 | unlock_page(page); |
@@ -631,7 +634,8 @@ static int affs_write_begin_ofs(struct file *file, struct address_space *mapping | |||
631 | pgoff_t index; | 634 | pgoff_t index; |
632 | int err = 0; | 635 | int err = 0; |
633 | 636 | ||
634 | pr_debug("AFFS: write_begin(%u, %llu, %llu)\n", (u32)inode->i_ino, (unsigned long long)pos, (unsigned long long)pos + len); | 637 | pr_debug("%s(%u, %llu, %llu)\n", __func__, (u32)inode->i_ino, |
638 | (unsigned long long)pos, (unsigned long long)pos + len); | ||
635 | if (pos > AFFS_I(inode)->mmu_private) { | 639 | if (pos > AFFS_I(inode)->mmu_private) { |
636 | /* XXX: this probably leaves a too-big i_size in case of | 640 | /* XXX: this probably leaves a too-big i_size in case of |
637 | * failure. Should really be updating i_size at write_end time | 641 | * failure. Should really be updating i_size at write_end time |
@@ -651,7 +655,7 @@ static int affs_write_begin_ofs(struct file *file, struct address_space *mapping | |||
651 | return 0; | 655 | return 0; |
652 | 656 | ||
653 | /* XXX: inefficient but safe in the face of short writes */ | 657 | /* XXX: inefficient but safe in the face of short writes */ |
654 | err = affs_do_readpage_ofs(file, page, 0, PAGE_CACHE_SIZE); | 658 | err = affs_do_readpage_ofs(page, PAGE_CACHE_SIZE); |
655 | if (err) { | 659 | if (err) { |
656 | unlock_page(page); | 660 | unlock_page(page); |
657 | page_cache_release(page); | 661 | page_cache_release(page); |
@@ -680,7 +684,9 @@ static int affs_write_end_ofs(struct file *file, struct address_space *mapping, | |||
680 | * due to write_begin. | 684 | * due to write_begin. |
681 | */ | 685 | */ |
682 | 686 | ||
683 | pr_debug("AFFS: write_begin(%u, %llu, %llu)\n", (u32)inode->i_ino, (unsigned long long)pos, (unsigned long long)pos + len); | 687 | pr_debug("%s(%u, %llu, %llu)\n", |
688 | __func__, (u32)inode->i_ino, (unsigned long long)pos, | ||
689 | (unsigned long long)pos + len); | ||
684 | bsize = AFFS_SB(sb)->s_data_blksize; | 690 | bsize = AFFS_SB(sb)->s_data_blksize; |
685 | data = page_address(page); | 691 | data = page_address(page); |
686 | 692 | ||
@@ -802,7 +808,7 @@ affs_free_prealloc(struct inode *inode) | |||
802 | { | 808 | { |
803 | struct super_block *sb = inode->i_sb; | 809 | struct super_block *sb = inode->i_sb; |
804 | 810 | ||
805 | pr_debug("AFFS: free_prealloc(ino=%lu)\n", inode->i_ino); | 811 | pr_debug("free_prealloc(ino=%lu)\n", inode->i_ino); |
806 | 812 | ||
807 | while (AFFS_I(inode)->i_pa_cnt) { | 813 | while (AFFS_I(inode)->i_pa_cnt) { |
808 | AFFS_I(inode)->i_pa_cnt--; | 814 | AFFS_I(inode)->i_pa_cnt--; |
@@ -822,7 +828,7 @@ affs_truncate(struct inode *inode) | |||
822 | struct buffer_head *ext_bh; | 828 | struct buffer_head *ext_bh; |
823 | int i; | 829 | int i; |
824 | 830 | ||
825 | pr_debug("AFFS: truncate(inode=%d, oldsize=%u, newsize=%u)\n", | 831 | pr_debug("truncate(inode=%d, oldsize=%u, newsize=%u)\n", |
826 | (u32)inode->i_ino, (u32)AFFS_I(inode)->mmu_private, (u32)inode->i_size); | 832 | (u32)inode->i_ino, (u32)AFFS_I(inode)->mmu_private, (u32)inode->i_size); |
827 | 833 | ||
828 | last_blk = 0; | 834 | last_blk = 0; |
diff --git a/fs/affs/inode.c b/fs/affs/inode.c index 96df91e8c334..bec2d1a0c91c 100644 --- a/fs/affs/inode.c +++ b/fs/affs/inode.c | |||
@@ -34,7 +34,7 @@ struct inode *affs_iget(struct super_block *sb, unsigned long ino) | |||
34 | if (!(inode->i_state & I_NEW)) | 34 | if (!(inode->i_state & I_NEW)) |
35 | return inode; | 35 | return inode; |
36 | 36 | ||
37 | pr_debug("AFFS: affs_iget(%lu)\n", inode->i_ino); | 37 | pr_debug("affs_iget(%lu)\n", inode->i_ino); |
38 | 38 | ||
39 | block = inode->i_ino; | 39 | block = inode->i_ino; |
40 | bh = affs_bread(sb, block); | 40 | bh = affs_bread(sb, block); |
@@ -175,7 +175,7 @@ affs_write_inode(struct inode *inode, struct writeback_control *wbc) | |||
175 | uid_t uid; | 175 | uid_t uid; |
176 | gid_t gid; | 176 | gid_t gid; |
177 | 177 | ||
178 | pr_debug("AFFS: write_inode(%lu)\n",inode->i_ino); | 178 | pr_debug("write_inode(%lu)\n", inode->i_ino); |
179 | 179 | ||
180 | if (!inode->i_nlink) | 180 | if (!inode->i_nlink) |
181 | // possibly free block | 181 | // possibly free block |
@@ -220,7 +220,7 @@ affs_notify_change(struct dentry *dentry, struct iattr *attr) | |||
220 | struct inode *inode = dentry->d_inode; | 220 | struct inode *inode = dentry->d_inode; |
221 | int error; | 221 | int error; |
222 | 222 | ||
223 | pr_debug("AFFS: notify_change(%lu,0x%x)\n",inode->i_ino,attr->ia_valid); | 223 | pr_debug("notify_change(%lu,0x%x)\n", inode->i_ino, attr->ia_valid); |
224 | 224 | ||
225 | error = inode_change_ok(inode,attr); | 225 | error = inode_change_ok(inode,attr); |
226 | if (error) | 226 | if (error) |
@@ -258,7 +258,8 @@ void | |||
258 | affs_evict_inode(struct inode *inode) | 258 | affs_evict_inode(struct inode *inode) |
259 | { | 259 | { |
260 | unsigned long cache_page; | 260 | unsigned long cache_page; |
261 | pr_debug("AFFS: evict_inode(ino=%lu, nlink=%u)\n", inode->i_ino, inode->i_nlink); | 261 | pr_debug("evict_inode(ino=%lu, nlink=%u)\n", |
262 | inode->i_ino, inode->i_nlink); | ||
262 | truncate_inode_pages_final(&inode->i_data); | 263 | truncate_inode_pages_final(&inode->i_data); |
263 | 264 | ||
264 | if (!inode->i_nlink) { | 265 | if (!inode->i_nlink) { |
@@ -271,7 +272,7 @@ affs_evict_inode(struct inode *inode) | |||
271 | affs_free_prealloc(inode); | 272 | affs_free_prealloc(inode); |
272 | cache_page = (unsigned long)AFFS_I(inode)->i_lc; | 273 | cache_page = (unsigned long)AFFS_I(inode)->i_lc; |
273 | if (cache_page) { | 274 | if (cache_page) { |
274 | pr_debug("AFFS: freeing ext cache\n"); | 275 | pr_debug("freeing ext cache\n"); |
275 | AFFS_I(inode)->i_lc = NULL; | 276 | AFFS_I(inode)->i_lc = NULL; |
276 | AFFS_I(inode)->i_ac = NULL; | 277 | AFFS_I(inode)->i_ac = NULL; |
277 | free_page(cache_page); | 278 | free_page(cache_page); |
@@ -350,7 +351,8 @@ affs_add_entry(struct inode *dir, struct inode *inode, struct dentry *dentry, s3 | |||
350 | u32 block = 0; | 351 | u32 block = 0; |
351 | int retval; | 352 | int retval; |
352 | 353 | ||
353 | pr_debug("AFFS: add_entry(dir=%u, inode=%u, \"%*s\", type=%d)\n", (u32)dir->i_ino, | 354 | pr_debug("%s(dir=%u, inode=%u, \"%*s\", type=%d)\n", |
355 | __func__, (u32)dir->i_ino, | ||
354 | (u32)inode->i_ino, (int)dentry->d_name.len, dentry->d_name.name, type); | 356 | (u32)inode->i_ino, (int)dentry->d_name.len, dentry->d_name.name, type); |
355 | 357 | ||
356 | retval = -EIO; | 358 | retval = -EIO; |
diff --git a/fs/affs/namei.c b/fs/affs/namei.c index 6dae1ccd176d..035bd31556fc 100644 --- a/fs/affs/namei.c +++ b/fs/affs/namei.c | |||
@@ -190,7 +190,8 @@ affs_find_entry(struct inode *dir, struct dentry *dentry) | |||
190 | toupper_t toupper = affs_get_toupper(sb); | 190 | toupper_t toupper = affs_get_toupper(sb); |
191 | u32 key; | 191 | u32 key; |
192 | 192 | ||
193 | pr_debug("AFFS: find_entry(\"%.*s\")\n", (int)dentry->d_name.len, dentry->d_name.name); | 193 | pr_debug("%s(\"%.*s\")\n", |
194 | __func__, (int)dentry->d_name.len, dentry->d_name.name); | ||
194 | 195 | ||
195 | bh = affs_bread(sb, dir->i_ino); | 196 | bh = affs_bread(sb, dir->i_ino); |
196 | if (!bh) | 197 | if (!bh) |
@@ -218,7 +219,8 @@ affs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) | |||
218 | struct buffer_head *bh; | 219 | struct buffer_head *bh; |
219 | struct inode *inode = NULL; | 220 | struct inode *inode = NULL; |
220 | 221 | ||
221 | pr_debug("AFFS: lookup(\"%.*s\")\n",(int)dentry->d_name.len,dentry->d_name.name); | 222 | pr_debug("%s(\"%.*s\")\n", |
223 | __func__, (int)dentry->d_name.len, dentry->d_name.name); | ||
222 | 224 | ||
223 | affs_lock_dir(dir); | 225 | affs_lock_dir(dir); |
224 | bh = affs_find_entry(dir, dentry); | 226 | bh = affs_find_entry(dir, dentry); |
@@ -248,9 +250,9 @@ affs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) | |||
248 | int | 250 | int |
249 | affs_unlink(struct inode *dir, struct dentry *dentry) | 251 | affs_unlink(struct inode *dir, struct dentry *dentry) |
250 | { | 252 | { |
251 | pr_debug("AFFS: unlink(dir=%d, %lu \"%.*s\")\n", (u32)dir->i_ino, | 253 | pr_debug("%s(dir=%d, %lu \"%.*s\")\n", |
252 | dentry->d_inode->i_ino, | 254 | __func__, (u32)dir->i_ino, dentry->d_inode->i_ino, |
253 | (int)dentry->d_name.len, dentry->d_name.name); | 255 | (int)dentry->d_name.len, dentry->d_name.name); |
254 | 256 | ||
255 | return affs_remove_header(dentry); | 257 | return affs_remove_header(dentry); |
256 | } | 258 | } |
@@ -262,7 +264,8 @@ affs_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool excl) | |||
262 | struct inode *inode; | 264 | struct inode *inode; |
263 | int error; | 265 | int error; |
264 | 266 | ||
265 | pr_debug("AFFS: create(%lu,\"%.*s\",0%ho)\n",dir->i_ino,(int)dentry->d_name.len, | 267 | pr_debug("%s(%lu,\"%.*s\",0%ho)\n", |
268 | __func__, dir->i_ino, (int)dentry->d_name.len, | ||
266 | dentry->d_name.name,mode); | 269 | dentry->d_name.name,mode); |
267 | 270 | ||
268 | inode = affs_new_inode(dir); | 271 | inode = affs_new_inode(dir); |
@@ -291,8 +294,9 @@ affs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
291 | struct inode *inode; | 294 | struct inode *inode; |
292 | int error; | 295 | int error; |
293 | 296 | ||
294 | pr_debug("AFFS: mkdir(%lu,\"%.*s\",0%ho)\n",dir->i_ino, | 297 | pr_debug("%s(%lu,\"%.*s\",0%ho)\n", |
295 | (int)dentry->d_name.len,dentry->d_name.name,mode); | 298 | __func__, dir->i_ino, (int)dentry->d_name.len, |
299 | dentry->d_name.name, mode); | ||
296 | 300 | ||
297 | inode = affs_new_inode(dir); | 301 | inode = affs_new_inode(dir); |
298 | if (!inode) | 302 | if (!inode) |
@@ -317,8 +321,8 @@ affs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
317 | int | 321 | int |
318 | affs_rmdir(struct inode *dir, struct dentry *dentry) | 322 | affs_rmdir(struct inode *dir, struct dentry *dentry) |
319 | { | 323 | { |
320 | pr_debug("AFFS: rmdir(dir=%u, %lu \"%.*s\")\n", (u32)dir->i_ino, | 324 | pr_debug("%s(dir=%u, %lu \"%.*s\")\n", |
321 | dentry->d_inode->i_ino, | 325 | __func__, (u32)dir->i_ino, dentry->d_inode->i_ino, |
322 | (int)dentry->d_name.len, dentry->d_name.name); | 326 | (int)dentry->d_name.len, dentry->d_name.name); |
323 | 327 | ||
324 | return affs_remove_header(dentry); | 328 | return affs_remove_header(dentry); |
@@ -334,8 +338,9 @@ affs_symlink(struct inode *dir, struct dentry *dentry, const char *symname) | |||
334 | int i, maxlen, error; | 338 | int i, maxlen, error; |
335 | char c, lc; | 339 | char c, lc; |
336 | 340 | ||
337 | pr_debug("AFFS: symlink(%lu,\"%.*s\" -> \"%s\")\n",dir->i_ino, | 341 | pr_debug("%s(%lu,\"%.*s\" -> \"%s\")\n", |
338 | (int)dentry->d_name.len,dentry->d_name.name,symname); | 342 | __func__, dir->i_ino, (int)dentry->d_name.len, |
343 | dentry->d_name.name, symname); | ||
339 | 344 | ||
340 | maxlen = AFFS_SB(sb)->s_hashsize * sizeof(u32) - 1; | 345 | maxlen = AFFS_SB(sb)->s_hashsize * sizeof(u32) - 1; |
341 | inode = affs_new_inode(dir); | 346 | inode = affs_new_inode(dir); |
@@ -404,7 +409,8 @@ affs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) | |||
404 | { | 409 | { |
405 | struct inode *inode = old_dentry->d_inode; | 410 | struct inode *inode = old_dentry->d_inode; |
406 | 411 | ||
407 | pr_debug("AFFS: link(%u, %u, \"%.*s\")\n", (u32)inode->i_ino, (u32)dir->i_ino, | 412 | pr_debug("%s(%u, %u, \"%.*s\")\n", |
413 | __func__, (u32)inode->i_ino, (u32)dir->i_ino, | ||
408 | (int)dentry->d_name.len,dentry->d_name.name); | 414 | (int)dentry->d_name.len,dentry->d_name.name); |
409 | 415 | ||
410 | return affs_add_entry(dir, inode, dentry, ST_LINKFILE); | 416 | return affs_add_entry(dir, inode, dentry, ST_LINKFILE); |
@@ -418,9 +424,10 @@ affs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
418 | struct buffer_head *bh = NULL; | 424 | struct buffer_head *bh = NULL; |
419 | int retval; | 425 | int retval; |
420 | 426 | ||
421 | pr_debug("AFFS: rename(old=%u,\"%*s\" to new=%u,\"%*s\")\n", | 427 | pr_debug("%s(old=%u,\"%*s\" to new=%u,\"%*s\")\n", |
422 | (u32)old_dir->i_ino, (int)old_dentry->d_name.len, old_dentry->d_name.name, | 428 | __func__, (u32)old_dir->i_ino, (int)old_dentry->d_name.len, |
423 | (u32)new_dir->i_ino, (int)new_dentry->d_name.len, new_dentry->d_name.name); | 429 | old_dentry->d_name.name, (u32)new_dir->i_ino, |
430 | (int)new_dentry->d_name.len, new_dentry->d_name.name); | ||
424 | 431 | ||
425 | retval = affs_check_name(new_dentry->d_name.name, | 432 | retval = affs_check_name(new_dentry->d_name.name, |
426 | new_dentry->d_name.len, | 433 | new_dentry->d_name.len, |
diff --git a/fs/affs/super.c b/fs/affs/super.c index 895ac7dc9dbf..51f1a95bff73 100644 --- a/fs/affs/super.c +++ b/fs/affs/super.c | |||
@@ -46,7 +46,7 @@ static void | |||
46 | affs_put_super(struct super_block *sb) | 46 | affs_put_super(struct super_block *sb) |
47 | { | 47 | { |
48 | struct affs_sb_info *sbi = AFFS_SB(sb); | 48 | struct affs_sb_info *sbi = AFFS_SB(sb); |
49 | pr_debug("AFFS: put_super()\n"); | 49 | pr_debug("%s()\n", __func__); |
50 | 50 | ||
51 | cancel_delayed_work_sync(&sbi->sb_work); | 51 | cancel_delayed_work_sync(&sbi->sb_work); |
52 | } | 52 | } |
@@ -220,7 +220,7 @@ parse_options(char *options, kuid_t *uid, kgid_t *gid, int *mode, int *reserved, | |||
220 | return 0; | 220 | return 0; |
221 | if (n != 512 && n != 1024 && n != 2048 | 221 | if (n != 512 && n != 1024 && n != 2048 |
222 | && n != 4096) { | 222 | && n != 4096) { |
223 | printk ("AFFS: Invalid blocksize (512, 1024, 2048, 4096 allowed)\n"); | 223 | pr_warn("Invalid blocksize (512, 1024, 2048, 4096 allowed)\n"); |
224 | return 0; | 224 | return 0; |
225 | } | 225 | } |
226 | *blocksize = n; | 226 | *blocksize = n; |
@@ -285,8 +285,8 @@ parse_options(char *options, kuid_t *uid, kgid_t *gid, int *mode, int *reserved, | |||
285 | /* Silently ignore the quota options */ | 285 | /* Silently ignore the quota options */ |
286 | break; | 286 | break; |
287 | default: | 287 | default: |
288 | printk("AFFS: Unrecognized mount option \"%s\" " | 288 | pr_warn("Unrecognized mount option \"%s\" or missing value\n", |
289 | "or missing value\n", p); | 289 | p); |
290 | return 0; | 290 | return 0; |
291 | } | 291 | } |
292 | } | 292 | } |
@@ -319,7 +319,7 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent) | |||
319 | 319 | ||
320 | save_mount_options(sb, data); | 320 | save_mount_options(sb, data); |
321 | 321 | ||
322 | pr_debug("AFFS: read_super(%s)\n",data ? (const char *)data : "no options"); | 322 | pr_debug("read_super(%s)\n", data ? (const char *)data : "no options"); |
323 | 323 | ||
324 | sb->s_magic = AFFS_SUPER_MAGIC; | 324 | sb->s_magic = AFFS_SUPER_MAGIC; |
325 | sb->s_op = &affs_sops; | 325 | sb->s_op = &affs_sops; |
@@ -339,7 +339,7 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent) | |||
339 | if (!parse_options(data,&uid,&gid,&i,&reserved,&root_block, | 339 | if (!parse_options(data,&uid,&gid,&i,&reserved,&root_block, |
340 | &blocksize,&sbi->s_prefix, | 340 | &blocksize,&sbi->s_prefix, |
341 | sbi->s_volume, &mount_flags)) { | 341 | sbi->s_volume, &mount_flags)) { |
342 | printk(KERN_ERR "AFFS: Error parsing options\n"); | 342 | pr_err("Error parsing options\n"); |
343 | return -EINVAL; | 343 | return -EINVAL; |
344 | } | 344 | } |
345 | /* N.B. after this point s_prefix must be released */ | 345 | /* N.B. after this point s_prefix must be released */ |
@@ -356,7 +356,7 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent) | |||
356 | */ | 356 | */ |
357 | 357 | ||
358 | size = sb->s_bdev->bd_inode->i_size >> 9; | 358 | size = sb->s_bdev->bd_inode->i_size >> 9; |
359 | pr_debug("AFFS: initial blocksize=%d, #blocks=%d\n", 512, size); | 359 | pr_debug("initial blocksize=%d, #blocks=%d\n", 512, size); |
360 | 360 | ||
361 | affs_set_blocksize(sb, PAGE_SIZE); | 361 | affs_set_blocksize(sb, PAGE_SIZE); |
362 | /* Try to find root block. Its location depends on the block size. */ | 362 | /* Try to find root block. Its location depends on the block size. */ |
@@ -371,7 +371,7 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent) | |||
371 | sbi->s_root_block = root_block; | 371 | sbi->s_root_block = root_block; |
372 | if (root_block < 0) | 372 | if (root_block < 0) |
373 | sbi->s_root_block = (reserved + size - 1) / 2; | 373 | sbi->s_root_block = (reserved + size - 1) / 2; |
374 | pr_debug("AFFS: setting blocksize to %d\n", blocksize); | 374 | pr_debug("setting blocksize to %d\n", blocksize); |
375 | affs_set_blocksize(sb, blocksize); | 375 | affs_set_blocksize(sb, blocksize); |
376 | sbi->s_partition_size = size; | 376 | sbi->s_partition_size = size; |
377 | 377 | ||
@@ -386,7 +386,7 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent) | |||
386 | * block behind the calculated one. So we check this one, too. | 386 | * block behind the calculated one. So we check this one, too. |
387 | */ | 387 | */ |
388 | for (num_bm = 0; num_bm < 2; num_bm++) { | 388 | for (num_bm = 0; num_bm < 2; num_bm++) { |
389 | pr_debug("AFFS: Dev %s, trying root=%u, bs=%d, " | 389 | pr_debug("Dev %s, trying root=%u, bs=%d, " |
390 | "size=%d, reserved=%d\n", | 390 | "size=%d, reserved=%d\n", |
391 | sb->s_id, | 391 | sb->s_id, |
392 | sbi->s_root_block + num_bm, | 392 | sbi->s_root_block + num_bm, |
@@ -407,8 +407,7 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent) | |||
407 | } | 407 | } |
408 | } | 408 | } |
409 | if (!silent) | 409 | if (!silent) |
410 | printk(KERN_ERR "AFFS: No valid root block on device %s\n", | 410 | pr_err("No valid root block on device %s\n", sb->s_id); |
411 | sb->s_id); | ||
412 | return -EINVAL; | 411 | return -EINVAL; |
413 | 412 | ||
414 | /* N.B. after this point bh must be released */ | 413 | /* N.B. after this point bh must be released */ |
@@ -420,7 +419,7 @@ got_root: | |||
420 | /* Find out which kind of FS we have */ | 419 | /* Find out which kind of FS we have */ |
421 | boot_bh = sb_bread(sb, 0); | 420 | boot_bh = sb_bread(sb, 0); |
422 | if (!boot_bh) { | 421 | if (!boot_bh) { |
423 | printk(KERN_ERR "AFFS: Cannot read boot block\n"); | 422 | pr_err("Cannot read boot block\n"); |
424 | return -EINVAL; | 423 | return -EINVAL; |
425 | } | 424 | } |
426 | memcpy(sig, boot_bh->b_data, 4); | 425 | memcpy(sig, boot_bh->b_data, 4); |
@@ -433,8 +432,7 @@ got_root: | |||
433 | */ | 432 | */ |
434 | if ((chksum == FS_DCFFS || chksum == MUFS_DCFFS || chksum == FS_DCOFS | 433 | if ((chksum == FS_DCFFS || chksum == MUFS_DCFFS || chksum == FS_DCOFS |
435 | || chksum == MUFS_DCOFS) && !(sb->s_flags & MS_RDONLY)) { | 434 | || chksum == MUFS_DCOFS) && !(sb->s_flags & MS_RDONLY)) { |
436 | printk(KERN_NOTICE "AFFS: Dircache FS - mounting %s read only\n", | 435 | pr_notice("Dircache FS - mounting %s read only\n", sb->s_id); |
437 | sb->s_id); | ||
438 | sb->s_flags |= MS_RDONLY; | 436 | sb->s_flags |= MS_RDONLY; |
439 | } | 437 | } |
440 | switch (chksum) { | 438 | switch (chksum) { |
@@ -468,14 +466,14 @@ got_root: | |||
468 | sb->s_flags |= MS_NOEXEC; | 466 | sb->s_flags |= MS_NOEXEC; |
469 | break; | 467 | break; |
470 | default: | 468 | default: |
471 | printk(KERN_ERR "AFFS: Unknown filesystem on device %s: %08X\n", | 469 | pr_err("Unknown filesystem on device %s: %08X\n", |
472 | sb->s_id, chksum); | 470 | sb->s_id, chksum); |
473 | return -EINVAL; | 471 | return -EINVAL; |
474 | } | 472 | } |
475 | 473 | ||
476 | if (mount_flags & SF_VERBOSE) { | 474 | if (mount_flags & SF_VERBOSE) { |
477 | u8 len = AFFS_ROOT_TAIL(sb, root_bh)->disk_name[0]; | 475 | u8 len = AFFS_ROOT_TAIL(sb, root_bh)->disk_name[0]; |
478 | printk(KERN_NOTICE "AFFS: Mounting volume \"%.*s\": Type=%.3s\\%c, Blocksize=%d\n", | 476 | pr_notice("Mounting volume \"%.*s\": Type=%.3s\\%c, Blocksize=%d\n", |
479 | len > 31 ? 31 : len, | 477 | len > 31 ? 31 : len, |
480 | AFFS_ROOT_TAIL(sb, root_bh)->disk_name + 1, | 478 | AFFS_ROOT_TAIL(sb, root_bh)->disk_name + 1, |
481 | sig, sig[3] + '0', blocksize); | 479 | sig, sig[3] + '0', blocksize); |
@@ -506,11 +504,11 @@ got_root: | |||
506 | 504 | ||
507 | sb->s_root = d_make_root(root_inode); | 505 | sb->s_root = d_make_root(root_inode); |
508 | if (!sb->s_root) { | 506 | if (!sb->s_root) { |
509 | printk(KERN_ERR "AFFS: Get root inode failed\n"); | 507 | pr_err("AFFS: Get root inode failed\n"); |
510 | return -ENOMEM; | 508 | return -ENOMEM; |
511 | } | 509 | } |
512 | 510 | ||
513 | pr_debug("AFFS: s_flags=%lX\n",sb->s_flags); | 511 | pr_debug("s_flags=%lX\n", sb->s_flags); |
514 | return 0; | 512 | return 0; |
515 | } | 513 | } |
516 | 514 | ||
@@ -530,7 +528,7 @@ affs_remount(struct super_block *sb, int *flags, char *data) | |||
530 | char volume[32]; | 528 | char volume[32]; |
531 | char *prefix = NULL; | 529 | char *prefix = NULL; |
532 | 530 | ||
533 | pr_debug("AFFS: remount(flags=0x%x,opts=\"%s\")\n",*flags,data); | 531 | pr_debug("%s(flags=0x%x,opts=\"%s\")\n", __func__, *flags, data); |
534 | 532 | ||
535 | sync_filesystem(sb); | 533 | sync_filesystem(sb); |
536 | *flags |= MS_NODIRATIME; | 534 | *flags |= MS_NODIRATIME; |
@@ -578,8 +576,9 @@ affs_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
578 | int free; | 576 | int free; |
579 | u64 id = huge_encode_dev(sb->s_bdev->bd_dev); | 577 | u64 id = huge_encode_dev(sb->s_bdev->bd_dev); |
580 | 578 | ||
581 | pr_debug("AFFS: statfs() partsize=%d, reserved=%d\n",AFFS_SB(sb)->s_partition_size, | 579 | pr_debug("%s() partsize=%d, reserved=%d\n", |
582 | AFFS_SB(sb)->s_reserved); | 580 | __func__, AFFS_SB(sb)->s_partition_size, |
581 | AFFS_SB(sb)->s_reserved); | ||
583 | 582 | ||
584 | free = affs_count_free_blocks(sb); | 583 | free = affs_count_free_blocks(sb); |
585 | buf->f_type = AFFS_SUPER_MAGIC; | 584 | buf->f_type = AFFS_SUPER_MAGIC; |
diff --git a/fs/affs/symlink.c b/fs/affs/symlink.c index ee00f08c4f53..f39b71c3981e 100644 --- a/fs/affs/symlink.c +++ b/fs/affs/symlink.c | |||
@@ -21,7 +21,7 @@ static int affs_symlink_readpage(struct file *file, struct page *page) | |||
21 | char c; | 21 | char c; |
22 | char lc; | 22 | char lc; |
23 | 23 | ||
24 | pr_debug("AFFS: follow_link(ino=%lu)\n",inode->i_ino); | 24 | pr_debug("follow_link(ino=%lu)\n", inode->i_ino); |
25 | 25 | ||
26 | err = -EIO; | 26 | err = -EIO; |
27 | bh = affs_bread(inode->i_sb, inode->i_ino); | 27 | bh = affs_bread(inode->i_sb, inode->i_ino); |
diff --git a/fs/befs/btree.c b/fs/befs/btree.c index a2cd305a993a..9c7faa8a9288 100644 --- a/fs/befs/btree.c +++ b/fs/befs/btree.c | |||
@@ -318,7 +318,7 @@ befs_btree_find(struct super_block *sb, befs_data_stream * ds, | |||
318 | * befs_find_key - Search for a key within a node | 318 | * befs_find_key - Search for a key within a node |
319 | * @sb: Filesystem superblock | 319 | * @sb: Filesystem superblock |
320 | * @node: Node to find the key within | 320 | * @node: Node to find the key within |
321 | * @key: Keystring to search for | 321 | * @findkey: Keystring to search for |
322 | * @value: If key is found, the value stored with the key is put here | 322 | * @value: If key is found, the value stored with the key is put here |
323 | * | 323 | * |
324 | * finds exact match if one exists, and returns BEFS_BT_MATCH | 324 | * finds exact match if one exists, and returns BEFS_BT_MATCH |
@@ -405,7 +405,7 @@ befs_find_key(struct super_block *sb, befs_btree_node * node, | |||
405 | * Heres how it works: Key_no is the index of the key/value pair to | 405 | * Heres how it works: Key_no is the index of the key/value pair to |
406 | * return in keybuf/value. | 406 | * return in keybuf/value. |
407 | * Bufsize is the size of keybuf (BEFS_NAME_LEN+1 is a good size). Keysize is | 407 | * Bufsize is the size of keybuf (BEFS_NAME_LEN+1 is a good size). Keysize is |
408 | * the number of charecters in the key (just a convenience). | 408 | * the number of characters in the key (just a convenience). |
409 | * | 409 | * |
410 | * Algorithm: | 410 | * Algorithm: |
411 | * Get the first leafnode of the tree. See if the requested key is in that | 411 | * Get the first leafnode of the tree. See if the requested key is in that |
@@ -502,12 +502,11 @@ befs_btree_read(struct super_block *sb, befs_data_stream * ds, | |||
502 | "for key of size %d", __func__, bufsize, keylen); | 502 | "for key of size %d", __func__, bufsize, keylen); |
503 | brelse(this_node->bh); | 503 | brelse(this_node->bh); |
504 | goto error_alloc; | 504 | goto error_alloc; |
505 | }; | 505 | } |
506 | 506 | ||
507 | strncpy(keybuf, keystart, keylen); | 507 | strlcpy(keybuf, keystart, keylen + 1); |
508 | *value = fs64_to_cpu(sb, valarray[cur_key]); | 508 | *value = fs64_to_cpu(sb, valarray[cur_key]); |
509 | *keysize = keylen; | 509 | *keysize = keylen; |
510 | keybuf[keylen] = '\0'; | ||
511 | 510 | ||
512 | befs_debug(sb, "Read [%llu,%d]: Key \"%.*s\", Value %llu", node_off, | 511 | befs_debug(sb, "Read [%llu,%d]: Key \"%.*s\", Value %llu", node_off, |
513 | cur_key, keylen, keybuf, *value); | 512 | cur_key, keylen, keybuf, *value); |
@@ -707,7 +706,7 @@ befs_bt_get_key(struct super_block *sb, befs_btree_node * node, | |||
707 | * @key1: pointer to the first key to be compared | 706 | * @key1: pointer to the first key to be compared |
708 | * @keylen1: length in bytes of key1 | 707 | * @keylen1: length in bytes of key1 |
709 | * @key2: pointer to the second key to be compared | 708 | * @key2: pointer to the second key to be compared |
710 | * @kelen2: length in bytes of key2 | 709 | * @keylen2: length in bytes of key2 |
711 | * | 710 | * |
712 | * Returns 0 if @key1 and @key2 are equal. | 711 | * Returns 0 if @key1 and @key2 are equal. |
713 | * Returns >0 if @key1 is greater. | 712 | * Returns >0 if @key1 is greater. |
diff --git a/fs/befs/datastream.c b/fs/befs/datastream.c index c467bebd50af..1e8e0b8d8836 100644 --- a/fs/befs/datastream.c +++ b/fs/befs/datastream.c | |||
@@ -116,7 +116,7 @@ befs_fblock2brun(struct super_block *sb, befs_data_stream * data, | |||
116 | * befs_read_lsmylink - read long symlink from datastream. | 116 | * befs_read_lsmylink - read long symlink from datastream. |
117 | * @sb: Filesystem superblock | 117 | * @sb: Filesystem superblock |
118 | * @ds: Datastrem to read from | 118 | * @ds: Datastrem to read from |
119 | * @buf: Buffer in which to place long symlink data | 119 | * @buff: Buffer in which to place long symlink data |
120 | * @len: Length of the long symlink in bytes | 120 | * @len: Length of the long symlink in bytes |
121 | * | 121 | * |
122 | * Returns the number of bytes read | 122 | * Returns the number of bytes read |
diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index d626756ff721..a16fbd4e8241 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c | |||
@@ -133,14 +133,6 @@ befs_get_block(struct inode *inode, sector_t block, | |||
133 | 133 | ||
134 | befs_debug(sb, "---> befs_get_block() for inode %lu, block %ld", | 134 | befs_debug(sb, "---> befs_get_block() for inode %lu, block %ld", |
135 | (unsigned long)inode->i_ino, (long)block); | 135 | (unsigned long)inode->i_ino, (long)block); |
136 | |||
137 | if (block < 0) { | ||
138 | befs_error(sb, "befs_get_block() was asked for a block " | ||
139 | "number less than zero: block %ld in inode %lu", | ||
140 | (long)block, (unsigned long)inode->i_ino); | ||
141 | return -EIO; | ||
142 | } | ||
143 | |||
144 | if (create) { | 136 | if (create) { |
145 | befs_error(sb, "befs_get_block() was asked to write to " | 137 | befs_error(sb, "befs_get_block() was asked to write to " |
146 | "block %ld in inode %lu", (long)block, | 138 | "block %ld in inode %lu", (long)block, |
@@ -396,9 +388,8 @@ static struct inode *befs_iget(struct super_block *sb, unsigned long ino) | |||
396 | if (S_ISLNK(inode->i_mode) && !(befs_ino->i_flags & BEFS_LONG_SYMLINK)){ | 388 | if (S_ISLNK(inode->i_mode) && !(befs_ino->i_flags & BEFS_LONG_SYMLINK)){ |
397 | inode->i_size = 0; | 389 | inode->i_size = 0; |
398 | inode->i_blocks = befs_sb->block_size / VFS_BLOCK_SIZE; | 390 | inode->i_blocks = befs_sb->block_size / VFS_BLOCK_SIZE; |
399 | strncpy(befs_ino->i_data.symlink, raw_inode->data.symlink, | 391 | strlcpy(befs_ino->i_data.symlink, raw_inode->data.symlink, |
400 | BEFS_SYMLINK_LEN - 1); | 392 | BEFS_SYMLINK_LEN); |
401 | befs_ino->i_data.symlink[BEFS_SYMLINK_LEN - 1] = '\0'; | ||
402 | } else { | 393 | } else { |
403 | int num_blks; | 394 | int num_blks; |
404 | 395 | ||
@@ -591,21 +582,21 @@ befs_utf2nls(struct super_block *sb, const char *in, | |||
591 | /** | 582 | /** |
592 | * befs_nls2utf - Convert NLS string to utf8 encodeing | 583 | * befs_nls2utf - Convert NLS string to utf8 encodeing |
593 | * @sb: Superblock | 584 | * @sb: Superblock |
594 | * @src: Input string buffer in NLS format | 585 | * @in: Input string buffer in NLS format |
595 | * @srclen: Length of input string in bytes | 586 | * @in_len: Length of input string in bytes |
596 | * @dest: The output string in UTF-8 format | 587 | * @out: The output string in UTF-8 format |
597 | * @destlen: Length of the output buffer | 588 | * @out_len: Length of the output buffer |
598 | * | 589 | * |
599 | * Converts input string @src, which is in the format of the loaded NLS map, | 590 | * Converts input string @in, which is in the format of the loaded NLS map, |
600 | * into a utf8 string. | 591 | * into a utf8 string. |
601 | * | 592 | * |
602 | * The destination string @dest is allocated by this function and the caller is | 593 | * The destination string @out is allocated by this function and the caller is |
603 | * responsible for freeing it with kfree() | 594 | * responsible for freeing it with kfree() |
604 | * | 595 | * |
605 | * On return, *@destlen is the length of @dest in bytes. | 596 | * On return, *@out_len is the length of @out in bytes. |
606 | * | 597 | * |
607 | * On success, the return value is the number of utf8 characters written to | 598 | * On success, the return value is the number of utf8 characters written to |
608 | * the output buffer @dest. | 599 | * the output buffer @out. |
609 | * | 600 | * |
610 | * On Failure, a negative number coresponding to the error code is returned. | 601 | * On Failure, a negative number coresponding to the error code is returned. |
611 | */ | 602 | */ |
diff --git a/fs/cachefiles/bind.c b/fs/cachefiles/bind.c index 5b99bafc31d1..d749731dc0ee 100644 --- a/fs/cachefiles/bind.c +++ b/fs/cachefiles/bind.c | |||
@@ -50,18 +50,18 @@ int cachefiles_daemon_bind(struct cachefiles_cache *cache, char *args) | |||
50 | cache->brun_percent < 100); | 50 | cache->brun_percent < 100); |
51 | 51 | ||
52 | if (*args) { | 52 | if (*args) { |
53 | kerror("'bind' command doesn't take an argument"); | 53 | pr_err("'bind' command doesn't take an argument"); |
54 | return -EINVAL; | 54 | return -EINVAL; |
55 | } | 55 | } |
56 | 56 | ||
57 | if (!cache->rootdirname) { | 57 | if (!cache->rootdirname) { |
58 | kerror("No cache directory specified"); | 58 | pr_err("No cache directory specified"); |
59 | return -EINVAL; | 59 | return -EINVAL; |
60 | } | 60 | } |
61 | 61 | ||
62 | /* don't permit already bound caches to be re-bound */ | 62 | /* don't permit already bound caches to be re-bound */ |
63 | if (test_bit(CACHEFILES_READY, &cache->flags)) { | 63 | if (test_bit(CACHEFILES_READY, &cache->flags)) { |
64 | kerror("Cache already bound"); | 64 | pr_err("Cache already bound"); |
65 | return -EBUSY; | 65 | return -EBUSY; |
66 | } | 66 | } |
67 | 67 | ||
@@ -228,9 +228,7 @@ static int cachefiles_daemon_add_cache(struct cachefiles_cache *cache) | |||
228 | set_bit(CACHEFILES_READY, &cache->flags); | 228 | set_bit(CACHEFILES_READY, &cache->flags); |
229 | dput(root); | 229 | dput(root); |
230 | 230 | ||
231 | printk(KERN_INFO "CacheFiles:" | 231 | pr_info("File cache on %s registered\n", cache->cache.identifier); |
232 | " File cache on %s registered\n", | ||
233 | cache->cache.identifier); | ||
234 | 232 | ||
235 | /* check how much space the cache has */ | 233 | /* check how much space the cache has */ |
236 | cachefiles_has_space(cache, 0, 0); | 234 | cachefiles_has_space(cache, 0, 0); |
@@ -250,7 +248,7 @@ error_open_root: | |||
250 | kmem_cache_free(cachefiles_object_jar, fsdef); | 248 | kmem_cache_free(cachefiles_object_jar, fsdef); |
251 | error_root_object: | 249 | error_root_object: |
252 | cachefiles_end_secure(cache, saved_cred); | 250 | cachefiles_end_secure(cache, saved_cred); |
253 | kerror("Failed to register: %d", ret); | 251 | pr_err("Failed to register: %d", ret); |
254 | return ret; | 252 | return ret; |
255 | } | 253 | } |
256 | 254 | ||
@@ -262,9 +260,8 @@ void cachefiles_daemon_unbind(struct cachefiles_cache *cache) | |||
262 | _enter(""); | 260 | _enter(""); |
263 | 261 | ||
264 | if (test_bit(CACHEFILES_READY, &cache->flags)) { | 262 | if (test_bit(CACHEFILES_READY, &cache->flags)) { |
265 | printk(KERN_INFO "CacheFiles:" | 263 | pr_info("File cache on %s unregistering\n", |
266 | " File cache on %s unregistering\n", | 264 | cache->cache.identifier); |
267 | cache->cache.identifier); | ||
268 | 265 | ||
269 | fscache_withdraw_cache(&cache->cache); | 266 | fscache_withdraw_cache(&cache->cache); |
270 | } | 267 | } |
diff --git a/fs/cachefiles/daemon.c b/fs/cachefiles/daemon.c index 0a1467b15516..b078d3081d6c 100644 --- a/fs/cachefiles/daemon.c +++ b/fs/cachefiles/daemon.c | |||
@@ -315,8 +315,7 @@ static unsigned int cachefiles_daemon_poll(struct file *file, | |||
315 | static int cachefiles_daemon_range_error(struct cachefiles_cache *cache, | 315 | static int cachefiles_daemon_range_error(struct cachefiles_cache *cache, |
316 | char *args) | 316 | char *args) |
317 | { | 317 | { |
318 | kerror("Free space limits must be in range" | 318 | pr_err("Free space limits must be in range 0%%<=stop<cull<run<100%%"); |
319 | " 0%%<=stop<cull<run<100%%"); | ||
320 | 319 | ||
321 | return -EINVAL; | 320 | return -EINVAL; |
322 | } | 321 | } |
@@ -476,12 +475,12 @@ static int cachefiles_daemon_dir(struct cachefiles_cache *cache, char *args) | |||
476 | _enter(",%s", args); | 475 | _enter(",%s", args); |
477 | 476 | ||
478 | if (!*args) { | 477 | if (!*args) { |
479 | kerror("Empty directory specified"); | 478 | pr_err("Empty directory specified"); |
480 | return -EINVAL; | 479 | return -EINVAL; |
481 | } | 480 | } |
482 | 481 | ||
483 | if (cache->rootdirname) { | 482 | if (cache->rootdirname) { |
484 | kerror("Second cache directory specified"); | 483 | pr_err("Second cache directory specified"); |
485 | return -EEXIST; | 484 | return -EEXIST; |
486 | } | 485 | } |
487 | 486 | ||
@@ -504,12 +503,12 @@ static int cachefiles_daemon_secctx(struct cachefiles_cache *cache, char *args) | |||
504 | _enter(",%s", args); | 503 | _enter(",%s", args); |
505 | 504 | ||
506 | if (!*args) { | 505 | if (!*args) { |
507 | kerror("Empty security context specified"); | 506 | pr_err("Empty security context specified"); |
508 | return -EINVAL; | 507 | return -EINVAL; |
509 | } | 508 | } |
510 | 509 | ||
511 | if (cache->secctx) { | 510 | if (cache->secctx) { |
512 | kerror("Second security context specified"); | 511 | pr_err("Second security context specified"); |
513 | return -EINVAL; | 512 | return -EINVAL; |
514 | } | 513 | } |
515 | 514 | ||
@@ -532,7 +531,7 @@ static int cachefiles_daemon_tag(struct cachefiles_cache *cache, char *args) | |||
532 | _enter(",%s", args); | 531 | _enter(",%s", args); |
533 | 532 | ||
534 | if (!*args) { | 533 | if (!*args) { |
535 | kerror("Empty tag specified"); | 534 | pr_err("Empty tag specified"); |
536 | return -EINVAL; | 535 | return -EINVAL; |
537 | } | 536 | } |
538 | 537 | ||
@@ -563,12 +562,12 @@ static int cachefiles_daemon_cull(struct cachefiles_cache *cache, char *args) | |||
563 | goto inval; | 562 | goto inval; |
564 | 563 | ||
565 | if (!test_bit(CACHEFILES_READY, &cache->flags)) { | 564 | if (!test_bit(CACHEFILES_READY, &cache->flags)) { |
566 | kerror("cull applied to unready cache"); | 565 | pr_err("cull applied to unready cache"); |
567 | return -EIO; | 566 | return -EIO; |
568 | } | 567 | } |
569 | 568 | ||
570 | if (test_bit(CACHEFILES_DEAD, &cache->flags)) { | 569 | if (test_bit(CACHEFILES_DEAD, &cache->flags)) { |
571 | kerror("cull applied to dead cache"); | 570 | pr_err("cull applied to dead cache"); |
572 | return -EIO; | 571 | return -EIO; |
573 | } | 572 | } |
574 | 573 | ||
@@ -588,11 +587,11 @@ static int cachefiles_daemon_cull(struct cachefiles_cache *cache, char *args) | |||
588 | 587 | ||
589 | notdir: | 588 | notdir: |
590 | path_put(&path); | 589 | path_put(&path); |
591 | kerror("cull command requires dirfd to be a directory"); | 590 | pr_err("cull command requires dirfd to be a directory"); |
592 | return -ENOTDIR; | 591 | return -ENOTDIR; |
593 | 592 | ||
594 | inval: | 593 | inval: |
595 | kerror("cull command requires dirfd and filename"); | 594 | pr_err("cull command requires dirfd and filename"); |
596 | return -EINVAL; | 595 | return -EINVAL; |
597 | } | 596 | } |
598 | 597 | ||
@@ -615,7 +614,7 @@ static int cachefiles_daemon_debug(struct cachefiles_cache *cache, char *args) | |||
615 | return 0; | 614 | return 0; |
616 | 615 | ||
617 | inval: | 616 | inval: |
618 | kerror("debug command requires mask"); | 617 | pr_err("debug command requires mask"); |
619 | return -EINVAL; | 618 | return -EINVAL; |
620 | } | 619 | } |
621 | 620 | ||
@@ -635,12 +634,12 @@ static int cachefiles_daemon_inuse(struct cachefiles_cache *cache, char *args) | |||
635 | goto inval; | 634 | goto inval; |
636 | 635 | ||
637 | if (!test_bit(CACHEFILES_READY, &cache->flags)) { | 636 | if (!test_bit(CACHEFILES_READY, &cache->flags)) { |
638 | kerror("inuse applied to unready cache"); | 637 | pr_err("inuse applied to unready cache"); |
639 | return -EIO; | 638 | return -EIO; |
640 | } | 639 | } |
641 | 640 | ||
642 | if (test_bit(CACHEFILES_DEAD, &cache->flags)) { | 641 | if (test_bit(CACHEFILES_DEAD, &cache->flags)) { |
643 | kerror("inuse applied to dead cache"); | 642 | pr_err("inuse applied to dead cache"); |
644 | return -EIO; | 643 | return -EIO; |
645 | } | 644 | } |
646 | 645 | ||
@@ -660,11 +659,11 @@ static int cachefiles_daemon_inuse(struct cachefiles_cache *cache, char *args) | |||
660 | 659 | ||
661 | notdir: | 660 | notdir: |
662 | path_put(&path); | 661 | path_put(&path); |
663 | kerror("inuse command requires dirfd to be a directory"); | 662 | pr_err("inuse command requires dirfd to be a directory"); |
664 | return -ENOTDIR; | 663 | return -ENOTDIR; |
665 | 664 | ||
666 | inval: | 665 | inval: |
667 | kerror("inuse command requires dirfd and filename"); | 666 | pr_err("inuse command requires dirfd and filename"); |
668 | return -EINVAL; | 667 | return -EINVAL; |
669 | } | 668 | } |
670 | 669 | ||
diff --git a/fs/cachefiles/interface.c b/fs/cachefiles/interface.c index 57e17fe6121a..584743d456c3 100644 --- a/fs/cachefiles/interface.c +++ b/fs/cachefiles/interface.c | |||
@@ -146,8 +146,7 @@ static int cachefiles_lookup_object(struct fscache_object *_object) | |||
146 | 146 | ||
147 | if (ret < 0 && ret != -ETIMEDOUT) { | 147 | if (ret < 0 && ret != -ETIMEDOUT) { |
148 | if (ret != -ENOBUFS) | 148 | if (ret != -ENOBUFS) |
149 | printk(KERN_WARNING | 149 | pr_warn("Lookup failed error %d\n", ret); |
150 | "CacheFiles: Lookup failed error %d\n", ret); | ||
151 | fscache_object_lookup_error(&object->fscache); | 150 | fscache_object_lookup_error(&object->fscache); |
152 | } | 151 | } |
153 | 152 | ||
diff --git a/fs/cachefiles/internal.h b/fs/cachefiles/internal.h index 5349473df1b1..3d50998abf57 100644 --- a/fs/cachefiles/internal.h +++ b/fs/cachefiles/internal.h | |||
@@ -9,6 +9,13 @@ | |||
9 | * 2 of the Licence, or (at your option) any later version. | 9 | * 2 of the Licence, or (at your option) any later version. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #ifdef pr_fmt | ||
13 | #undef pr_fmt | ||
14 | #endif | ||
15 | |||
16 | #define pr_fmt(fmt) "CacheFiles: " fmt | ||
17 | |||
18 | |||
12 | #include <linux/fscache-cache.h> | 19 | #include <linux/fscache-cache.h> |
13 | #include <linux/timer.h> | 20 | #include <linux/timer.h> |
14 | #include <linux/wait.h> | 21 | #include <linux/wait.h> |
@@ -245,11 +252,10 @@ extern int cachefiles_remove_object_xattr(struct cachefiles_cache *cache, | |||
245 | /* | 252 | /* |
246 | * error handling | 253 | * error handling |
247 | */ | 254 | */ |
248 | #define kerror(FMT, ...) printk(KERN_ERR "CacheFiles: "FMT"\n", ##__VA_ARGS__) | ||
249 | 255 | ||
250 | #define cachefiles_io_error(___cache, FMT, ...) \ | 256 | #define cachefiles_io_error(___cache, FMT, ...) \ |
251 | do { \ | 257 | do { \ |
252 | kerror("I/O Error: " FMT, ##__VA_ARGS__); \ | 258 | pr_err("I/O Error: " FMT, ##__VA_ARGS__); \ |
253 | fscache_io_error(&(___cache)->cache); \ | 259 | fscache_io_error(&(___cache)->cache); \ |
254 | set_bit(CACHEFILES_DEAD, &(___cache)->flags); \ | 260 | set_bit(CACHEFILES_DEAD, &(___cache)->flags); \ |
255 | } while (0) | 261 | } while (0) |
@@ -310,8 +316,8 @@ do { \ | |||
310 | #define ASSERT(X) \ | 316 | #define ASSERT(X) \ |
311 | do { \ | 317 | do { \ |
312 | if (unlikely(!(X))) { \ | 318 | if (unlikely(!(X))) { \ |
313 | printk(KERN_ERR "\n"); \ | 319 | pr_err("\n"); \ |
314 | printk(KERN_ERR "CacheFiles: Assertion failed\n"); \ | 320 | pr_err("Assertion failed\n"); \ |
315 | BUG(); \ | 321 | BUG(); \ |
316 | } \ | 322 | } \ |
317 | } while (0) | 323 | } while (0) |
@@ -319,9 +325,9 @@ do { \ | |||
319 | #define ASSERTCMP(X, OP, Y) \ | 325 | #define ASSERTCMP(X, OP, Y) \ |
320 | do { \ | 326 | do { \ |
321 | if (unlikely(!((X) OP (Y)))) { \ | 327 | if (unlikely(!((X) OP (Y)))) { \ |
322 | printk(KERN_ERR "\n"); \ | 328 | pr_err("\n"); \ |
323 | printk(KERN_ERR "CacheFiles: Assertion failed\n"); \ | 329 | pr_err("Assertion failed\n"); \ |
324 | printk(KERN_ERR "%lx " #OP " %lx is false\n", \ | 330 | pr_err("%lx " #OP " %lx is false\n", \ |
325 | (unsigned long)(X), (unsigned long)(Y)); \ | 331 | (unsigned long)(X), (unsigned long)(Y)); \ |
326 | BUG(); \ | 332 | BUG(); \ |
327 | } \ | 333 | } \ |
@@ -330,8 +336,8 @@ do { \ | |||
330 | #define ASSERTIF(C, X) \ | 336 | #define ASSERTIF(C, X) \ |
331 | do { \ | 337 | do { \ |
332 | if (unlikely((C) && !(X))) { \ | 338 | if (unlikely((C) && !(X))) { \ |
333 | printk(KERN_ERR "\n"); \ | 339 | pr_err("\n"); \ |
334 | printk(KERN_ERR "CacheFiles: Assertion failed\n"); \ | 340 | pr_err("Assertion failed\n"); \ |
335 | BUG(); \ | 341 | BUG(); \ |
336 | } \ | 342 | } \ |
337 | } while (0) | 343 | } while (0) |
@@ -339,9 +345,9 @@ do { \ | |||
339 | #define ASSERTIFCMP(C, X, OP, Y) \ | 345 | #define ASSERTIFCMP(C, X, OP, Y) \ |
340 | do { \ | 346 | do { \ |
341 | if (unlikely((C) && !((X) OP (Y)))) { \ | 347 | if (unlikely((C) && !((X) OP (Y)))) { \ |
342 | printk(KERN_ERR "\n"); \ | 348 | pr_err("\n"); \ |
343 | printk(KERN_ERR "CacheFiles: Assertion failed\n"); \ | 349 | pr_err("Assertion failed\n"); \ |
344 | printk(KERN_ERR "%lx " #OP " %lx is false\n", \ | 350 | pr_err("%lx " #OP " %lx is false\n", \ |
345 | (unsigned long)(X), (unsigned long)(Y)); \ | 351 | (unsigned long)(X), (unsigned long)(Y)); \ |
346 | BUG(); \ | 352 | BUG(); \ |
347 | } \ | 353 | } \ |
diff --git a/fs/cachefiles/main.c b/fs/cachefiles/main.c index 4bfa8cf43bf5..180edfb45f66 100644 --- a/fs/cachefiles/main.c +++ b/fs/cachefiles/main.c | |||
@@ -68,8 +68,7 @@ static int __init cachefiles_init(void) | |||
68 | SLAB_HWCACHE_ALIGN, | 68 | SLAB_HWCACHE_ALIGN, |
69 | cachefiles_object_init_once); | 69 | cachefiles_object_init_once); |
70 | if (!cachefiles_object_jar) { | 70 | if (!cachefiles_object_jar) { |
71 | printk(KERN_NOTICE | 71 | pr_notice("Failed to allocate an object jar\n"); |
72 | "CacheFiles: Failed to allocate an object jar\n"); | ||
73 | goto error_object_jar; | 72 | goto error_object_jar; |
74 | } | 73 | } |
75 | 74 | ||
@@ -77,7 +76,7 @@ static int __init cachefiles_init(void) | |||
77 | if (ret < 0) | 76 | if (ret < 0) |
78 | goto error_proc; | 77 | goto error_proc; |
79 | 78 | ||
80 | printk(KERN_INFO "CacheFiles: Loaded\n"); | 79 | pr_info("Loaded\n"); |
81 | return 0; | 80 | return 0; |
82 | 81 | ||
83 | error_proc: | 82 | error_proc: |
@@ -85,7 +84,7 @@ error_proc: | |||
85 | error_object_jar: | 84 | error_object_jar: |
86 | misc_deregister(&cachefiles_dev); | 85 | misc_deregister(&cachefiles_dev); |
87 | error_dev: | 86 | error_dev: |
88 | kerror("failed to register: %d", ret); | 87 | pr_err("failed to register: %d", ret); |
89 | return ret; | 88 | return ret; |
90 | } | 89 | } |
91 | 90 | ||
@@ -96,7 +95,7 @@ fs_initcall(cachefiles_init); | |||
96 | */ | 95 | */ |
97 | static void __exit cachefiles_exit(void) | 96 | static void __exit cachefiles_exit(void) |
98 | { | 97 | { |
99 | printk(KERN_INFO "CacheFiles: Unloading\n"); | 98 | pr_info("Unloading\n"); |
100 | 99 | ||
101 | cachefiles_proc_cleanup(); | 100 | cachefiles_proc_cleanup(); |
102 | kmem_cache_destroy(cachefiles_object_jar); | 101 | kmem_cache_destroy(cachefiles_object_jar); |
diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c index c0a681705104..5bf2b41e66d3 100644 --- a/fs/cachefiles/namei.c +++ b/fs/cachefiles/namei.c | |||
@@ -35,22 +35,21 @@ void __cachefiles_printk_object(struct cachefiles_object *object, | |||
35 | struct fscache_cookie *cookie; | 35 | struct fscache_cookie *cookie; |
36 | unsigned keylen, loop; | 36 | unsigned keylen, loop; |
37 | 37 | ||
38 | printk(KERN_ERR "%sobject: OBJ%x\n", | 38 | pr_err("%sobject: OBJ%x\n", prefix, object->fscache.debug_id); |
39 | prefix, object->fscache.debug_id); | 39 | pr_err("%sobjstate=%s fl=%lx wbusy=%x ev=%lx[%lx]\n", |
40 | printk(KERN_ERR "%sobjstate=%s fl=%lx wbusy=%x ev=%lx[%lx]\n", | ||
41 | prefix, object->fscache.state->name, | 40 | prefix, object->fscache.state->name, |
42 | object->fscache.flags, work_busy(&object->fscache.work), | 41 | object->fscache.flags, work_busy(&object->fscache.work), |
43 | object->fscache.events, object->fscache.event_mask); | 42 | object->fscache.events, object->fscache.event_mask); |
44 | printk(KERN_ERR "%sops=%u inp=%u exc=%u\n", | 43 | pr_err("%sops=%u inp=%u exc=%u\n", |
45 | prefix, object->fscache.n_ops, object->fscache.n_in_progress, | 44 | prefix, object->fscache.n_ops, object->fscache.n_in_progress, |
46 | object->fscache.n_exclusive); | 45 | object->fscache.n_exclusive); |
47 | printk(KERN_ERR "%sparent=%p\n", | 46 | pr_err("%sparent=%p\n", |
48 | prefix, object->fscache.parent); | 47 | prefix, object->fscache.parent); |
49 | 48 | ||
50 | spin_lock(&object->fscache.lock); | 49 | spin_lock(&object->fscache.lock); |
51 | cookie = object->fscache.cookie; | 50 | cookie = object->fscache.cookie; |
52 | if (cookie) { | 51 | if (cookie) { |
53 | printk(KERN_ERR "%scookie=%p [pr=%p nd=%p fl=%lx]\n", | 52 | pr_err("%scookie=%p [pr=%p nd=%p fl=%lx]\n", |
54 | prefix, | 53 | prefix, |
55 | object->fscache.cookie, | 54 | object->fscache.cookie, |
56 | object->fscache.cookie->parent, | 55 | object->fscache.cookie->parent, |
@@ -62,16 +61,16 @@ void __cachefiles_printk_object(struct cachefiles_object *object, | |||
62 | else | 61 | else |
63 | keylen = 0; | 62 | keylen = 0; |
64 | } else { | 63 | } else { |
65 | printk(KERN_ERR "%scookie=NULL\n", prefix); | 64 | pr_err("%scookie=NULL\n", prefix); |
66 | keylen = 0; | 65 | keylen = 0; |
67 | } | 66 | } |
68 | spin_unlock(&object->fscache.lock); | 67 | spin_unlock(&object->fscache.lock); |
69 | 68 | ||
70 | if (keylen) { | 69 | if (keylen) { |
71 | printk(KERN_ERR "%skey=[%u] '", prefix, keylen); | 70 | pr_err("%skey=[%u] '", prefix, keylen); |
72 | for (loop = 0; loop < keylen; loop++) | 71 | for (loop = 0; loop < keylen; loop++) |
73 | printk("%02x", keybuf[loop]); | 72 | pr_cont("%02x", keybuf[loop]); |
74 | printk("'\n"); | 73 | pr_cont("'\n"); |
75 | } | 74 | } |
76 | } | 75 | } |
77 | 76 | ||
@@ -131,13 +130,11 @@ found_dentry: | |||
131 | dentry); | 130 | dentry); |
132 | 131 | ||
133 | if (fscache_object_is_live(&object->fscache)) { | 132 | if (fscache_object_is_live(&object->fscache)) { |
134 | printk(KERN_ERR "\n"); | 133 | pr_err("\n"); |
135 | printk(KERN_ERR "CacheFiles: Error:" | 134 | pr_err("Error: Can't preemptively bury live object\n"); |
136 | " Can't preemptively bury live object\n"); | ||
137 | cachefiles_printk_object(object, NULL); | 135 | cachefiles_printk_object(object, NULL); |
138 | } else if (test_and_set_bit(CACHEFILES_OBJECT_BURIED, &object->flags)) { | 136 | } else if (test_and_set_bit(CACHEFILES_OBJECT_BURIED, &object->flags)) { |
139 | printk(KERN_ERR "CacheFiles: Error:" | 137 | pr_err("Error: Object already preemptively buried\n"); |
140 | " Object already preemptively buried\n"); | ||
141 | } | 138 | } |
142 | 139 | ||
143 | write_unlock(&cache->active_lock); | 140 | write_unlock(&cache->active_lock); |
@@ -160,7 +157,7 @@ try_again: | |||
160 | write_lock(&cache->active_lock); | 157 | write_lock(&cache->active_lock); |
161 | 158 | ||
162 | if (test_and_set_bit(CACHEFILES_OBJECT_ACTIVE, &object->flags)) { | 159 | if (test_and_set_bit(CACHEFILES_OBJECT_ACTIVE, &object->flags)) { |
163 | printk(KERN_ERR "CacheFiles: Error: Object already active\n"); | 160 | pr_err("Error: Object already active\n"); |
164 | cachefiles_printk_object(object, NULL); | 161 | cachefiles_printk_object(object, NULL); |
165 | BUG(); | 162 | BUG(); |
166 | } | 163 | } |
@@ -193,9 +190,8 @@ try_again: | |||
193 | * need to wait for it to be destroyed */ | 190 | * need to wait for it to be destroyed */ |
194 | wait_for_old_object: | 191 | wait_for_old_object: |
195 | if (fscache_object_is_live(&object->fscache)) { | 192 | if (fscache_object_is_live(&object->fscache)) { |
196 | printk(KERN_ERR "\n"); | 193 | pr_err("\n"); |
197 | printk(KERN_ERR "CacheFiles: Error:" | 194 | pr_err("Error: Unexpected object collision\n"); |
198 | " Unexpected object collision\n"); | ||
199 | cachefiles_printk_object(object, xobject); | 195 | cachefiles_printk_object(object, xobject); |
200 | BUG(); | 196 | BUG(); |
201 | } | 197 | } |
@@ -241,9 +237,8 @@ wait_for_old_object: | |||
241 | } | 237 | } |
242 | 238 | ||
243 | if (timeout <= 0) { | 239 | if (timeout <= 0) { |
244 | printk(KERN_ERR "\n"); | 240 | pr_err("\n"); |
245 | printk(KERN_ERR "CacheFiles: Error: Overlong" | 241 | pr_err("Error: Overlong wait for old active object to go away\n"); |
246 | " wait for old active object to go away\n"); | ||
247 | cachefiles_printk_object(object, xobject); | 242 | cachefiles_printk_object(object, xobject); |
248 | goto requeue; | 243 | goto requeue; |
249 | } | 244 | } |
@@ -548,7 +543,7 @@ lookup_again: | |||
548 | next, next->d_inode, next->d_inode->i_ino); | 543 | next, next->d_inode, next->d_inode->i_ino); |
549 | 544 | ||
550 | } else if (!S_ISDIR(next->d_inode->i_mode)) { | 545 | } else if (!S_ISDIR(next->d_inode->i_mode)) { |
551 | kerror("inode %lu is not a directory", | 546 | pr_err("inode %lu is not a directory", |
552 | next->d_inode->i_ino); | 547 | next->d_inode->i_ino); |
553 | ret = -ENOBUFS; | 548 | ret = -ENOBUFS; |
554 | goto error; | 549 | goto error; |
@@ -579,7 +574,7 @@ lookup_again: | |||
579 | } else if (!S_ISDIR(next->d_inode->i_mode) && | 574 | } else if (!S_ISDIR(next->d_inode->i_mode) && |
580 | !S_ISREG(next->d_inode->i_mode) | 575 | !S_ISREG(next->d_inode->i_mode) |
581 | ) { | 576 | ) { |
582 | kerror("inode %lu is not a file or directory", | 577 | pr_err("inode %lu is not a file or directory", |
583 | next->d_inode->i_ino); | 578 | next->d_inode->i_ino); |
584 | ret = -ENOBUFS; | 579 | ret = -ENOBUFS; |
585 | goto error; | 580 | goto error; |
@@ -773,7 +768,7 @@ struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache, | |||
773 | ASSERT(subdir->d_inode); | 768 | ASSERT(subdir->d_inode); |
774 | 769 | ||
775 | if (!S_ISDIR(subdir->d_inode->i_mode)) { | 770 | if (!S_ISDIR(subdir->d_inode->i_mode)) { |
776 | kerror("%s is not a directory", dirname); | 771 | pr_err("%s is not a directory", dirname); |
777 | ret = -EIO; | 772 | ret = -EIO; |
778 | goto check_error; | 773 | goto check_error; |
779 | } | 774 | } |
@@ -800,13 +795,13 @@ check_error: | |||
800 | mkdir_error: | 795 | mkdir_error: |
801 | mutex_unlock(&dir->d_inode->i_mutex); | 796 | mutex_unlock(&dir->d_inode->i_mutex); |
802 | dput(subdir); | 797 | dput(subdir); |
803 | kerror("mkdir %s failed with error %d", dirname, ret); | 798 | pr_err("mkdir %s failed with error %d", dirname, ret); |
804 | return ERR_PTR(ret); | 799 | return ERR_PTR(ret); |
805 | 800 | ||
806 | lookup_error: | 801 | lookup_error: |
807 | mutex_unlock(&dir->d_inode->i_mutex); | 802 | mutex_unlock(&dir->d_inode->i_mutex); |
808 | ret = PTR_ERR(subdir); | 803 | ret = PTR_ERR(subdir); |
809 | kerror("Lookup %s failed with error %d", dirname, ret); | 804 | pr_err("Lookup %s failed with error %d", dirname, ret); |
810 | return ERR_PTR(ret); | 805 | return ERR_PTR(ret); |
811 | 806 | ||
812 | nomem_d_alloc: | 807 | nomem_d_alloc: |
@@ -896,7 +891,7 @@ lookup_error: | |||
896 | if (ret == -EIO) { | 891 | if (ret == -EIO) { |
897 | cachefiles_io_error(cache, "Lookup failed"); | 892 | cachefiles_io_error(cache, "Lookup failed"); |
898 | } else if (ret != -ENOMEM) { | 893 | } else if (ret != -ENOMEM) { |
899 | kerror("Internal error: %d", ret); | 894 | pr_err("Internal error: %d", ret); |
900 | ret = -EIO; | 895 | ret = -EIO; |
901 | } | 896 | } |
902 | 897 | ||
@@ -955,7 +950,7 @@ error: | |||
955 | } | 950 | } |
956 | 951 | ||
957 | if (ret != -ENOMEM) { | 952 | if (ret != -ENOMEM) { |
958 | kerror("Internal error: %d", ret); | 953 | pr_err("Internal error: %d", ret); |
959 | ret = -EIO; | 954 | ret = -EIO; |
960 | } | 955 | } |
961 | 956 | ||
diff --git a/fs/cachefiles/security.c b/fs/cachefiles/security.c index 039b5011d83b..396c18ea2764 100644 --- a/fs/cachefiles/security.c +++ b/fs/cachefiles/security.c | |||
@@ -34,9 +34,7 @@ int cachefiles_get_security_ID(struct cachefiles_cache *cache) | |||
34 | ret = set_security_override_from_ctx(new, cache->secctx); | 34 | ret = set_security_override_from_ctx(new, cache->secctx); |
35 | if (ret < 0) { | 35 | if (ret < 0) { |
36 | put_cred(new); | 36 | put_cred(new); |
37 | printk(KERN_ERR "CacheFiles:" | 37 | pr_err("Security denies permission to nominate security context: error %d\n", |
38 | " Security denies permission to nominate" | ||
39 | " security context: error %d\n", | ||
40 | ret); | 38 | ret); |
41 | goto error; | 39 | goto error; |
42 | } | 40 | } |
@@ -59,16 +57,14 @@ static int cachefiles_check_cache_dir(struct cachefiles_cache *cache, | |||
59 | 57 | ||
60 | ret = security_inode_mkdir(root->d_inode, root, 0); | 58 | ret = security_inode_mkdir(root->d_inode, root, 0); |
61 | if (ret < 0) { | 59 | if (ret < 0) { |
62 | printk(KERN_ERR "CacheFiles:" | 60 | pr_err("Security denies permission to make dirs: error %d", |
63 | " Security denies permission to make dirs: error %d", | ||
64 | ret); | 61 | ret); |
65 | return ret; | 62 | return ret; |
66 | } | 63 | } |
67 | 64 | ||
68 | ret = security_inode_create(root->d_inode, root, 0); | 65 | ret = security_inode_create(root->d_inode, root, 0); |
69 | if (ret < 0) | 66 | if (ret < 0) |
70 | printk(KERN_ERR "CacheFiles:" | 67 | pr_err("Security denies permission to create files: error %d", |
71 | " Security denies permission to create files: error %d", | ||
72 | ret); | 68 | ret); |
73 | 69 | ||
74 | return ret; | 70 | return ret; |
diff --git a/fs/cachefiles/xattr.c b/fs/cachefiles/xattr.c index 12b0eef84183..1ad51ffbb275 100644 --- a/fs/cachefiles/xattr.c +++ b/fs/cachefiles/xattr.c | |||
@@ -51,7 +51,7 @@ int cachefiles_check_object_type(struct cachefiles_object *object) | |||
51 | } | 51 | } |
52 | 52 | ||
53 | if (ret != -EEXIST) { | 53 | if (ret != -EEXIST) { |
54 | kerror("Can't set xattr on %*.*s [%lu] (err %d)", | 54 | pr_err("Can't set xattr on %*.*s [%lu] (err %d)", |
55 | dentry->d_name.len, dentry->d_name.len, | 55 | dentry->d_name.len, dentry->d_name.len, |
56 | dentry->d_name.name, dentry->d_inode->i_ino, | 56 | dentry->d_name.name, dentry->d_inode->i_ino, |
57 | -ret); | 57 | -ret); |
@@ -64,7 +64,7 @@ int cachefiles_check_object_type(struct cachefiles_object *object) | |||
64 | if (ret == -ERANGE) | 64 | if (ret == -ERANGE) |
65 | goto bad_type_length; | 65 | goto bad_type_length; |
66 | 66 | ||
67 | kerror("Can't read xattr on %*.*s [%lu] (err %d)", | 67 | pr_err("Can't read xattr on %*.*s [%lu] (err %d)", |
68 | dentry->d_name.len, dentry->d_name.len, | 68 | dentry->d_name.len, dentry->d_name.len, |
69 | dentry->d_name.name, dentry->d_inode->i_ino, | 69 | dentry->d_name.name, dentry->d_inode->i_ino, |
70 | -ret); | 70 | -ret); |
@@ -85,14 +85,14 @@ error: | |||
85 | return ret; | 85 | return ret; |
86 | 86 | ||
87 | bad_type_length: | 87 | bad_type_length: |
88 | kerror("Cache object %lu type xattr length incorrect", | 88 | pr_err("Cache object %lu type xattr length incorrect", |
89 | dentry->d_inode->i_ino); | 89 | dentry->d_inode->i_ino); |
90 | ret = -EIO; | 90 | ret = -EIO; |
91 | goto error; | 91 | goto error; |
92 | 92 | ||
93 | bad_type: | 93 | bad_type: |
94 | xtype[2] = 0; | 94 | xtype[2] = 0; |
95 | kerror("Cache object %*.*s [%lu] type %s not %s", | 95 | pr_err("Cache object %*.*s [%lu] type %s not %s", |
96 | dentry->d_name.len, dentry->d_name.len, | 96 | dentry->d_name.len, dentry->d_name.len, |
97 | dentry->d_name.name, dentry->d_inode->i_ino, | 97 | dentry->d_name.name, dentry->d_inode->i_ino, |
98 | xtype, type); | 98 | xtype, type); |
@@ -293,7 +293,7 @@ error: | |||
293 | return ret; | 293 | return ret; |
294 | 294 | ||
295 | bad_type_length: | 295 | bad_type_length: |
296 | kerror("Cache object %lu xattr length incorrect", | 296 | pr_err("Cache object %lu xattr length incorrect", |
297 | dentry->d_inode->i_ino); | 297 | dentry->d_inode->i_ino); |
298 | ret = -EIO; | 298 | ret = -EIO; |
299 | goto error; | 299 | goto error; |
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index b53278c9fd97..65a30e817dd8 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c | |||
@@ -694,7 +694,7 @@ static int ceph_writepages_start(struct address_space *mapping, | |||
694 | (wbc->sync_mode == WB_SYNC_ALL ? "ALL" : "HOLD")); | 694 | (wbc->sync_mode == WB_SYNC_ALL ? "ALL" : "HOLD")); |
695 | 695 | ||
696 | if (fsc->mount_state == CEPH_MOUNT_SHUTDOWN) { | 696 | if (fsc->mount_state == CEPH_MOUNT_SHUTDOWN) { |
697 | pr_warning("writepage_start %p on forced umount\n", inode); | 697 | pr_warn("writepage_start %p on forced umount\n", inode); |
698 | return -EIO; /* we're in a forced umount, don't write! */ | 698 | return -EIO; /* we're in a forced umount, don't write! */ |
699 | } | 699 | } |
700 | if (fsc->mount_options->wsize && fsc->mount_options->wsize < wsize) | 700 | if (fsc->mount_options->wsize && fsc->mount_options->wsize < wsize) |
diff --git a/fs/ceph/debugfs.c b/fs/ceph/debugfs.c index 16b54aa31f08..5a743ac141ab 100644 --- a/fs/ceph/debugfs.c +++ b/fs/ceph/debugfs.c | |||
@@ -71,9 +71,9 @@ static int mdsc_show(struct seq_file *s, void *p) | |||
71 | seq_printf(s, "%s", ceph_mds_op_name(req->r_op)); | 71 | seq_printf(s, "%s", ceph_mds_op_name(req->r_op)); |
72 | 72 | ||
73 | if (req->r_got_unsafe) | 73 | if (req->r_got_unsafe) |
74 | seq_printf(s, "\t(unsafe)"); | 74 | seq_puts(s, "\t(unsafe)"); |
75 | else | 75 | else |
76 | seq_printf(s, "\t"); | 76 | seq_puts(s, "\t"); |
77 | 77 | ||
78 | if (req->r_inode) { | 78 | if (req->r_inode) { |
79 | seq_printf(s, " #%llx", ceph_ino(req->r_inode)); | 79 | seq_printf(s, " #%llx", ceph_ino(req->r_inode)); |
@@ -119,7 +119,7 @@ static int mdsc_show(struct seq_file *s, void *p) | |||
119 | seq_printf(s, " %s", req->r_path2); | 119 | seq_printf(s, " %s", req->r_path2); |
120 | } | 120 | } |
121 | 121 | ||
122 | seq_printf(s, "\n"); | 122 | seq_puts(s, "\n"); |
123 | } | 123 | } |
124 | mutex_unlock(&mdsc->mutex); | 124 | mutex_unlock(&mdsc->mutex); |
125 | 125 | ||
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 233c6f96910a..e4fff9ff1c27 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c | |||
@@ -821,7 +821,7 @@ no_change: | |||
821 | spin_unlock(&ci->i_ceph_lock); | 821 | spin_unlock(&ci->i_ceph_lock); |
822 | } | 822 | } |
823 | } else if (cap_fmode >= 0) { | 823 | } else if (cap_fmode >= 0) { |
824 | pr_warning("mds issued no caps on %llx.%llx\n", | 824 | pr_warn("mds issued no caps on %llx.%llx\n", |
825 | ceph_vinop(inode)); | 825 | ceph_vinop(inode)); |
826 | __ceph_get_fmode(ci, cap_fmode); | 826 | __ceph_get_fmode(ci, cap_fmode); |
827 | } | 827 | } |
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 2b4d093d0563..9a33b98cb000 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c | |||
@@ -2218,13 +2218,13 @@ static void handle_reply(struct ceph_mds_session *session, struct ceph_msg *msg) | |||
2218 | /* dup? */ | 2218 | /* dup? */ |
2219 | if ((req->r_got_unsafe && !head->safe) || | 2219 | if ((req->r_got_unsafe && !head->safe) || |
2220 | (req->r_got_safe && head->safe)) { | 2220 | (req->r_got_safe && head->safe)) { |
2221 | pr_warning("got a dup %s reply on %llu from mds%d\n", | 2221 | pr_warn("got a dup %s reply on %llu from mds%d\n", |
2222 | head->safe ? "safe" : "unsafe", tid, mds); | 2222 | head->safe ? "safe" : "unsafe", tid, mds); |
2223 | mutex_unlock(&mdsc->mutex); | 2223 | mutex_unlock(&mdsc->mutex); |
2224 | goto out; | 2224 | goto out; |
2225 | } | 2225 | } |
2226 | if (req->r_got_safe && !head->safe) { | 2226 | if (req->r_got_safe && !head->safe) { |
2227 | pr_warning("got unsafe after safe on %llu from mds%d\n", | 2227 | pr_warn("got unsafe after safe on %llu from mds%d\n", |
2228 | tid, mds); | 2228 | tid, mds); |
2229 | mutex_unlock(&mdsc->mutex); | 2229 | mutex_unlock(&mdsc->mutex); |
2230 | goto out; | 2230 | goto out; |
@@ -3525,7 +3525,7 @@ static void peer_reset(struct ceph_connection *con) | |||
3525 | struct ceph_mds_session *s = con->private; | 3525 | struct ceph_mds_session *s = con->private; |
3526 | struct ceph_mds_client *mdsc = s->s_mdsc; | 3526 | struct ceph_mds_client *mdsc = s->s_mdsc; |
3527 | 3527 | ||
3528 | pr_warning("mds%d closed our session\n", s->s_mds); | 3528 | pr_warn("mds%d closed our session\n", s->s_mds); |
3529 | send_mds_reconnect(mdsc, s); | 3529 | send_mds_reconnect(mdsc, s); |
3530 | } | 3530 | } |
3531 | 3531 | ||
diff --git a/fs/ceph/mdsmap.c b/fs/ceph/mdsmap.c index 132b64eeecd4..261531e55e9d 100644 --- a/fs/ceph/mdsmap.c +++ b/fs/ceph/mdsmap.c | |||
@@ -62,7 +62,7 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end) | |||
62 | 62 | ||
63 | ceph_decode_16_safe(p, end, version, bad); | 63 | ceph_decode_16_safe(p, end, version, bad); |
64 | if (version > 3) { | 64 | if (version > 3) { |
65 | pr_warning("got mdsmap version %d > 3, failing", version); | 65 | pr_warn("got mdsmap version %d > 3, failing", version); |
66 | goto bad; | 66 | goto bad; |
67 | } | 67 | } |
68 | 68 | ||
diff --git a/fs/coda/cnode.c b/fs/coda/cnode.c index 911cf30d057d..7740b1c871c1 100644 --- a/fs/coda/cnode.c +++ b/fs/coda/cnode.c | |||
@@ -101,7 +101,7 @@ struct inode *coda_cnode_make(struct CodaFid *fid, struct super_block *sb) | |||
101 | 101 | ||
102 | inode = coda_iget(sb, fid, &attr); | 102 | inode = coda_iget(sb, fid, &attr); |
103 | if (IS_ERR(inode)) | 103 | if (IS_ERR(inode)) |
104 | printk("coda_cnode_make: coda_iget failed\n"); | 104 | pr_warn("%s: coda_iget failed\n", __func__); |
105 | return inode; | 105 | return inode; |
106 | } | 106 | } |
107 | 107 | ||
@@ -137,7 +137,7 @@ struct inode *coda_fid_to_inode(struct CodaFid *fid, struct super_block *sb) | |||
137 | unsigned long hash = coda_f2i(fid); | 137 | unsigned long hash = coda_f2i(fid); |
138 | 138 | ||
139 | if ( !sb ) { | 139 | if ( !sb ) { |
140 | printk("coda_fid_to_inode: no sb!\n"); | 140 | pr_warn("%s: no sb!\n", __func__); |
141 | return NULL; | 141 | return NULL; |
142 | } | 142 | } |
143 | 143 | ||
diff --git a/fs/coda/coda_linux.h b/fs/coda/coda_linux.h index e7550cb9fb74..d42b725b1d21 100644 --- a/fs/coda/coda_linux.h +++ b/fs/coda/coda_linux.h | |||
@@ -12,6 +12,12 @@ | |||
12 | #ifndef _LINUX_CODA_FS | 12 | #ifndef _LINUX_CODA_FS |
13 | #define _LINUX_CODA_FS | 13 | #define _LINUX_CODA_FS |
14 | 14 | ||
15 | #ifdef pr_fmt | ||
16 | #undef pr_fmt | ||
17 | #endif | ||
18 | |||
19 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
20 | |||
15 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
16 | #include <linux/param.h> | 22 | #include <linux/param.h> |
17 | #include <linux/mm.h> | 23 | #include <linux/mm.h> |
@@ -63,7 +69,7 @@ void coda_sysctl_clean(void); | |||
63 | else \ | 69 | else \ |
64 | ptr = (cast)vzalloc((unsigned long) size); \ | 70 | ptr = (cast)vzalloc((unsigned long) size); \ |
65 | if (!ptr) \ | 71 | if (!ptr) \ |
66 | printk("kernel malloc returns 0 at %s:%d\n", __FILE__, __LINE__); \ | 72 | pr_warn("kernel malloc returns 0 at %s:%d\n", __FILE__, __LINE__); \ |
67 | } while (0) | 73 | } while (0) |
68 | 74 | ||
69 | 75 | ||
diff --git a/fs/coda/dir.c b/fs/coda/dir.c index 5efbb5ee0adc..cd8a63238b11 100644 --- a/fs/coda/dir.c +++ b/fs/coda/dir.c | |||
@@ -102,7 +102,7 @@ static struct dentry *coda_lookup(struct inode *dir, struct dentry *entry, unsig | |||
102 | int type = 0; | 102 | int type = 0; |
103 | 103 | ||
104 | if (length > CODA_MAXNAMLEN) { | 104 | if (length > CODA_MAXNAMLEN) { |
105 | printk(KERN_ERR "name too long: lookup, %s (%*s)\n", | 105 | pr_err("name too long: lookup, %s (%*s)\n", |
106 | coda_i2s(dir), (int)length, name); | 106 | coda_i2s(dir), (int)length, name); |
107 | return ERR_PTR(-ENAMETOOLONG); | 107 | return ERR_PTR(-ENAMETOOLONG); |
108 | } | 108 | } |
@@ -453,23 +453,23 @@ static int coda_venus_readdir(struct file *coda_file, struct dir_context *ctx) | |||
453 | ret = kernel_read(host_file, ctx->pos - 2, (char *)vdir, | 453 | ret = kernel_read(host_file, ctx->pos - 2, (char *)vdir, |
454 | sizeof(*vdir)); | 454 | sizeof(*vdir)); |
455 | if (ret < 0) { | 455 | if (ret < 0) { |
456 | printk(KERN_ERR "coda readdir: read dir %s failed %d\n", | 456 | pr_err("%s: read dir %s failed %d\n", |
457 | coda_f2s(&cii->c_fid), ret); | 457 | __func__, coda_f2s(&cii->c_fid), ret); |
458 | break; | 458 | break; |
459 | } | 459 | } |
460 | if (ret == 0) break; /* end of directory file reached */ | 460 | if (ret == 0) break; /* end of directory file reached */ |
461 | 461 | ||
462 | /* catch truncated reads */ | 462 | /* catch truncated reads */ |
463 | if (ret < vdir_size || ret < vdir_size + vdir->d_namlen) { | 463 | if (ret < vdir_size || ret < vdir_size + vdir->d_namlen) { |
464 | printk(KERN_ERR "coda readdir: short read on %s\n", | 464 | pr_err("%s: short read on %s\n", |
465 | coda_f2s(&cii->c_fid)); | 465 | __func__, coda_f2s(&cii->c_fid)); |
466 | ret = -EBADF; | 466 | ret = -EBADF; |
467 | break; | 467 | break; |
468 | } | 468 | } |
469 | /* validate whether the directory file actually makes sense */ | 469 | /* validate whether the directory file actually makes sense */ |
470 | if (vdir->d_reclen < vdir_size + vdir->d_namlen) { | 470 | if (vdir->d_reclen < vdir_size + vdir->d_namlen) { |
471 | printk(KERN_ERR "coda readdir: invalid dir %s\n", | 471 | pr_err("%s: invalid dir %s\n", |
472 | coda_f2s(&cii->c_fid)); | 472 | __func__, coda_f2s(&cii->c_fid)); |
473 | ret = -EBADF; | 473 | ret = -EBADF; |
474 | break; | 474 | break; |
475 | } | 475 | } |
@@ -589,8 +589,8 @@ int coda_revalidate_inode(struct inode *inode) | |||
589 | coda_vattr_to_iattr(inode, &attr); | 589 | coda_vattr_to_iattr(inode, &attr); |
590 | 590 | ||
591 | if ((old_mode & S_IFMT) != (inode->i_mode & S_IFMT)) { | 591 | if ((old_mode & S_IFMT) != (inode->i_mode & S_IFMT)) { |
592 | printk("Coda: inode %ld, fid %s changed type!\n", | 592 | pr_warn("inode %ld, fid %s changed type!\n", |
593 | inode->i_ino, coda_f2s(&(cii->c_fid))); | 593 | inode->i_ino, coda_f2s(&(cii->c_fid))); |
594 | } | 594 | } |
595 | 595 | ||
596 | /* the following can happen when a local fid is replaced | 596 | /* the following can happen when a local fid is replaced |
diff --git a/fs/coda/inode.c b/fs/coda/inode.c index d9c7751f10ac..fe3afb2de880 100644 --- a/fs/coda/inode.c +++ b/fs/coda/inode.c | |||
@@ -119,12 +119,12 @@ static int get_device_index(struct coda_mount_data *data) | |||
119 | int idx; | 119 | int idx; |
120 | 120 | ||
121 | if (data == NULL) { | 121 | if (data == NULL) { |
122 | printk("coda_read_super: Bad mount data\n"); | 122 | pr_warn("%s: Bad mount data\n", __func__); |
123 | return -1; | 123 | return -1; |
124 | } | 124 | } |
125 | 125 | ||
126 | if (data->version != CODA_MOUNT_VERSION) { | 126 | if (data->version != CODA_MOUNT_VERSION) { |
127 | printk("coda_read_super: Bad mount version\n"); | 127 | pr_warn("%s: Bad mount version\n", __func__); |
128 | return -1; | 128 | return -1; |
129 | } | 129 | } |
130 | 130 | ||
@@ -141,13 +141,13 @@ static int get_device_index(struct coda_mount_data *data) | |||
141 | fdput(f); | 141 | fdput(f); |
142 | 142 | ||
143 | if (idx < 0 || idx >= MAX_CODADEVS) { | 143 | if (idx < 0 || idx >= MAX_CODADEVS) { |
144 | printk("coda_read_super: Bad minor number\n"); | 144 | pr_warn("%s: Bad minor number\n", __func__); |
145 | return -1; | 145 | return -1; |
146 | } | 146 | } |
147 | 147 | ||
148 | return idx; | 148 | return idx; |
149 | Ebadf: | 149 | Ebadf: |
150 | printk("coda_read_super: Bad file\n"); | 150 | pr_warn("%s: Bad file\n", __func__); |
151 | return -1; | 151 | return -1; |
152 | } | 152 | } |
153 | 153 | ||
@@ -168,19 +168,19 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent) | |||
168 | if(idx == -1) | 168 | if(idx == -1) |
169 | idx = 0; | 169 | idx = 0; |
170 | 170 | ||
171 | printk(KERN_INFO "coda_read_super: device index: %i\n", idx); | 171 | pr_info("%s: device index: %i\n", __func__, idx); |
172 | 172 | ||
173 | vc = &coda_comms[idx]; | 173 | vc = &coda_comms[idx]; |
174 | mutex_lock(&vc->vc_mutex); | 174 | mutex_lock(&vc->vc_mutex); |
175 | 175 | ||
176 | if (!vc->vc_inuse) { | 176 | if (!vc->vc_inuse) { |
177 | printk("coda_read_super: No pseudo device\n"); | 177 | pr_warn("%s: No pseudo device\n", __func__); |
178 | error = -EINVAL; | 178 | error = -EINVAL; |
179 | goto unlock_out; | 179 | goto unlock_out; |
180 | } | 180 | } |
181 | 181 | ||
182 | if (vc->vc_sb) { | 182 | if (vc->vc_sb) { |
183 | printk("coda_read_super: Device already mounted\n"); | 183 | pr_warn("%s: Device already mounted\n", __func__); |
184 | error = -EBUSY; | 184 | error = -EBUSY; |
185 | goto unlock_out; | 185 | goto unlock_out; |
186 | } | 186 | } |
@@ -204,22 +204,23 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent) | |||
204 | /* get root fid from Venus: this needs the root inode */ | 204 | /* get root fid from Venus: this needs the root inode */ |
205 | error = venus_rootfid(sb, &fid); | 205 | error = venus_rootfid(sb, &fid); |
206 | if ( error ) { | 206 | if ( error ) { |
207 | printk("coda_read_super: coda_get_rootfid failed with %d\n", | 207 | pr_warn("%s: coda_get_rootfid failed with %d\n", |
208 | error); | 208 | __func__, error); |
209 | goto error; | 209 | goto error; |
210 | } | 210 | } |
211 | printk("coda_read_super: rootfid is %s\n", coda_f2s(&fid)); | 211 | pr_info("%s: rootfid is %s\n", __func__, coda_f2s(&fid)); |
212 | 212 | ||
213 | /* make root inode */ | 213 | /* make root inode */ |
214 | root = coda_cnode_make(&fid, sb); | 214 | root = coda_cnode_make(&fid, sb); |
215 | if (IS_ERR(root)) { | 215 | if (IS_ERR(root)) { |
216 | error = PTR_ERR(root); | 216 | error = PTR_ERR(root); |
217 | printk("Failure of coda_cnode_make for root: error %d\n", error); | 217 | pr_warn("Failure of coda_cnode_make for root: error %d\n", |
218 | error); | ||
218 | goto error; | 219 | goto error; |
219 | } | 220 | } |
220 | 221 | ||
221 | printk("coda_read_super: rootinode is %ld dev %s\n", | 222 | pr_info("%s: rootinode is %ld dev %s\n", |
222 | root->i_ino, root->i_sb->s_id); | 223 | __func__, root->i_ino, root->i_sb->s_id); |
223 | sb->s_root = d_make_root(root); | 224 | sb->s_root = d_make_root(root); |
224 | if (!sb->s_root) { | 225 | if (!sb->s_root) { |
225 | error = -EINVAL; | 226 | error = -EINVAL; |
@@ -246,7 +247,7 @@ static void coda_put_super(struct super_block *sb) | |||
246 | sb->s_fs_info = NULL; | 247 | sb->s_fs_info = NULL; |
247 | mutex_unlock(&vcp->vc_mutex); | 248 | mutex_unlock(&vcp->vc_mutex); |
248 | 249 | ||
249 | printk("Coda: Bye bye.\n"); | 250 | pr_info("Bye bye.\n"); |
250 | } | 251 | } |
251 | 252 | ||
252 | static void coda_evict_inode(struct inode *inode) | 253 | static void coda_evict_inode(struct inode *inode) |
diff --git a/fs/coda/psdev.c b/fs/coda/psdev.c index ebc2bae6c289..5c1e4242368b 100644 --- a/fs/coda/psdev.c +++ b/fs/coda/psdev.c | |||
@@ -114,14 +114,14 @@ static ssize_t coda_psdev_write(struct file *file, const char __user *buf, | |||
114 | int size = sizeof(*dcbuf); | 114 | int size = sizeof(*dcbuf); |
115 | 115 | ||
116 | if ( nbytes < sizeof(struct coda_out_hdr) ) { | 116 | if ( nbytes < sizeof(struct coda_out_hdr) ) { |
117 | printk("coda_downcall opc %d uniq %d, not enough!\n", | 117 | pr_warn("coda_downcall opc %d uniq %d, not enough!\n", |
118 | hdr.opcode, hdr.unique); | 118 | hdr.opcode, hdr.unique); |
119 | count = nbytes; | 119 | count = nbytes; |
120 | goto out; | 120 | goto out; |
121 | } | 121 | } |
122 | if ( nbytes > size ) { | 122 | if ( nbytes > size ) { |
123 | printk("Coda: downcall opc %d, uniq %d, too much!", | 123 | pr_warn("downcall opc %d, uniq %d, too much!", |
124 | hdr.opcode, hdr.unique); | 124 | hdr.opcode, hdr.unique); |
125 | nbytes = size; | 125 | nbytes = size; |
126 | } | 126 | } |
127 | CODA_ALLOC(dcbuf, union outputArgs *, nbytes); | 127 | CODA_ALLOC(dcbuf, union outputArgs *, nbytes); |
@@ -136,7 +136,8 @@ static ssize_t coda_psdev_write(struct file *file, const char __user *buf, | |||
136 | 136 | ||
137 | CODA_FREE(dcbuf, nbytes); | 137 | CODA_FREE(dcbuf, nbytes); |
138 | if (error) { | 138 | if (error) { |
139 | printk("psdev_write: coda_downcall error: %d\n", error); | 139 | pr_warn("%s: coda_downcall error: %d\n", |
140 | __func__, error); | ||
140 | retval = error; | 141 | retval = error; |
141 | goto out; | 142 | goto out; |
142 | } | 143 | } |
@@ -157,16 +158,17 @@ static ssize_t coda_psdev_write(struct file *file, const char __user *buf, | |||
157 | mutex_unlock(&vcp->vc_mutex); | 158 | mutex_unlock(&vcp->vc_mutex); |
158 | 159 | ||
159 | if (!req) { | 160 | if (!req) { |
160 | printk("psdev_write: msg (%d, %d) not found\n", | 161 | pr_warn("%s: msg (%d, %d) not found\n", |
161 | hdr.opcode, hdr.unique); | 162 | __func__, hdr.opcode, hdr.unique); |
162 | retval = -ESRCH; | 163 | retval = -ESRCH; |
163 | goto out; | 164 | goto out; |
164 | } | 165 | } |
165 | 166 | ||
166 | /* move data into response buffer. */ | 167 | /* move data into response buffer. */ |
167 | if (req->uc_outSize < nbytes) { | 168 | if (req->uc_outSize < nbytes) { |
168 | printk("psdev_write: too much cnt: %d, cnt: %ld, opc: %d, uniq: %d.\n", | 169 | pr_warn("%s: too much cnt: %d, cnt: %ld, opc: %d, uniq: %d.\n", |
169 | req->uc_outSize, (long)nbytes, hdr.opcode, hdr.unique); | 170 | __func__, req->uc_outSize, (long)nbytes, |
171 | hdr.opcode, hdr.unique); | ||
170 | nbytes = req->uc_outSize; /* don't have more space! */ | 172 | nbytes = req->uc_outSize; /* don't have more space! */ |
171 | } | 173 | } |
172 | if (copy_from_user(req->uc_data, buf, nbytes)) { | 174 | if (copy_from_user(req->uc_data, buf, nbytes)) { |
@@ -240,8 +242,8 @@ static ssize_t coda_psdev_read(struct file * file, char __user * buf, | |||
240 | /* Move the input args into userspace */ | 242 | /* Move the input args into userspace */ |
241 | count = req->uc_inSize; | 243 | count = req->uc_inSize; |
242 | if (nbytes < req->uc_inSize) { | 244 | if (nbytes < req->uc_inSize) { |
243 | printk ("psdev_read: Venus read %ld bytes of %d in message\n", | 245 | pr_warn("%s: Venus read %ld bytes of %d in message\n", |
244 | (long)nbytes, req->uc_inSize); | 246 | __func__, (long)nbytes, req->uc_inSize); |
245 | count = nbytes; | 247 | count = nbytes; |
246 | } | 248 | } |
247 | 249 | ||
@@ -305,7 +307,7 @@ static int coda_psdev_release(struct inode * inode, struct file * file) | |||
305 | struct upc_req *req, *tmp; | 307 | struct upc_req *req, *tmp; |
306 | 308 | ||
307 | if (!vcp || !vcp->vc_inuse ) { | 309 | if (!vcp || !vcp->vc_inuse ) { |
308 | printk("psdev_release: Not open.\n"); | 310 | pr_warn("%s: Not open.\n", __func__); |
309 | return -1; | 311 | return -1; |
310 | } | 312 | } |
311 | 313 | ||
@@ -354,8 +356,8 @@ static int init_coda_psdev(void) | |||
354 | { | 356 | { |
355 | int i, err = 0; | 357 | int i, err = 0; |
356 | if (register_chrdev(CODA_PSDEV_MAJOR, "coda", &coda_psdev_fops)) { | 358 | if (register_chrdev(CODA_PSDEV_MAJOR, "coda", &coda_psdev_fops)) { |
357 | printk(KERN_ERR "coda_psdev: unable to get major %d\n", | 359 | pr_err("%s: unable to get major %d\n", |
358 | CODA_PSDEV_MAJOR); | 360 | __func__, CODA_PSDEV_MAJOR); |
359 | return -EIO; | 361 | return -EIO; |
360 | } | 362 | } |
361 | coda_psdev_class = class_create(THIS_MODULE, "coda"); | 363 | coda_psdev_class = class_create(THIS_MODULE, "coda"); |
@@ -393,13 +395,13 @@ static int __init init_coda(void) | |||
393 | goto out2; | 395 | goto out2; |
394 | status = init_coda_psdev(); | 396 | status = init_coda_psdev(); |
395 | if ( status ) { | 397 | if ( status ) { |
396 | printk("Problem (%d) in init_coda_psdev\n", status); | 398 | pr_warn("Problem (%d) in init_coda_psdev\n", status); |
397 | goto out1; | 399 | goto out1; |
398 | } | 400 | } |
399 | 401 | ||
400 | status = register_filesystem(&coda_fs_type); | 402 | status = register_filesystem(&coda_fs_type); |
401 | if (status) { | 403 | if (status) { |
402 | printk("coda: failed to register filesystem!\n"); | 404 | pr_warn("failed to register filesystem!\n"); |
403 | goto out; | 405 | goto out; |
404 | } | 406 | } |
405 | return 0; | 407 | return 0; |
@@ -420,9 +422,8 @@ static void __exit exit_coda(void) | |||
420 | int err, i; | 422 | int err, i; |
421 | 423 | ||
422 | err = unregister_filesystem(&coda_fs_type); | 424 | err = unregister_filesystem(&coda_fs_type); |
423 | if ( err != 0 ) { | 425 | if (err != 0) |
424 | printk("coda: failed to unregister filesystem\n"); | 426 | pr_warn("failed to unregister filesystem\n"); |
425 | } | ||
426 | for (i = 0; i < MAX_CODADEVS; i++) | 427 | for (i = 0; i < MAX_CODADEVS; i++) |
427 | device_destroy(coda_psdev_class, MKDEV(CODA_PSDEV_MAJOR, i)); | 428 | device_destroy(coda_psdev_class, MKDEV(CODA_PSDEV_MAJOR, i)); |
428 | class_destroy(coda_psdev_class); | 429 | class_destroy(coda_psdev_class); |
diff --git a/fs/coda/sysctl.c b/fs/coda/sysctl.c index af56ad56a89a..34218a8a28cd 100644 --- a/fs/coda/sysctl.c +++ b/fs/coda/sysctl.c | |||
@@ -14,7 +14,7 @@ | |||
14 | #ifdef CONFIG_SYSCTL | 14 | #ifdef CONFIG_SYSCTL |
15 | static struct ctl_table_header *fs_table_header; | 15 | static struct ctl_table_header *fs_table_header; |
16 | 16 | ||
17 | static ctl_table coda_table[] = { | 17 | static struct ctl_table coda_table[] = { |
18 | { | 18 | { |
19 | .procname = "timeout", | 19 | .procname = "timeout", |
20 | .data = &coda_timeout, | 20 | .data = &coda_timeout, |
@@ -39,7 +39,7 @@ static ctl_table coda_table[] = { | |||
39 | {} | 39 | {} |
40 | }; | 40 | }; |
41 | 41 | ||
42 | static ctl_table fs_table[] = { | 42 | static struct ctl_table fs_table[] = { |
43 | { | 43 | { |
44 | .procname = "coda", | 44 | .procname = "coda", |
45 | .mode = 0555, | 45 | .mode = 0555, |
diff --git a/fs/coda/upcall.c b/fs/coda/upcall.c index 3a731976dc5e..21fcf8dcb9cd 100644 --- a/fs/coda/upcall.c +++ b/fs/coda/upcall.c | |||
@@ -508,8 +508,8 @@ int venus_pioctl(struct super_block *sb, struct CodaFid *fid, | |||
508 | inp->coda_ioctl.data = (char *)(INSIZE(ioctl)); | 508 | inp->coda_ioctl.data = (char *)(INSIZE(ioctl)); |
509 | 509 | ||
510 | /* get the data out of user space */ | 510 | /* get the data out of user space */ |
511 | if ( copy_from_user((char*)inp + (long)inp->coda_ioctl.data, | 511 | if (copy_from_user((char *)inp + (long)inp->coda_ioctl.data, |
512 | data->vi.in, data->vi.in_size) ) { | 512 | data->vi.in, data->vi.in_size)) { |
513 | error = -EINVAL; | 513 | error = -EINVAL; |
514 | goto exit; | 514 | goto exit; |
515 | } | 515 | } |
@@ -518,8 +518,8 @@ int venus_pioctl(struct super_block *sb, struct CodaFid *fid, | |||
518 | &outsize, inp); | 518 | &outsize, inp); |
519 | 519 | ||
520 | if (error) { | 520 | if (error) { |
521 | printk("coda_pioctl: Venus returns: %d for %s\n", | 521 | pr_warn("%s: Venus returns: %d for %s\n", |
522 | error, coda_f2s(fid)); | 522 | __func__, error, coda_f2s(fid)); |
523 | goto exit; | 523 | goto exit; |
524 | } | 524 | } |
525 | 525 | ||
@@ -675,7 +675,7 @@ static int coda_upcall(struct venus_comm *vcp, | |||
675 | mutex_lock(&vcp->vc_mutex); | 675 | mutex_lock(&vcp->vc_mutex); |
676 | 676 | ||
677 | if (!vcp->vc_inuse) { | 677 | if (!vcp->vc_inuse) { |
678 | printk(KERN_NOTICE "coda: Venus dead, not sending upcall\n"); | 678 | pr_notice("Venus dead, not sending upcall\n"); |
679 | error = -ENXIO; | 679 | error = -ENXIO; |
680 | goto exit; | 680 | goto exit; |
681 | } | 681 | } |
@@ -725,7 +725,7 @@ static int coda_upcall(struct venus_comm *vcp, | |||
725 | 725 | ||
726 | error = -EINTR; | 726 | error = -EINTR; |
727 | if ((req->uc_flags & CODA_REQ_ABORT) || !signal_pending(current)) { | 727 | if ((req->uc_flags & CODA_REQ_ABORT) || !signal_pending(current)) { |
728 | printk(KERN_WARNING "coda: Unexpected interruption.\n"); | 728 | pr_warn("Unexpected interruption.\n"); |
729 | goto exit; | 729 | goto exit; |
730 | } | 730 | } |
731 | 731 | ||
@@ -735,7 +735,7 @@ static int coda_upcall(struct venus_comm *vcp, | |||
735 | 735 | ||
736 | /* Venus saw the upcall, make sure we can send interrupt signal */ | 736 | /* Venus saw the upcall, make sure we can send interrupt signal */ |
737 | if (!vcp->vc_inuse) { | 737 | if (!vcp->vc_inuse) { |
738 | printk(KERN_INFO "coda: Venus dead, not sending signal.\n"); | 738 | pr_info("Venus dead, not sending signal.\n"); |
739 | goto exit; | 739 | goto exit; |
740 | } | 740 | } |
741 | 741 | ||
diff --git a/fs/dcache.c b/fs/dcache.c index be2bea834bf4..1792d6075b4f 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -150,7 +150,7 @@ static long get_nr_dentry_unused(void) | |||
150 | return sum < 0 ? 0 : sum; | 150 | return sum < 0 ? 0 : sum; |
151 | } | 151 | } |
152 | 152 | ||
153 | int proc_nr_dentry(ctl_table *table, int write, void __user *buffer, | 153 | int proc_nr_dentry(struct ctl_table *table, int write, void __user *buffer, |
154 | size_t *lenp, loff_t *ppos) | 154 | size_t *lenp, loff_t *ppos) |
155 | { | 155 | { |
156 | dentry_stat.nr_dentry = get_nr_dentry(); | 156 | dentry_stat.nr_dentry = get_nr_dentry(); |
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c index c71038079b47..cfe8466f7fef 100644 --- a/fs/devpts/inode.c +++ b/fs/devpts/inode.c | |||
@@ -10,6 +10,8 @@ | |||
10 | * | 10 | * |
11 | * ------------------------------------------------------------------------- */ | 11 | * ------------------------------------------------------------------------- */ |
12 | 12 | ||
13 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
14 | |||
13 | #include <linux/module.h> | 15 | #include <linux/module.h> |
14 | #include <linux/init.h> | 16 | #include <linux/init.h> |
15 | #include <linux/fs.h> | 17 | #include <linux/fs.h> |
@@ -148,10 +150,10 @@ static inline struct super_block *pts_sb_from_inode(struct inode *inode) | |||
148 | 150 | ||
149 | /* | 151 | /* |
150 | * parse_mount_options(): | 152 | * parse_mount_options(): |
151 | * Set @opts to mount options specified in @data. If an option is not | 153 | * Set @opts to mount options specified in @data. If an option is not |
152 | * specified in @data, set it to its default value. The exception is | 154 | * specified in @data, set it to its default value. The exception is |
153 | * 'newinstance' option which can only be set/cleared on a mount (i.e. | 155 | * 'newinstance' option which can only be set/cleared on a mount (i.e. |
154 | * cannot be changed during remount). | 156 | * cannot be changed during remount). |
155 | * | 157 | * |
156 | * Note: @data may be NULL (in which case all options are set to default). | 158 | * Note: @data may be NULL (in which case all options are set to default). |
157 | */ | 159 | */ |
@@ -225,7 +227,7 @@ static int parse_mount_options(char *data, int op, struct pts_mount_opts *opts) | |||
225 | break; | 227 | break; |
226 | #endif | 228 | #endif |
227 | default: | 229 | default: |
228 | printk(KERN_ERR "devpts: called with bogus options\n"); | 230 | pr_err("called with bogus options\n"); |
229 | return -EINVAL; | 231 | return -EINVAL; |
230 | } | 232 | } |
231 | } | 233 | } |
@@ -261,7 +263,7 @@ static int mknod_ptmx(struct super_block *sb) | |||
261 | 263 | ||
262 | dentry = d_alloc_name(root, "ptmx"); | 264 | dentry = d_alloc_name(root, "ptmx"); |
263 | if (!dentry) { | 265 | if (!dentry) { |
264 | printk(KERN_NOTICE "Unable to alloc dentry for ptmx node\n"); | 266 | pr_err("Unable to alloc dentry for ptmx node\n"); |
265 | goto out; | 267 | goto out; |
266 | } | 268 | } |
267 | 269 | ||
@@ -270,7 +272,7 @@ static int mknod_ptmx(struct super_block *sb) | |||
270 | */ | 272 | */ |
271 | inode = new_inode(sb); | 273 | inode = new_inode(sb); |
272 | if (!inode) { | 274 | if (!inode) { |
273 | printk(KERN_ERR "Unable to alloc inode for ptmx node\n"); | 275 | pr_err("Unable to alloc inode for ptmx node\n"); |
274 | dput(dentry); | 276 | dput(dentry); |
275 | goto out; | 277 | goto out; |
276 | } | 278 | } |
@@ -303,7 +305,7 @@ static void update_ptmx_mode(struct pts_fs_info *fsi) | |||
303 | #else | 305 | #else |
304 | static inline void update_ptmx_mode(struct pts_fs_info *fsi) | 306 | static inline void update_ptmx_mode(struct pts_fs_info *fsi) |
305 | { | 307 | { |
306 | return; | 308 | return; |
307 | } | 309 | } |
308 | #endif | 310 | #endif |
309 | 311 | ||
@@ -333,9 +335,11 @@ static int devpts_show_options(struct seq_file *seq, struct dentry *root) | |||
333 | struct pts_mount_opts *opts = &fsi->mount_opts; | 335 | struct pts_mount_opts *opts = &fsi->mount_opts; |
334 | 336 | ||
335 | if (opts->setuid) | 337 | if (opts->setuid) |
336 | seq_printf(seq, ",uid=%u", from_kuid_munged(&init_user_ns, opts->uid)); | 338 | seq_printf(seq, ",uid=%u", |
339 | from_kuid_munged(&init_user_ns, opts->uid)); | ||
337 | if (opts->setgid) | 340 | if (opts->setgid) |
338 | seq_printf(seq, ",gid=%u", from_kgid_munged(&init_user_ns, opts->gid)); | 341 | seq_printf(seq, ",gid=%u", |
342 | from_kgid_munged(&init_user_ns, opts->gid)); | ||
339 | seq_printf(seq, ",mode=%03o", opts->mode); | 343 | seq_printf(seq, ",mode=%03o", opts->mode); |
340 | #ifdef CONFIG_DEVPTS_MULTIPLE_INSTANCES | 344 | #ifdef CONFIG_DEVPTS_MULTIPLE_INSTANCES |
341 | seq_printf(seq, ",ptmxmode=%03o", opts->ptmxmode); | 345 | seq_printf(seq, ",ptmxmode=%03o", opts->ptmxmode); |
@@ -396,7 +400,7 @@ devpts_fill_super(struct super_block *s, void *data, int silent) | |||
396 | if (s->s_root) | 400 | if (s->s_root) |
397 | return 0; | 401 | return 0; |
398 | 402 | ||
399 | printk(KERN_ERR "devpts: get root dentry failed\n"); | 403 | pr_err("get root dentry failed\n"); |
400 | 404 | ||
401 | fail: | 405 | fail: |
402 | return -ENOMEM; | 406 | return -ENOMEM; |
diff --git a/fs/dlm/config.c b/fs/dlm/config.c index 76feb4b60fa6..d521bddf876d 100644 --- a/fs/dlm/config.c +++ b/fs/dlm/config.c | |||
@@ -157,11 +157,13 @@ static ssize_t cluster_set(struct dlm_cluster *cl, unsigned int *cl_field, | |||
157 | const char *buf, size_t len) | 157 | const char *buf, size_t len) |
158 | { | 158 | { |
159 | unsigned int x; | 159 | unsigned int x; |
160 | int rc; | ||
160 | 161 | ||
161 | if (!capable(CAP_SYS_ADMIN)) | 162 | if (!capable(CAP_SYS_ADMIN)) |
162 | return -EPERM; | 163 | return -EPERM; |
163 | 164 | rc = kstrtouint(buf, 0, &x); | |
164 | x = simple_strtoul(buf, NULL, 0); | 165 | if (rc) |
166 | return rc; | ||
165 | 167 | ||
166 | if (check_zero && !x) | 168 | if (check_zero && !x) |
167 | return -EINVAL; | 169 | return -EINVAL; |
@@ -730,7 +732,10 @@ static ssize_t comm_nodeid_read(struct dlm_comm *cm, char *buf) | |||
730 | static ssize_t comm_nodeid_write(struct dlm_comm *cm, const char *buf, | 732 | static ssize_t comm_nodeid_write(struct dlm_comm *cm, const char *buf, |
731 | size_t len) | 733 | size_t len) |
732 | { | 734 | { |
733 | cm->nodeid = simple_strtol(buf, NULL, 0); | 735 | int rc = kstrtoint(buf, 0, &cm->nodeid); |
736 | |||
737 | if (rc) | ||
738 | return rc; | ||
734 | return len; | 739 | return len; |
735 | } | 740 | } |
736 | 741 | ||
@@ -742,7 +747,10 @@ static ssize_t comm_local_read(struct dlm_comm *cm, char *buf) | |||
742 | static ssize_t comm_local_write(struct dlm_comm *cm, const char *buf, | 747 | static ssize_t comm_local_write(struct dlm_comm *cm, const char *buf, |
743 | size_t len) | 748 | size_t len) |
744 | { | 749 | { |
745 | cm->local= simple_strtol(buf, NULL, 0); | 750 | int rc = kstrtoint(buf, 0, &cm->local); |
751 | |||
752 | if (rc) | ||
753 | return rc; | ||
746 | if (cm->local && !local_comm) | 754 | if (cm->local && !local_comm) |
747 | local_comm = cm; | 755 | local_comm = cm; |
748 | return len; | 756 | return len; |
@@ -846,7 +854,10 @@ static ssize_t node_nodeid_write(struct dlm_node *nd, const char *buf, | |||
846 | size_t len) | 854 | size_t len) |
847 | { | 855 | { |
848 | uint32_t seq = 0; | 856 | uint32_t seq = 0; |
849 | nd->nodeid = simple_strtol(buf, NULL, 0); | 857 | int rc = kstrtoint(buf, 0, &nd->nodeid); |
858 | |||
859 | if (rc) | ||
860 | return rc; | ||
850 | dlm_comm_seq(nd->nodeid, &seq); | 861 | dlm_comm_seq(nd->nodeid, &seq); |
851 | nd->comm_seq = seq; | 862 | nd->comm_seq = seq; |
852 | return len; | 863 | return len; |
@@ -860,7 +871,10 @@ static ssize_t node_weight_read(struct dlm_node *nd, char *buf) | |||
860 | static ssize_t node_weight_write(struct dlm_node *nd, const char *buf, | 871 | static ssize_t node_weight_write(struct dlm_node *nd, const char *buf, |
861 | size_t len) | 872 | size_t len) |
862 | { | 873 | { |
863 | nd->weight = simple_strtol(buf, NULL, 0); | 874 | int rc = kstrtoint(buf, 0, &nd->weight); |
875 | |||
876 | if (rc) | ||
877 | return rc; | ||
864 | return len; | 878 | return len; |
865 | } | 879 | } |
866 | 880 | ||
diff --git a/fs/dlm/debug_fs.c b/fs/dlm/debug_fs.c index b969deef9ebb..8d77ba7b1756 100644 --- a/fs/dlm/debug_fs.c +++ b/fs/dlm/debug_fs.c | |||
@@ -68,7 +68,7 @@ static int print_format1_lock(struct seq_file *s, struct dlm_lkb *lkb, | |||
68 | if (lkb->lkb_wait_type) | 68 | if (lkb->lkb_wait_type) |
69 | seq_printf(s, " wait_type: %d", lkb->lkb_wait_type); | 69 | seq_printf(s, " wait_type: %d", lkb->lkb_wait_type); |
70 | 70 | ||
71 | return seq_printf(s, "\n"); | 71 | return seq_puts(s, "\n"); |
72 | } | 72 | } |
73 | 73 | ||
74 | static int print_format1(struct dlm_rsb *res, struct seq_file *s) | 74 | static int print_format1(struct dlm_rsb *res, struct seq_file *s) |
@@ -92,31 +92,31 @@ static int print_format1(struct dlm_rsb *res, struct seq_file *s) | |||
92 | } | 92 | } |
93 | 93 | ||
94 | if (res->res_nodeid > 0) | 94 | if (res->res_nodeid > 0) |
95 | rv = seq_printf(s, "\" \nLocal Copy, Master is node %d\n", | 95 | rv = seq_printf(s, "\"\nLocal Copy, Master is node %d\n", |
96 | res->res_nodeid); | 96 | res->res_nodeid); |
97 | else if (res->res_nodeid == 0) | 97 | else if (res->res_nodeid == 0) |
98 | rv = seq_printf(s, "\" \nMaster Copy\n"); | 98 | rv = seq_puts(s, "\"\nMaster Copy\n"); |
99 | else if (res->res_nodeid == -1) | 99 | else if (res->res_nodeid == -1) |
100 | rv = seq_printf(s, "\" \nLooking up master (lkid %x)\n", | 100 | rv = seq_printf(s, "\"\nLooking up master (lkid %x)\n", |
101 | res->res_first_lkid); | 101 | res->res_first_lkid); |
102 | else | 102 | else |
103 | rv = seq_printf(s, "\" \nInvalid master %d\n", | 103 | rv = seq_printf(s, "\"\nInvalid master %d\n", |
104 | res->res_nodeid); | 104 | res->res_nodeid); |
105 | if (rv) | 105 | if (rv) |
106 | goto out; | 106 | goto out; |
107 | 107 | ||
108 | /* Print the LVB: */ | 108 | /* Print the LVB: */ |
109 | if (res->res_lvbptr) { | 109 | if (res->res_lvbptr) { |
110 | seq_printf(s, "LVB: "); | 110 | seq_puts(s, "LVB: "); |
111 | for (i = 0; i < lvblen; i++) { | 111 | for (i = 0; i < lvblen; i++) { |
112 | if (i == lvblen / 2) | 112 | if (i == lvblen / 2) |
113 | seq_printf(s, "\n "); | 113 | seq_puts(s, "\n "); |
114 | seq_printf(s, "%02x ", | 114 | seq_printf(s, "%02x ", |
115 | (unsigned char) res->res_lvbptr[i]); | 115 | (unsigned char) res->res_lvbptr[i]); |
116 | } | 116 | } |
117 | if (rsb_flag(res, RSB_VALNOTVALID)) | 117 | if (rsb_flag(res, RSB_VALNOTVALID)) |
118 | seq_printf(s, " (INVALID)"); | 118 | seq_puts(s, " (INVALID)"); |
119 | rv = seq_printf(s, "\n"); | 119 | rv = seq_puts(s, "\n"); |
120 | if (rv) | 120 | if (rv) |
121 | goto out; | 121 | goto out; |
122 | } | 122 | } |
@@ -133,21 +133,21 @@ static int print_format1(struct dlm_rsb *res, struct seq_file *s) | |||
133 | } | 133 | } |
134 | 134 | ||
135 | /* Print the locks attached to this resource */ | 135 | /* Print the locks attached to this resource */ |
136 | seq_printf(s, "Granted Queue\n"); | 136 | seq_puts(s, "Granted Queue\n"); |
137 | list_for_each_entry(lkb, &res->res_grantqueue, lkb_statequeue) { | 137 | list_for_each_entry(lkb, &res->res_grantqueue, lkb_statequeue) { |
138 | rv = print_format1_lock(s, lkb, res); | 138 | rv = print_format1_lock(s, lkb, res); |
139 | if (rv) | 139 | if (rv) |
140 | goto out; | 140 | goto out; |
141 | } | 141 | } |
142 | 142 | ||
143 | seq_printf(s, "Conversion Queue\n"); | 143 | seq_puts(s, "Conversion Queue\n"); |
144 | list_for_each_entry(lkb, &res->res_convertqueue, lkb_statequeue) { | 144 | list_for_each_entry(lkb, &res->res_convertqueue, lkb_statequeue) { |
145 | rv = print_format1_lock(s, lkb, res); | 145 | rv = print_format1_lock(s, lkb, res); |
146 | if (rv) | 146 | if (rv) |
147 | goto out; | 147 | goto out; |
148 | } | 148 | } |
149 | 149 | ||
150 | seq_printf(s, "Waiting Queue\n"); | 150 | seq_puts(s, "Waiting Queue\n"); |
151 | list_for_each_entry(lkb, &res->res_waitqueue, lkb_statequeue) { | 151 | list_for_each_entry(lkb, &res->res_waitqueue, lkb_statequeue) { |
152 | rv = print_format1_lock(s, lkb, res); | 152 | rv = print_format1_lock(s, lkb, res); |
153 | if (rv) | 153 | if (rv) |
@@ -157,13 +157,13 @@ static int print_format1(struct dlm_rsb *res, struct seq_file *s) | |||
157 | if (list_empty(&res->res_lookup)) | 157 | if (list_empty(&res->res_lookup)) |
158 | goto out; | 158 | goto out; |
159 | 159 | ||
160 | seq_printf(s, "Lookup Queue\n"); | 160 | seq_puts(s, "Lookup Queue\n"); |
161 | list_for_each_entry(lkb, &res->res_lookup, lkb_rsb_lookup) { | 161 | list_for_each_entry(lkb, &res->res_lookup, lkb_rsb_lookup) { |
162 | rv = seq_printf(s, "%08x %s", lkb->lkb_id, | 162 | rv = seq_printf(s, "%08x %s", lkb->lkb_id, |
163 | print_lockmode(lkb->lkb_rqmode)); | 163 | print_lockmode(lkb->lkb_rqmode)); |
164 | if (lkb->lkb_wait_type) | 164 | if (lkb->lkb_wait_type) |
165 | seq_printf(s, " wait_type: %d", lkb->lkb_wait_type); | 165 | seq_printf(s, " wait_type: %d", lkb->lkb_wait_type); |
166 | rv = seq_printf(s, "\n"); | 166 | rv = seq_puts(s, "\n"); |
167 | } | 167 | } |
168 | out: | 168 | out: |
169 | unlock_rsb(res); | 169 | unlock_rsb(res); |
@@ -300,7 +300,7 @@ static int print_format3(struct dlm_rsb *r, struct seq_file *s) | |||
300 | else | 300 | else |
301 | seq_printf(s, " %02x", (unsigned char)r->res_name[i]); | 301 | seq_printf(s, " %02x", (unsigned char)r->res_name[i]); |
302 | } | 302 | } |
303 | rv = seq_printf(s, "\n"); | 303 | rv = seq_puts(s, "\n"); |
304 | if (rv) | 304 | if (rv) |
305 | goto out; | 305 | goto out; |
306 | 306 | ||
@@ -311,7 +311,7 @@ static int print_format3(struct dlm_rsb *r, struct seq_file *s) | |||
311 | 311 | ||
312 | for (i = 0; i < lvblen; i++) | 312 | for (i = 0; i < lvblen; i++) |
313 | seq_printf(s, " %02x", (unsigned char)r->res_lvbptr[i]); | 313 | seq_printf(s, " %02x", (unsigned char)r->res_lvbptr[i]); |
314 | rv = seq_printf(s, "\n"); | 314 | rv = seq_puts(s, "\n"); |
315 | if (rv) | 315 | if (rv) |
316 | goto out; | 316 | goto out; |
317 | 317 | ||
@@ -377,7 +377,7 @@ static int print_format4(struct dlm_rsb *r, struct seq_file *s) | |||
377 | else | 377 | else |
378 | seq_printf(s, " %02x", (unsigned char)r->res_name[i]); | 378 | seq_printf(s, " %02x", (unsigned char)r->res_name[i]); |
379 | } | 379 | } |
380 | rv = seq_printf(s, "\n"); | 380 | rv = seq_puts(s, "\n"); |
381 | out: | 381 | out: |
382 | unlock_rsb(r); | 382 | unlock_rsb(r); |
383 | return rv; | 383 | return rv; |
diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c index 04d6398c1f1c..f3e72787e7f9 100644 --- a/fs/dlm/lockspace.c +++ b/fs/dlm/lockspace.c | |||
@@ -35,8 +35,11 @@ static struct task_struct * scand_task; | |||
35 | static ssize_t dlm_control_store(struct dlm_ls *ls, const char *buf, size_t len) | 35 | static ssize_t dlm_control_store(struct dlm_ls *ls, const char *buf, size_t len) |
36 | { | 36 | { |
37 | ssize_t ret = len; | 37 | ssize_t ret = len; |
38 | int n = simple_strtol(buf, NULL, 0); | 38 | int n; |
39 | int rc = kstrtoint(buf, 0, &n); | ||
39 | 40 | ||
41 | if (rc) | ||
42 | return rc; | ||
40 | ls = dlm_find_lockspace_local(ls->ls_local_handle); | 43 | ls = dlm_find_lockspace_local(ls->ls_local_handle); |
41 | if (!ls) | 44 | if (!ls) |
42 | return -EINVAL; | 45 | return -EINVAL; |
@@ -57,7 +60,10 @@ static ssize_t dlm_control_store(struct dlm_ls *ls, const char *buf, size_t len) | |||
57 | 60 | ||
58 | static ssize_t dlm_event_store(struct dlm_ls *ls, const char *buf, size_t len) | 61 | static ssize_t dlm_event_store(struct dlm_ls *ls, const char *buf, size_t len) |
59 | { | 62 | { |
60 | ls->ls_uevent_result = simple_strtol(buf, NULL, 0); | 63 | int rc = kstrtoint(buf, 0, &ls->ls_uevent_result); |
64 | |||
65 | if (rc) | ||
66 | return rc; | ||
61 | set_bit(LSFL_UEVENT_WAIT, &ls->ls_flags); | 67 | set_bit(LSFL_UEVENT_WAIT, &ls->ls_flags); |
62 | wake_up(&ls->ls_uevent_wait); | 68 | wake_up(&ls->ls_uevent_wait); |
63 | return len; | 69 | return len; |
@@ -70,7 +76,10 @@ static ssize_t dlm_id_show(struct dlm_ls *ls, char *buf) | |||
70 | 76 | ||
71 | static ssize_t dlm_id_store(struct dlm_ls *ls, const char *buf, size_t len) | 77 | static ssize_t dlm_id_store(struct dlm_ls *ls, const char *buf, size_t len) |
72 | { | 78 | { |
73 | ls->ls_global_id = simple_strtoul(buf, NULL, 0); | 79 | int rc = kstrtouint(buf, 0, &ls->ls_global_id); |
80 | |||
81 | if (rc) | ||
82 | return rc; | ||
74 | return len; | 83 | return len; |
75 | } | 84 | } |
76 | 85 | ||
@@ -81,7 +90,11 @@ static ssize_t dlm_nodir_show(struct dlm_ls *ls, char *buf) | |||
81 | 90 | ||
82 | static ssize_t dlm_nodir_store(struct dlm_ls *ls, const char *buf, size_t len) | 91 | static ssize_t dlm_nodir_store(struct dlm_ls *ls, const char *buf, size_t len) |
83 | { | 92 | { |
84 | int val = simple_strtoul(buf, NULL, 0); | 93 | int val; |
94 | int rc = kstrtoint(buf, 0, &val); | ||
95 | |||
96 | if (rc) | ||
97 | return rc; | ||
85 | if (val == 1) | 98 | if (val == 1) |
86 | set_bit(LSFL_NODIR, &ls->ls_flags); | 99 | set_bit(LSFL_NODIR, &ls->ls_flags); |
87 | return len; | 100 | return len; |
diff --git a/fs/drop_caches.c b/fs/drop_caches.c index 9280202e488c..1de7294aad20 100644 --- a/fs/drop_caches.c +++ b/fs/drop_caches.c | |||
@@ -50,7 +50,7 @@ static void drop_slab(void) | |||
50 | } while (nr_objects > 10); | 50 | } while (nr_objects > 10); |
51 | } | 51 | } |
52 | 52 | ||
53 | int drop_caches_sysctl_handler(ctl_table *table, int write, | 53 | int drop_caches_sysctl_handler(struct ctl_table *table, int write, |
54 | void __user *buffer, size_t *length, loff_t *ppos) | 54 | void __user *buffer, size_t *length, loff_t *ppos) |
55 | { | 55 | { |
56 | int ret; | 56 | int ret; |
diff --git a/fs/eventpoll.c b/fs/eventpoll.c index af903128891c..b73e0621ce9e 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c | |||
@@ -293,7 +293,7 @@ static LIST_HEAD(tfile_check_list); | |||
293 | static long zero; | 293 | static long zero; |
294 | static long long_max = LONG_MAX; | 294 | static long long_max = LONG_MAX; |
295 | 295 | ||
296 | ctl_table epoll_table[] = { | 296 | struct ctl_table epoll_table[] = { |
297 | { | 297 | { |
298 | .procname = "max_user_watches", | 298 | .procname = "max_user_watches", |
299 | .data = &max_user_watches, | 299 | .data = &max_user_watches, |
diff --git a/fs/fat/fat.h b/fs/fat/fat.h index 7c31f4bc74a9..e0c4ba39a377 100644 --- a/fs/fat/fat.h +++ b/fs/fat/fat.h | |||
@@ -52,7 +52,8 @@ struct fat_mount_options { | |||
52 | usefree:1, /* Use free_clusters for FAT32 */ | 52 | usefree:1, /* Use free_clusters for FAT32 */ |
53 | tz_set:1, /* Filesystem timestamps' offset set */ | 53 | tz_set:1, /* Filesystem timestamps' offset set */ |
54 | rodir:1, /* allow ATTR_RO for directory */ | 54 | rodir:1, /* allow ATTR_RO for directory */ |
55 | discard:1; /* Issue discard requests on deletions */ | 55 | discard:1, /* Issue discard requests on deletions */ |
56 | dos1xfloppy:1; /* Assume default BPB for DOS 1.x floppies */ | ||
56 | }; | 57 | }; |
57 | 58 | ||
58 | #define FAT_HASH_BITS 8 | 59 | #define FAT_HASH_BITS 8 |
diff --git a/fs/fat/inode.c b/fs/fat/inode.c index b3361fe2bcb5..9c83594d7fb5 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c | |||
@@ -35,9 +35,71 @@ | |||
35 | #define CONFIG_FAT_DEFAULT_IOCHARSET "" | 35 | #define CONFIG_FAT_DEFAULT_IOCHARSET "" |
36 | #endif | 36 | #endif |
37 | 37 | ||
38 | #define KB_IN_SECTORS 2 | ||
39 | |||
40 | /* | ||
41 | * A deserialized copy of the on-disk structure laid out in struct | ||
42 | * fat_boot_sector. | ||
43 | */ | ||
44 | struct fat_bios_param_block { | ||
45 | u16 fat_sector_size; | ||
46 | u8 fat_sec_per_clus; | ||
47 | u16 fat_reserved; | ||
48 | u8 fat_fats; | ||
49 | u16 fat_dir_entries; | ||
50 | u16 fat_sectors; | ||
51 | u16 fat_fat_length; | ||
52 | u32 fat_total_sect; | ||
53 | |||
54 | u8 fat16_state; | ||
55 | u32 fat16_vol_id; | ||
56 | |||
57 | u32 fat32_length; | ||
58 | u32 fat32_root_cluster; | ||
59 | u16 fat32_info_sector; | ||
60 | u8 fat32_state; | ||
61 | u32 fat32_vol_id; | ||
62 | }; | ||
63 | |||
38 | static int fat_default_codepage = CONFIG_FAT_DEFAULT_CODEPAGE; | 64 | static int fat_default_codepage = CONFIG_FAT_DEFAULT_CODEPAGE; |
39 | static char fat_default_iocharset[] = CONFIG_FAT_DEFAULT_IOCHARSET; | 65 | static char fat_default_iocharset[] = CONFIG_FAT_DEFAULT_IOCHARSET; |
40 | 66 | ||
67 | static struct fat_floppy_defaults { | ||
68 | unsigned nr_sectors; | ||
69 | unsigned sec_per_clus; | ||
70 | unsigned dir_entries; | ||
71 | unsigned media; | ||
72 | unsigned fat_length; | ||
73 | } floppy_defaults[] = { | ||
74 | { | ||
75 | .nr_sectors = 160 * KB_IN_SECTORS, | ||
76 | .sec_per_clus = 1, | ||
77 | .dir_entries = 64, | ||
78 | .media = 0xFE, | ||
79 | .fat_length = 1, | ||
80 | }, | ||
81 | { | ||
82 | .nr_sectors = 180 * KB_IN_SECTORS, | ||
83 | .sec_per_clus = 1, | ||
84 | .dir_entries = 64, | ||
85 | .media = 0xFC, | ||
86 | .fat_length = 2, | ||
87 | }, | ||
88 | { | ||
89 | .nr_sectors = 320 * KB_IN_SECTORS, | ||
90 | .sec_per_clus = 2, | ||
91 | .dir_entries = 112, | ||
92 | .media = 0xFF, | ||
93 | .fat_length = 1, | ||
94 | }, | ||
95 | { | ||
96 | .nr_sectors = 360 * KB_IN_SECTORS, | ||
97 | .sec_per_clus = 2, | ||
98 | .dir_entries = 112, | ||
99 | .media = 0xFD, | ||
100 | .fat_length = 2, | ||
101 | }, | ||
102 | }; | ||
41 | 103 | ||
42 | static int fat_add_cluster(struct inode *inode) | 104 | static int fat_add_cluster(struct inode *inode) |
43 | { | 105 | { |
@@ -359,7 +421,7 @@ struct inode *fat_iget(struct super_block *sb, loff_t i_pos) | |||
359 | 421 | ||
360 | static int is_exec(unsigned char *extension) | 422 | static int is_exec(unsigned char *extension) |
361 | { | 423 | { |
362 | unsigned char *exe_extensions = "EXECOMBAT", *walk; | 424 | unsigned char exe_extensions[] = "EXECOMBAT", *walk; |
363 | 425 | ||
364 | for (walk = exe_extensions; *walk; walk += 3) | 426 | for (walk = exe_extensions; *walk; walk += 3) |
365 | if (!strncmp(extension, walk, 3)) | 427 | if (!strncmp(extension, walk, 3)) |
@@ -853,6 +915,8 @@ static int fat_show_options(struct seq_file *m, struct dentry *root) | |||
853 | seq_puts(m, ",nfs=stale_rw"); | 915 | seq_puts(m, ",nfs=stale_rw"); |
854 | if (opts->discard) | 916 | if (opts->discard) |
855 | seq_puts(m, ",discard"); | 917 | seq_puts(m, ",discard"); |
918 | if (opts->dos1xfloppy) | ||
919 | seq_puts(m, ",dos1xfloppy"); | ||
856 | 920 | ||
857 | return 0; | 921 | return 0; |
858 | } | 922 | } |
@@ -867,7 +931,7 @@ enum { | |||
867 | Opt_uni_xl_no, Opt_uni_xl_yes, Opt_nonumtail_no, Opt_nonumtail_yes, | 931 | Opt_uni_xl_no, Opt_uni_xl_yes, Opt_nonumtail_no, Opt_nonumtail_yes, |
868 | Opt_obsolete, Opt_flush, Opt_tz_utc, Opt_rodir, Opt_err_cont, | 932 | Opt_obsolete, Opt_flush, Opt_tz_utc, Opt_rodir, Opt_err_cont, |
869 | Opt_err_panic, Opt_err_ro, Opt_discard, Opt_nfs, Opt_time_offset, | 933 | Opt_err_panic, Opt_err_ro, Opt_discard, Opt_nfs, Opt_time_offset, |
870 | Opt_nfs_stale_rw, Opt_nfs_nostale_ro, Opt_err, | 934 | Opt_nfs_stale_rw, Opt_nfs_nostale_ro, Opt_err, Opt_dos1xfloppy, |
871 | }; | 935 | }; |
872 | 936 | ||
873 | static const match_table_t fat_tokens = { | 937 | static const match_table_t fat_tokens = { |
@@ -900,6 +964,7 @@ static const match_table_t fat_tokens = { | |||
900 | {Opt_nfs_stale_rw, "nfs"}, | 964 | {Opt_nfs_stale_rw, "nfs"}, |
901 | {Opt_nfs_stale_rw, "nfs=stale_rw"}, | 965 | {Opt_nfs_stale_rw, "nfs=stale_rw"}, |
902 | {Opt_nfs_nostale_ro, "nfs=nostale_ro"}, | 966 | {Opt_nfs_nostale_ro, "nfs=nostale_ro"}, |
967 | {Opt_dos1xfloppy, "dos1xfloppy"}, | ||
903 | {Opt_obsolete, "conv=binary"}, | 968 | {Opt_obsolete, "conv=binary"}, |
904 | {Opt_obsolete, "conv=text"}, | 969 | {Opt_obsolete, "conv=text"}, |
905 | {Opt_obsolete, "conv=auto"}, | 970 | {Opt_obsolete, "conv=auto"}, |
@@ -1102,6 +1167,9 @@ static int parse_options(struct super_block *sb, char *options, int is_vfat, | |||
1102 | case Opt_nfs_nostale_ro: | 1167 | case Opt_nfs_nostale_ro: |
1103 | opts->nfs = FAT_NFS_NOSTALE_RO; | 1168 | opts->nfs = FAT_NFS_NOSTALE_RO; |
1104 | break; | 1169 | break; |
1170 | case Opt_dos1xfloppy: | ||
1171 | opts->dos1xfloppy = 1; | ||
1172 | break; | ||
1105 | 1173 | ||
1106 | /* msdos specific */ | 1174 | /* msdos specific */ |
1107 | case Opt_dots: | 1175 | case Opt_dots: |
@@ -1247,6 +1315,169 @@ static unsigned long calc_fat_clusters(struct super_block *sb) | |||
1247 | return sbi->fat_length * sb->s_blocksize * 8 / sbi->fat_bits; | 1315 | return sbi->fat_length * sb->s_blocksize * 8 / sbi->fat_bits; |
1248 | } | 1316 | } |
1249 | 1317 | ||
1318 | static bool fat_bpb_is_zero(struct fat_boot_sector *b) | ||
1319 | { | ||
1320 | if (get_unaligned_le16(&b->sector_size)) | ||
1321 | return false; | ||
1322 | if (b->sec_per_clus) | ||
1323 | return false; | ||
1324 | if (b->reserved) | ||
1325 | return false; | ||
1326 | if (b->fats) | ||
1327 | return false; | ||
1328 | if (get_unaligned_le16(&b->dir_entries)) | ||
1329 | return false; | ||
1330 | if (get_unaligned_le16(&b->sectors)) | ||
1331 | return false; | ||
1332 | if (b->media) | ||
1333 | return false; | ||
1334 | if (b->fat_length) | ||
1335 | return false; | ||
1336 | if (b->secs_track) | ||
1337 | return false; | ||
1338 | if (b->heads) | ||
1339 | return false; | ||
1340 | return true; | ||
1341 | } | ||
1342 | |||
1343 | static int fat_read_bpb(struct super_block *sb, struct fat_boot_sector *b, | ||
1344 | int silent, struct fat_bios_param_block *bpb) | ||
1345 | { | ||
1346 | int error = -EINVAL; | ||
1347 | |||
1348 | /* Read in BPB ... */ | ||
1349 | memset(bpb, 0, sizeof(*bpb)); | ||
1350 | bpb->fat_sector_size = get_unaligned_le16(&b->sector_size); | ||
1351 | bpb->fat_sec_per_clus = b->sec_per_clus; | ||
1352 | bpb->fat_reserved = le16_to_cpu(b->reserved); | ||
1353 | bpb->fat_fats = b->fats; | ||
1354 | bpb->fat_dir_entries = get_unaligned_le16(&b->dir_entries); | ||
1355 | bpb->fat_sectors = get_unaligned_le16(&b->sectors); | ||
1356 | bpb->fat_fat_length = le16_to_cpu(b->fat_length); | ||
1357 | bpb->fat_total_sect = le32_to_cpu(b->total_sect); | ||
1358 | |||
1359 | bpb->fat16_state = b->fat16.state; | ||
1360 | bpb->fat16_vol_id = get_unaligned_le32(b->fat16.vol_id); | ||
1361 | |||
1362 | bpb->fat32_length = le32_to_cpu(b->fat32.length); | ||
1363 | bpb->fat32_root_cluster = le32_to_cpu(b->fat32.root_cluster); | ||
1364 | bpb->fat32_info_sector = le16_to_cpu(b->fat32.info_sector); | ||
1365 | bpb->fat32_state = b->fat32.state; | ||
1366 | bpb->fat32_vol_id = get_unaligned_le32(b->fat32.vol_id); | ||
1367 | |||
1368 | /* Validate this looks like a FAT filesystem BPB */ | ||
1369 | if (!bpb->fat_reserved) { | ||
1370 | if (!silent) | ||
1371 | fat_msg(sb, KERN_ERR, | ||
1372 | "bogus number of reserved sectors"); | ||
1373 | goto out; | ||
1374 | } | ||
1375 | if (!bpb->fat_fats) { | ||
1376 | if (!silent) | ||
1377 | fat_msg(sb, KERN_ERR, "bogus number of FAT structure"); | ||
1378 | goto out; | ||
1379 | } | ||
1380 | |||
1381 | /* | ||
1382 | * Earlier we checked here that b->secs_track and b->head are nonzero, | ||
1383 | * but it turns out valid FAT filesystems can have zero there. | ||
1384 | */ | ||
1385 | |||
1386 | if (!fat_valid_media(b->media)) { | ||
1387 | if (!silent) | ||
1388 | fat_msg(sb, KERN_ERR, "invalid media value (0x%02x)", | ||
1389 | (unsigned)b->media); | ||
1390 | goto out; | ||
1391 | } | ||
1392 | |||
1393 | if (!is_power_of_2(bpb->fat_sector_size) | ||
1394 | || (bpb->fat_sector_size < 512) | ||
1395 | || (bpb->fat_sector_size > 4096)) { | ||
1396 | if (!silent) | ||
1397 | fat_msg(sb, KERN_ERR, "bogus logical sector size %u", | ||
1398 | (unsigned)bpb->fat_sector_size); | ||
1399 | goto out; | ||
1400 | } | ||
1401 | |||
1402 | if (!is_power_of_2(bpb->fat_sec_per_clus)) { | ||
1403 | if (!silent) | ||
1404 | fat_msg(sb, KERN_ERR, "bogus sectors per cluster %u", | ||
1405 | (unsigned)bpb->fat_sec_per_clus); | ||
1406 | goto out; | ||
1407 | } | ||
1408 | |||
1409 | error = 0; | ||
1410 | |||
1411 | out: | ||
1412 | return error; | ||
1413 | } | ||
1414 | |||
1415 | static int fat_read_static_bpb(struct super_block *sb, | ||
1416 | struct fat_boot_sector *b, int silent, | ||
1417 | struct fat_bios_param_block *bpb) | ||
1418 | { | ||
1419 | static const char *notdos1x = "This doesn't look like a DOS 1.x volume"; | ||
1420 | |||
1421 | struct fat_floppy_defaults *fdefaults = NULL; | ||
1422 | int error = -EINVAL; | ||
1423 | sector_t bd_sects; | ||
1424 | unsigned i; | ||
1425 | |||
1426 | bd_sects = i_size_read(sb->s_bdev->bd_inode) / SECTOR_SIZE; | ||
1427 | |||
1428 | /* 16-bit DOS 1.x reliably wrote bootstrap short-jmp code */ | ||
1429 | if (b->ignored[0] != 0xeb || b->ignored[2] != 0x90) { | ||
1430 | if (!silent) | ||
1431 | fat_msg(sb, KERN_ERR, | ||
1432 | "%s; no bootstrapping code", notdos1x); | ||
1433 | goto out; | ||
1434 | } | ||
1435 | |||
1436 | /* | ||
1437 | * If any value in this region is non-zero, it isn't archaic | ||
1438 | * DOS. | ||
1439 | */ | ||
1440 | if (!fat_bpb_is_zero(b)) { | ||
1441 | if (!silent) | ||
1442 | fat_msg(sb, KERN_ERR, | ||
1443 | "%s; DOS 2.x BPB is non-zero", notdos1x); | ||
1444 | goto out; | ||
1445 | } | ||
1446 | |||
1447 | for (i = 0; i < ARRAY_SIZE(floppy_defaults); i++) { | ||
1448 | if (floppy_defaults[i].nr_sectors == bd_sects) { | ||
1449 | fdefaults = &floppy_defaults[i]; | ||
1450 | break; | ||
1451 | } | ||
1452 | } | ||
1453 | |||
1454 | if (fdefaults == NULL) { | ||
1455 | if (!silent) | ||
1456 | fat_msg(sb, KERN_WARNING, | ||
1457 | "This looks like a DOS 1.x volume, but isn't a recognized floppy size (%llu sectors)", | ||
1458 | (u64)bd_sects); | ||
1459 | goto out; | ||
1460 | } | ||
1461 | |||
1462 | if (!silent) | ||
1463 | fat_msg(sb, KERN_INFO, | ||
1464 | "This looks like a DOS 1.x volume; assuming default BPB values"); | ||
1465 | |||
1466 | memset(bpb, 0, sizeof(*bpb)); | ||
1467 | bpb->fat_sector_size = SECTOR_SIZE; | ||
1468 | bpb->fat_sec_per_clus = fdefaults->sec_per_clus; | ||
1469 | bpb->fat_reserved = 1; | ||
1470 | bpb->fat_fats = 2; | ||
1471 | bpb->fat_dir_entries = fdefaults->dir_entries; | ||
1472 | bpb->fat_sectors = fdefaults->nr_sectors; | ||
1473 | bpb->fat_fat_length = fdefaults->fat_length; | ||
1474 | |||
1475 | error = 0; | ||
1476 | |||
1477 | out: | ||
1478 | return error; | ||
1479 | } | ||
1480 | |||
1250 | /* | 1481 | /* |
1251 | * Read the super block of an MS-DOS FS. | 1482 | * Read the super block of an MS-DOS FS. |
1252 | */ | 1483 | */ |
@@ -1256,12 +1487,11 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat, | |||
1256 | struct inode *root_inode = NULL, *fat_inode = NULL; | 1487 | struct inode *root_inode = NULL, *fat_inode = NULL; |
1257 | struct inode *fsinfo_inode = NULL; | 1488 | struct inode *fsinfo_inode = NULL; |
1258 | struct buffer_head *bh; | 1489 | struct buffer_head *bh; |
1259 | struct fat_boot_sector *b; | 1490 | struct fat_bios_param_block bpb; |
1260 | struct msdos_sb_info *sbi; | 1491 | struct msdos_sb_info *sbi; |
1261 | u16 logical_sector_size; | 1492 | u16 logical_sector_size; |
1262 | u32 total_sectors, total_clusters, fat_clusters, rootdir_sectors; | 1493 | u32 total_sectors, total_clusters, fat_clusters, rootdir_sectors; |
1263 | int debug; | 1494 | int debug; |
1264 | unsigned int media; | ||
1265 | long error; | 1495 | long error; |
1266 | char buf[50]; | 1496 | char buf[50]; |
1267 | 1497 | ||
@@ -1298,100 +1528,72 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat, | |||
1298 | goto out_fail; | 1528 | goto out_fail; |
1299 | } | 1529 | } |
1300 | 1530 | ||
1301 | b = (struct fat_boot_sector *) bh->b_data; | 1531 | error = fat_read_bpb(sb, (struct fat_boot_sector *)bh->b_data, silent, |
1302 | if (!b->reserved) { | 1532 | &bpb); |
1303 | if (!silent) | 1533 | if (error == -EINVAL && sbi->options.dos1xfloppy) |
1304 | fat_msg(sb, KERN_ERR, "bogus number of reserved sectors"); | 1534 | error = fat_read_static_bpb(sb, |
1305 | brelse(bh); | 1535 | (struct fat_boot_sector *)bh->b_data, silent, &bpb); |
1306 | goto out_invalid; | 1536 | brelse(bh); |
1307 | } | ||
1308 | if (!b->fats) { | ||
1309 | if (!silent) | ||
1310 | fat_msg(sb, KERN_ERR, "bogus number of FAT structure"); | ||
1311 | brelse(bh); | ||
1312 | goto out_invalid; | ||
1313 | } | ||
1314 | |||
1315 | /* | ||
1316 | * Earlier we checked here that b->secs_track and b->head are nonzero, | ||
1317 | * but it turns out valid FAT filesystems can have zero there. | ||
1318 | */ | ||
1319 | 1537 | ||
1320 | media = b->media; | 1538 | if (error == -EINVAL) |
1321 | if (!fat_valid_media(media)) { | ||
1322 | if (!silent) | ||
1323 | fat_msg(sb, KERN_ERR, "invalid media value (0x%02x)", | ||
1324 | media); | ||
1325 | brelse(bh); | ||
1326 | goto out_invalid; | ||
1327 | } | ||
1328 | logical_sector_size = get_unaligned_le16(&b->sector_size); | ||
1329 | if (!is_power_of_2(logical_sector_size) | ||
1330 | || (logical_sector_size < 512) | ||
1331 | || (logical_sector_size > 4096)) { | ||
1332 | if (!silent) | ||
1333 | fat_msg(sb, KERN_ERR, "bogus logical sector size %u", | ||
1334 | logical_sector_size); | ||
1335 | brelse(bh); | ||
1336 | goto out_invalid; | ||
1337 | } | ||
1338 | sbi->sec_per_clus = b->sec_per_clus; | ||
1339 | if (!is_power_of_2(sbi->sec_per_clus)) { | ||
1340 | if (!silent) | ||
1341 | fat_msg(sb, KERN_ERR, "bogus sectors per cluster %u", | ||
1342 | sbi->sec_per_clus); | ||
1343 | brelse(bh); | ||
1344 | goto out_invalid; | 1539 | goto out_invalid; |
1345 | } | 1540 | else if (error) |
1541 | goto out_fail; | ||
1542 | |||
1543 | logical_sector_size = bpb.fat_sector_size; | ||
1544 | sbi->sec_per_clus = bpb.fat_sec_per_clus; | ||
1346 | 1545 | ||
1546 | error = -EIO; | ||
1347 | if (logical_sector_size < sb->s_blocksize) { | 1547 | if (logical_sector_size < sb->s_blocksize) { |
1348 | fat_msg(sb, KERN_ERR, "logical sector size too small for device" | 1548 | fat_msg(sb, KERN_ERR, "logical sector size too small for device" |
1349 | " (logical sector size = %u)", logical_sector_size); | 1549 | " (logical sector size = %u)", logical_sector_size); |
1350 | brelse(bh); | ||
1351 | goto out_fail; | 1550 | goto out_fail; |
1352 | } | 1551 | } |
1552 | |||
1353 | if (logical_sector_size > sb->s_blocksize) { | 1553 | if (logical_sector_size > sb->s_blocksize) { |
1354 | brelse(bh); | 1554 | struct buffer_head *bh_resize; |
1355 | 1555 | ||
1356 | if (!sb_set_blocksize(sb, logical_sector_size)) { | 1556 | if (!sb_set_blocksize(sb, logical_sector_size)) { |
1357 | fat_msg(sb, KERN_ERR, "unable to set blocksize %u", | 1557 | fat_msg(sb, KERN_ERR, "unable to set blocksize %u", |
1358 | logical_sector_size); | 1558 | logical_sector_size); |
1359 | goto out_fail; | 1559 | goto out_fail; |
1360 | } | 1560 | } |
1361 | bh = sb_bread(sb, 0); | 1561 | |
1362 | if (bh == NULL) { | 1562 | /* Verify that the larger boot sector is fully readable */ |
1563 | bh_resize = sb_bread(sb, 0); | ||
1564 | if (bh_resize == NULL) { | ||
1363 | fat_msg(sb, KERN_ERR, "unable to read boot sector" | 1565 | fat_msg(sb, KERN_ERR, "unable to read boot sector" |
1364 | " (logical sector size = %lu)", | 1566 | " (logical sector size = %lu)", |
1365 | sb->s_blocksize); | 1567 | sb->s_blocksize); |
1366 | goto out_fail; | 1568 | goto out_fail; |
1367 | } | 1569 | } |
1368 | b = (struct fat_boot_sector *) bh->b_data; | 1570 | brelse(bh_resize); |
1369 | } | 1571 | } |
1370 | 1572 | ||
1371 | mutex_init(&sbi->s_lock); | 1573 | mutex_init(&sbi->s_lock); |
1372 | sbi->cluster_size = sb->s_blocksize * sbi->sec_per_clus; | 1574 | sbi->cluster_size = sb->s_blocksize * sbi->sec_per_clus; |
1373 | sbi->cluster_bits = ffs(sbi->cluster_size) - 1; | 1575 | sbi->cluster_bits = ffs(sbi->cluster_size) - 1; |
1374 | sbi->fats = b->fats; | 1576 | sbi->fats = bpb.fat_fats; |
1375 | sbi->fat_bits = 0; /* Don't know yet */ | 1577 | sbi->fat_bits = 0; /* Don't know yet */ |
1376 | sbi->fat_start = le16_to_cpu(b->reserved); | 1578 | sbi->fat_start = bpb.fat_reserved; |
1377 | sbi->fat_length = le16_to_cpu(b->fat_length); | 1579 | sbi->fat_length = bpb.fat_fat_length; |
1378 | sbi->root_cluster = 0; | 1580 | sbi->root_cluster = 0; |
1379 | sbi->free_clusters = -1; /* Don't know yet */ | 1581 | sbi->free_clusters = -1; /* Don't know yet */ |
1380 | sbi->free_clus_valid = 0; | 1582 | sbi->free_clus_valid = 0; |
1381 | sbi->prev_free = FAT_START_ENT; | 1583 | sbi->prev_free = FAT_START_ENT; |
1382 | sb->s_maxbytes = 0xffffffff; | 1584 | sb->s_maxbytes = 0xffffffff; |
1383 | 1585 | ||
1384 | if (!sbi->fat_length && b->fat32.length) { | 1586 | if (!sbi->fat_length && bpb.fat32_length) { |
1385 | struct fat_boot_fsinfo *fsinfo; | 1587 | struct fat_boot_fsinfo *fsinfo; |
1386 | struct buffer_head *fsinfo_bh; | 1588 | struct buffer_head *fsinfo_bh; |
1387 | 1589 | ||
1388 | /* Must be FAT32 */ | 1590 | /* Must be FAT32 */ |
1389 | sbi->fat_bits = 32; | 1591 | sbi->fat_bits = 32; |
1390 | sbi->fat_length = le32_to_cpu(b->fat32.length); | 1592 | sbi->fat_length = bpb.fat32_length; |
1391 | sbi->root_cluster = le32_to_cpu(b->fat32.root_cluster); | 1593 | sbi->root_cluster = bpb.fat32_root_cluster; |
1392 | 1594 | ||
1393 | /* MC - if info_sector is 0, don't multiply by 0 */ | 1595 | /* MC - if info_sector is 0, don't multiply by 0 */ |
1394 | sbi->fsinfo_sector = le16_to_cpu(b->fat32.info_sector); | 1596 | sbi->fsinfo_sector = bpb.fat32_info_sector; |
1395 | if (sbi->fsinfo_sector == 0) | 1597 | if (sbi->fsinfo_sector == 0) |
1396 | sbi->fsinfo_sector = 1; | 1598 | sbi->fsinfo_sector = 1; |
1397 | 1599 | ||
@@ -1399,7 +1601,6 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat, | |||
1399 | if (fsinfo_bh == NULL) { | 1601 | if (fsinfo_bh == NULL) { |
1400 | fat_msg(sb, KERN_ERR, "bread failed, FSINFO block" | 1602 | fat_msg(sb, KERN_ERR, "bread failed, FSINFO block" |
1401 | " (sector = %lu)", sbi->fsinfo_sector); | 1603 | " (sector = %lu)", sbi->fsinfo_sector); |
1402 | brelse(bh); | ||
1403 | goto out_fail; | 1604 | goto out_fail; |
1404 | } | 1605 | } |
1405 | 1606 | ||
@@ -1422,35 +1623,28 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat, | |||
1422 | 1623 | ||
1423 | /* interpret volume ID as a little endian 32 bit integer */ | 1624 | /* interpret volume ID as a little endian 32 bit integer */ |
1424 | if (sbi->fat_bits == 32) | 1625 | if (sbi->fat_bits == 32) |
1425 | sbi->vol_id = (((u32)b->fat32.vol_id[0]) | | 1626 | sbi->vol_id = bpb.fat32_vol_id; |
1426 | ((u32)b->fat32.vol_id[1] << 8) | | ||
1427 | ((u32)b->fat32.vol_id[2] << 16) | | ||
1428 | ((u32)b->fat32.vol_id[3] << 24)); | ||
1429 | else /* fat 16 or 12 */ | 1627 | else /* fat 16 or 12 */ |
1430 | sbi->vol_id = (((u32)b->fat16.vol_id[0]) | | 1628 | sbi->vol_id = bpb.fat16_vol_id; |
1431 | ((u32)b->fat16.vol_id[1] << 8) | | ||
1432 | ((u32)b->fat16.vol_id[2] << 16) | | ||
1433 | ((u32)b->fat16.vol_id[3] << 24)); | ||
1434 | 1629 | ||
1435 | sbi->dir_per_block = sb->s_blocksize / sizeof(struct msdos_dir_entry); | 1630 | sbi->dir_per_block = sb->s_blocksize / sizeof(struct msdos_dir_entry); |
1436 | sbi->dir_per_block_bits = ffs(sbi->dir_per_block) - 1; | 1631 | sbi->dir_per_block_bits = ffs(sbi->dir_per_block) - 1; |
1437 | 1632 | ||
1438 | sbi->dir_start = sbi->fat_start + sbi->fats * sbi->fat_length; | 1633 | sbi->dir_start = sbi->fat_start + sbi->fats * sbi->fat_length; |
1439 | sbi->dir_entries = get_unaligned_le16(&b->dir_entries); | 1634 | sbi->dir_entries = bpb.fat_dir_entries; |
1440 | if (sbi->dir_entries & (sbi->dir_per_block - 1)) { | 1635 | if (sbi->dir_entries & (sbi->dir_per_block - 1)) { |
1441 | if (!silent) | 1636 | if (!silent) |
1442 | fat_msg(sb, KERN_ERR, "bogus directory-entries per block" | 1637 | fat_msg(sb, KERN_ERR, "bogus directory-entries per block" |
1443 | " (%u)", sbi->dir_entries); | 1638 | " (%u)", sbi->dir_entries); |
1444 | brelse(bh); | ||
1445 | goto out_invalid; | 1639 | goto out_invalid; |
1446 | } | 1640 | } |
1447 | 1641 | ||
1448 | rootdir_sectors = sbi->dir_entries | 1642 | rootdir_sectors = sbi->dir_entries |
1449 | * sizeof(struct msdos_dir_entry) / sb->s_blocksize; | 1643 | * sizeof(struct msdos_dir_entry) / sb->s_blocksize; |
1450 | sbi->data_start = sbi->dir_start + rootdir_sectors; | 1644 | sbi->data_start = sbi->dir_start + rootdir_sectors; |
1451 | total_sectors = get_unaligned_le16(&b->sectors); | 1645 | total_sectors = bpb.fat_sectors; |
1452 | if (total_sectors == 0) | 1646 | if (total_sectors == 0) |
1453 | total_sectors = le32_to_cpu(b->total_sect); | 1647 | total_sectors = bpb.fat_total_sect; |
1454 | 1648 | ||
1455 | total_clusters = (total_sectors - sbi->data_start) / sbi->sec_per_clus; | 1649 | total_clusters = (total_sectors - sbi->data_start) / sbi->sec_per_clus; |
1456 | 1650 | ||
@@ -1459,9 +1653,9 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat, | |||
1459 | 1653 | ||
1460 | /* some OSes set FAT_STATE_DIRTY and clean it on unmount. */ | 1654 | /* some OSes set FAT_STATE_DIRTY and clean it on unmount. */ |
1461 | if (sbi->fat_bits == 32) | 1655 | if (sbi->fat_bits == 32) |
1462 | sbi->dirty = b->fat32.state & FAT_STATE_DIRTY; | 1656 | sbi->dirty = bpb.fat32_state & FAT_STATE_DIRTY; |
1463 | else /* fat 16 or 12 */ | 1657 | else /* fat 16 or 12 */ |
1464 | sbi->dirty = b->fat16.state & FAT_STATE_DIRTY; | 1658 | sbi->dirty = bpb.fat16_state & FAT_STATE_DIRTY; |
1465 | 1659 | ||
1466 | /* check that FAT table does not overflow */ | 1660 | /* check that FAT table does not overflow */ |
1467 | fat_clusters = calc_fat_clusters(sb); | 1661 | fat_clusters = calc_fat_clusters(sb); |
@@ -1470,7 +1664,6 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat, | |||
1470 | if (!silent) | 1664 | if (!silent) |
1471 | fat_msg(sb, KERN_ERR, "count of clusters too big (%u)", | 1665 | fat_msg(sb, KERN_ERR, "count of clusters too big (%u)", |
1472 | total_clusters); | 1666 | total_clusters); |
1473 | brelse(bh); | ||
1474 | goto out_invalid; | 1667 | goto out_invalid; |
1475 | } | 1668 | } |
1476 | 1669 | ||
@@ -1483,8 +1676,6 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat, | |||
1483 | if (sbi->prev_free < FAT_START_ENT) | 1676 | if (sbi->prev_free < FAT_START_ENT) |
1484 | sbi->prev_free = FAT_START_ENT; | 1677 | sbi->prev_free = FAT_START_ENT; |
1485 | 1678 | ||
1486 | brelse(bh); | ||
1487 | |||
1488 | /* set up enough so that it can read an inode */ | 1679 | /* set up enough so that it can read an inode */ |
1489 | fat_hash_init(sb); | 1680 | fat_hash_init(sb); |
1490 | dir_hash_init(sb); | 1681 | dir_hash_init(sb); |
diff --git a/fs/file_table.c b/fs/file_table.c index a374f5033e97..40bf4660f0a3 100644 --- a/fs/file_table.c +++ b/fs/file_table.c | |||
@@ -76,14 +76,14 @@ EXPORT_SYMBOL_GPL(get_max_files); | |||
76 | * Handle nr_files sysctl | 76 | * Handle nr_files sysctl |
77 | */ | 77 | */ |
78 | #if defined(CONFIG_SYSCTL) && defined(CONFIG_PROC_FS) | 78 | #if defined(CONFIG_SYSCTL) && defined(CONFIG_PROC_FS) |
79 | int proc_nr_files(ctl_table *table, int write, | 79 | int proc_nr_files(struct ctl_table *table, int write, |
80 | void __user *buffer, size_t *lenp, loff_t *ppos) | 80 | void __user *buffer, size_t *lenp, loff_t *ppos) |
81 | { | 81 | { |
82 | files_stat.nr_files = get_nr_files(); | 82 | files_stat.nr_files = get_nr_files(); |
83 | return proc_doulongvec_minmax(table, write, buffer, lenp, ppos); | 83 | return proc_doulongvec_minmax(table, write, buffer, lenp, ppos); |
84 | } | 84 | } |
85 | #else | 85 | #else |
86 | int proc_nr_files(ctl_table *table, int write, | 86 | int proc_nr_files(struct ctl_table *table, int write, |
87 | void __user *buffer, size_t *lenp, loff_t *ppos) | 87 | void __user *buffer, size_t *lenp, loff_t *ppos) |
88 | { | 88 | { |
89 | return -ENOSYS; | 89 | return -ENOSYS; |
diff --git a/fs/fscache/main.c b/fs/fscache/main.c index acd4bf1fc277..63f868e869b9 100644 --- a/fs/fscache/main.c +++ b/fs/fscache/main.c | |||
@@ -67,7 +67,7 @@ static int fscache_max_active_sysctl(struct ctl_table *table, int write, | |||
67 | return ret; | 67 | return ret; |
68 | } | 68 | } |
69 | 69 | ||
70 | ctl_table fscache_sysctls[] = { | 70 | struct ctl_table fscache_sysctls[] = { |
71 | { | 71 | { |
72 | .procname = "object_max_active", | 72 | .procname = "object_max_active", |
73 | .data = &fscache_object_max_active, | 73 | .data = &fscache_object_max_active, |
@@ -87,7 +87,7 @@ ctl_table fscache_sysctls[] = { | |||
87 | {} | 87 | {} |
88 | }; | 88 | }; |
89 | 89 | ||
90 | ctl_table fscache_sysctls_root[] = { | 90 | struct ctl_table fscache_sysctls_root[] = { |
91 | { | 91 | { |
92 | .procname = "fscache", | 92 | .procname = "fscache", |
93 | .mode = 0555, | 93 | .mode = 0555, |
diff --git a/fs/hfsplus/attributes.c b/fs/hfsplus/attributes.c index caf89a7be0a1..e5b221de7de6 100644 --- a/fs/hfsplus/attributes.c +++ b/fs/hfsplus/attributes.c | |||
@@ -54,14 +54,11 @@ int hfsplus_attr_build_key(struct super_block *sb, hfsplus_btree_key *key, | |||
54 | memset(key, 0, sizeof(struct hfsplus_attr_key)); | 54 | memset(key, 0, sizeof(struct hfsplus_attr_key)); |
55 | key->attr.cnid = cpu_to_be32(cnid); | 55 | key->attr.cnid = cpu_to_be32(cnid); |
56 | if (name) { | 56 | if (name) { |
57 | len = strlen(name); | 57 | int res = hfsplus_asc2uni(sb, |
58 | if (len > HFSPLUS_ATTR_MAX_STRLEN) { | ||
59 | pr_err("invalid xattr name's length\n"); | ||
60 | return -EINVAL; | ||
61 | } | ||
62 | hfsplus_asc2uni(sb, | ||
63 | (struct hfsplus_unistr *)&key->attr.key_name, | 58 | (struct hfsplus_unistr *)&key->attr.key_name, |
64 | HFSPLUS_ATTR_MAX_STRLEN, name, len); | 59 | HFSPLUS_ATTR_MAX_STRLEN, name, strlen(name)); |
60 | if (res) | ||
61 | return res; | ||
65 | len = be16_to_cpu(key->attr.key_name.length); | 62 | len = be16_to_cpu(key->attr.key_name.length); |
66 | } else { | 63 | } else { |
67 | key->attr.key_name.length = 0; | 64 | key->attr.key_name.length = 0; |
@@ -82,31 +79,6 @@ int hfsplus_attr_build_key(struct super_block *sb, hfsplus_btree_key *key, | |||
82 | return 0; | 79 | return 0; |
83 | } | 80 | } |
84 | 81 | ||
85 | void hfsplus_attr_build_key_uni(hfsplus_btree_key *key, | ||
86 | u32 cnid, | ||
87 | struct hfsplus_attr_unistr *name) | ||
88 | { | ||
89 | int ustrlen; | ||
90 | |||
91 | memset(key, 0, sizeof(struct hfsplus_attr_key)); | ||
92 | ustrlen = be16_to_cpu(name->length); | ||
93 | key->attr.cnid = cpu_to_be32(cnid); | ||
94 | key->attr.key_name.length = cpu_to_be16(ustrlen); | ||
95 | ustrlen *= 2; | ||
96 | memcpy(key->attr.key_name.unicode, name->unicode, ustrlen); | ||
97 | |||
98 | /* The length of the key, as stored in key_len field, does not include | ||
99 | * the size of the key_len field itself. | ||
100 | * So, offsetof(hfsplus_attr_key, key_name) is a trick because | ||
101 | * it takes into consideration key_len field (__be16) of | ||
102 | * hfsplus_attr_key structure instead of length field (__be16) of | ||
103 | * hfsplus_attr_unistr structure. | ||
104 | */ | ||
105 | key->key_len = | ||
106 | cpu_to_be16(offsetof(struct hfsplus_attr_key, key_name) + | ||
107 | ustrlen); | ||
108 | } | ||
109 | |||
110 | hfsplus_attr_entry *hfsplus_alloc_attr_entry(void) | 82 | hfsplus_attr_entry *hfsplus_alloc_attr_entry(void) |
111 | { | 83 | { |
112 | return kmem_cache_alloc(hfsplus_attr_tree_cachep, GFP_KERNEL); | 84 | return kmem_cache_alloc(hfsplus_attr_tree_cachep, GFP_KERNEL); |
diff --git a/fs/hfsplus/bnode.c b/fs/hfsplus/bnode.c index 11c860204520..759708fd9331 100644 --- a/fs/hfsplus/bnode.c +++ b/fs/hfsplus/bnode.c | |||
@@ -27,13 +27,13 @@ void hfs_bnode_read(struct hfs_bnode *node, void *buf, int off, int len) | |||
27 | pagep = node->page + (off >> PAGE_CACHE_SHIFT); | 27 | pagep = node->page + (off >> PAGE_CACHE_SHIFT); |
28 | off &= ~PAGE_CACHE_MASK; | 28 | off &= ~PAGE_CACHE_MASK; |
29 | 29 | ||
30 | l = min(len, (int)PAGE_CACHE_SIZE - off); | 30 | l = min_t(int, len, PAGE_CACHE_SIZE - off); |
31 | memcpy(buf, kmap(*pagep) + off, l); | 31 | memcpy(buf, kmap(*pagep) + off, l); |
32 | kunmap(*pagep); | 32 | kunmap(*pagep); |
33 | 33 | ||
34 | while ((len -= l) != 0) { | 34 | while ((len -= l) != 0) { |
35 | buf += l; | 35 | buf += l; |
36 | l = min(len, (int)PAGE_CACHE_SIZE); | 36 | l = min_t(int, len, PAGE_CACHE_SIZE); |
37 | memcpy(buf, kmap(*++pagep), l); | 37 | memcpy(buf, kmap(*++pagep), l); |
38 | kunmap(*pagep); | 38 | kunmap(*pagep); |
39 | } | 39 | } |
@@ -80,14 +80,14 @@ void hfs_bnode_write(struct hfs_bnode *node, void *buf, int off, int len) | |||
80 | pagep = node->page + (off >> PAGE_CACHE_SHIFT); | 80 | pagep = node->page + (off >> PAGE_CACHE_SHIFT); |
81 | off &= ~PAGE_CACHE_MASK; | 81 | off &= ~PAGE_CACHE_MASK; |
82 | 82 | ||
83 | l = min(len, (int)PAGE_CACHE_SIZE - off); | 83 | l = min_t(int, len, PAGE_CACHE_SIZE - off); |
84 | memcpy(kmap(*pagep) + off, buf, l); | 84 | memcpy(kmap(*pagep) + off, buf, l); |
85 | set_page_dirty(*pagep); | 85 | set_page_dirty(*pagep); |
86 | kunmap(*pagep); | 86 | kunmap(*pagep); |
87 | 87 | ||
88 | while ((len -= l) != 0) { | 88 | while ((len -= l) != 0) { |
89 | buf += l; | 89 | buf += l; |
90 | l = min(len, (int)PAGE_CACHE_SIZE); | 90 | l = min_t(int, len, PAGE_CACHE_SIZE); |
91 | memcpy(kmap(*++pagep), buf, l); | 91 | memcpy(kmap(*++pagep), buf, l); |
92 | set_page_dirty(*pagep); | 92 | set_page_dirty(*pagep); |
93 | kunmap(*pagep); | 93 | kunmap(*pagep); |
@@ -110,13 +110,13 @@ void hfs_bnode_clear(struct hfs_bnode *node, int off, int len) | |||
110 | pagep = node->page + (off >> PAGE_CACHE_SHIFT); | 110 | pagep = node->page + (off >> PAGE_CACHE_SHIFT); |
111 | off &= ~PAGE_CACHE_MASK; | 111 | off &= ~PAGE_CACHE_MASK; |
112 | 112 | ||
113 | l = min(len, (int)PAGE_CACHE_SIZE - off); | 113 | l = min_t(int, len, PAGE_CACHE_SIZE - off); |
114 | memset(kmap(*pagep) + off, 0, l); | 114 | memset(kmap(*pagep) + off, 0, l); |
115 | set_page_dirty(*pagep); | 115 | set_page_dirty(*pagep); |
116 | kunmap(*pagep); | 116 | kunmap(*pagep); |
117 | 117 | ||
118 | while ((len -= l) != 0) { | 118 | while ((len -= l) != 0) { |
119 | l = min(len, (int)PAGE_CACHE_SIZE); | 119 | l = min_t(int, len, PAGE_CACHE_SIZE); |
120 | memset(kmap(*++pagep), 0, l); | 120 | memset(kmap(*++pagep), 0, l); |
121 | set_page_dirty(*pagep); | 121 | set_page_dirty(*pagep); |
122 | kunmap(*pagep); | 122 | kunmap(*pagep); |
@@ -142,14 +142,14 @@ void hfs_bnode_copy(struct hfs_bnode *dst_node, int dst, | |||
142 | dst &= ~PAGE_CACHE_MASK; | 142 | dst &= ~PAGE_CACHE_MASK; |
143 | 143 | ||
144 | if (src == dst) { | 144 | if (src == dst) { |
145 | l = min(len, (int)PAGE_CACHE_SIZE - src); | 145 | l = min_t(int, len, PAGE_CACHE_SIZE - src); |
146 | memcpy(kmap(*dst_page) + src, kmap(*src_page) + src, l); | 146 | memcpy(kmap(*dst_page) + src, kmap(*src_page) + src, l); |
147 | kunmap(*src_page); | 147 | kunmap(*src_page); |
148 | set_page_dirty(*dst_page); | 148 | set_page_dirty(*dst_page); |
149 | kunmap(*dst_page); | 149 | kunmap(*dst_page); |
150 | 150 | ||
151 | while ((len -= l) != 0) { | 151 | while ((len -= l) != 0) { |
152 | l = min(len, (int)PAGE_CACHE_SIZE); | 152 | l = min_t(int, len, PAGE_CACHE_SIZE); |
153 | memcpy(kmap(*++dst_page), kmap(*++src_page), l); | 153 | memcpy(kmap(*++dst_page), kmap(*++src_page), l); |
154 | kunmap(*src_page); | 154 | kunmap(*src_page); |
155 | set_page_dirty(*dst_page); | 155 | set_page_dirty(*dst_page); |
@@ -251,7 +251,7 @@ void hfs_bnode_move(struct hfs_bnode *node, int dst, int src, int len) | |||
251 | dst &= ~PAGE_CACHE_MASK; | 251 | dst &= ~PAGE_CACHE_MASK; |
252 | 252 | ||
253 | if (src == dst) { | 253 | if (src == dst) { |
254 | l = min(len, (int)PAGE_CACHE_SIZE - src); | 254 | l = min_t(int, len, PAGE_CACHE_SIZE - src); |
255 | memmove(kmap(*dst_page) + src, | 255 | memmove(kmap(*dst_page) + src, |
256 | kmap(*src_page) + src, l); | 256 | kmap(*src_page) + src, l); |
257 | kunmap(*src_page); | 257 | kunmap(*src_page); |
@@ -259,7 +259,7 @@ void hfs_bnode_move(struct hfs_bnode *node, int dst, int src, int len) | |||
259 | kunmap(*dst_page); | 259 | kunmap(*dst_page); |
260 | 260 | ||
261 | while ((len -= l) != 0) { | 261 | while ((len -= l) != 0) { |
262 | l = min(len, (int)PAGE_CACHE_SIZE); | 262 | l = min_t(int, len, PAGE_CACHE_SIZE); |
263 | memmove(kmap(*++dst_page), | 263 | memmove(kmap(*++dst_page), |
264 | kmap(*++src_page), l); | 264 | kmap(*++src_page), l); |
265 | kunmap(*src_page); | 265 | kunmap(*src_page); |
@@ -386,9 +386,8 @@ struct hfs_bnode *hfs_bnode_findhash(struct hfs_btree *tree, u32 cnid) | |||
386 | struct hfs_bnode *node; | 386 | struct hfs_bnode *node; |
387 | 387 | ||
388 | if (cnid >= tree->node_count) { | 388 | if (cnid >= tree->node_count) { |
389 | pr_err("request for non-existent node " | 389 | pr_err("request for non-existent node %d in B*Tree\n", |
390 | "%d in B*Tree\n", | 390 | cnid); |
391 | cnid); | ||
392 | return NULL; | 391 | return NULL; |
393 | } | 392 | } |
394 | 393 | ||
@@ -409,9 +408,8 @@ static struct hfs_bnode *__hfs_bnode_create(struct hfs_btree *tree, u32 cnid) | |||
409 | loff_t off; | 408 | loff_t off; |
410 | 409 | ||
411 | if (cnid >= tree->node_count) { | 410 | if (cnid >= tree->node_count) { |
412 | pr_err("request for non-existent node " | 411 | pr_err("request for non-existent node %d in B*Tree\n", |
413 | "%d in B*Tree\n", | 412 | cnid); |
414 | cnid); | ||
415 | return NULL; | 413 | return NULL; |
416 | } | 414 | } |
417 | 415 | ||
@@ -602,7 +600,7 @@ struct hfs_bnode *hfs_bnode_create(struct hfs_btree *tree, u32 num) | |||
602 | 600 | ||
603 | pagep = node->page; | 601 | pagep = node->page; |
604 | memset(kmap(*pagep) + node->page_offset, 0, | 602 | memset(kmap(*pagep) + node->page_offset, 0, |
605 | min((int)PAGE_CACHE_SIZE, (int)tree->node_size)); | 603 | min_t(int, PAGE_CACHE_SIZE, tree->node_size)); |
606 | set_page_dirty(*pagep); | 604 | set_page_dirty(*pagep); |
607 | kunmap(*pagep); | 605 | kunmap(*pagep); |
608 | for (i = 1; i < tree->pages_per_bnode; i++) { | 606 | for (i = 1; i < tree->pages_per_bnode; i++) { |
@@ -648,8 +646,8 @@ void hfs_bnode_put(struct hfs_bnode *node) | |||
648 | if (test_bit(HFS_BNODE_DELETED, &node->flags)) { | 646 | if (test_bit(HFS_BNODE_DELETED, &node->flags)) { |
649 | hfs_bnode_unhash(node); | 647 | hfs_bnode_unhash(node); |
650 | spin_unlock(&tree->hash_lock); | 648 | spin_unlock(&tree->hash_lock); |
651 | hfs_bnode_clear(node, 0, | 649 | if (hfs_bnode_need_zeroout(tree)) |
652 | PAGE_CACHE_SIZE * tree->pages_per_bnode); | 650 | hfs_bnode_clear(node, 0, tree->node_size); |
653 | hfs_bmap_free(node); | 651 | hfs_bmap_free(node); |
654 | hfs_bnode_free(node); | 652 | hfs_bnode_free(node); |
655 | return; | 653 | return; |
@@ -658,3 +656,16 @@ void hfs_bnode_put(struct hfs_bnode *node) | |||
658 | } | 656 | } |
659 | } | 657 | } |
660 | 658 | ||
659 | /* | ||
660 | * Unused nodes have to be zeroed if this is the catalog tree and | ||
661 | * a corresponding flag in the volume header is set. | ||
662 | */ | ||
663 | bool hfs_bnode_need_zeroout(struct hfs_btree *tree) | ||
664 | { | ||
665 | struct super_block *sb = tree->inode->i_sb; | ||
666 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); | ||
667 | const u32 volume_attr = be32_to_cpu(sbi->s_vhdr->attributes); | ||
668 | |||
669 | return tree->cnid == HFSPLUS_CAT_CNID && | ||
670 | volume_attr & HFSPLUS_VOL_UNUSED_NODE_FIX; | ||
671 | } | ||
diff --git a/fs/hfsplus/btree.c b/fs/hfsplus/btree.c index 0fcec8b2a90b..3345c7553edc 100644 --- a/fs/hfsplus/btree.c +++ b/fs/hfsplus/btree.c | |||
@@ -358,7 +358,7 @@ struct hfs_bnode *hfs_bmap_alloc(struct hfs_btree *tree) | |||
358 | u32 count; | 358 | u32 count; |
359 | int res; | 359 | int res; |
360 | 360 | ||
361 | res = hfsplus_file_extend(inode); | 361 | res = hfsplus_file_extend(inode, hfs_bnode_need_zeroout(tree)); |
362 | if (res) | 362 | if (res) |
363 | return ERR_PTR(res); | 363 | return ERR_PTR(res); |
364 | hip->phys_size = inode->i_size = | 364 | hip->phys_size = inode->i_size = |
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c index bdec66522de3..610a3260bef1 100644 --- a/fs/hfsplus/dir.c +++ b/fs/hfsplus/dir.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/fs.h> | 12 | #include <linux/fs.h> |
13 | #include <linux/slab.h> | 13 | #include <linux/slab.h> |
14 | #include <linux/random.h> | 14 | #include <linux/random.h> |
15 | #include <linux/nls.h> | ||
15 | 16 | ||
16 | #include "hfsplus_fs.h" | 17 | #include "hfsplus_fs.h" |
17 | #include "hfsplus_raw.h" | 18 | #include "hfsplus_raw.h" |
@@ -127,7 +128,7 @@ static int hfsplus_readdir(struct file *file, struct dir_context *ctx) | |||
127 | struct inode *inode = file_inode(file); | 128 | struct inode *inode = file_inode(file); |
128 | struct super_block *sb = inode->i_sb; | 129 | struct super_block *sb = inode->i_sb; |
129 | int len, err; | 130 | int len, err; |
130 | char strbuf[HFSPLUS_MAX_STRLEN + 1]; | 131 | char *strbuf; |
131 | hfsplus_cat_entry entry; | 132 | hfsplus_cat_entry entry; |
132 | struct hfs_find_data fd; | 133 | struct hfs_find_data fd; |
133 | struct hfsplus_readdir_data *rd; | 134 | struct hfsplus_readdir_data *rd; |
@@ -139,6 +140,11 @@ static int hfsplus_readdir(struct file *file, struct dir_context *ctx) | |||
139 | err = hfs_find_init(HFSPLUS_SB(sb)->cat_tree, &fd); | 140 | err = hfs_find_init(HFSPLUS_SB(sb)->cat_tree, &fd); |
140 | if (err) | 141 | if (err) |
141 | return err; | 142 | return err; |
143 | strbuf = kmalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_MAX_STRLEN + 1, GFP_KERNEL); | ||
144 | if (!strbuf) { | ||
145 | err = -ENOMEM; | ||
146 | goto out; | ||
147 | } | ||
142 | hfsplus_cat_build_key(sb, fd.search_key, inode->i_ino, NULL); | 148 | hfsplus_cat_build_key(sb, fd.search_key, inode->i_ino, NULL); |
143 | err = hfs_brec_find(&fd, hfs_find_rec_by_key); | 149 | err = hfs_brec_find(&fd, hfs_find_rec_by_key); |
144 | if (err) | 150 | if (err) |
@@ -193,7 +199,7 @@ static int hfsplus_readdir(struct file *file, struct dir_context *ctx) | |||
193 | hfs_bnode_read(fd.bnode, &entry, fd.entryoffset, | 199 | hfs_bnode_read(fd.bnode, &entry, fd.entryoffset, |
194 | fd.entrylength); | 200 | fd.entrylength); |
195 | type = be16_to_cpu(entry.type); | 201 | type = be16_to_cpu(entry.type); |
196 | len = HFSPLUS_MAX_STRLEN; | 202 | len = NLS_MAX_CHARSET_SIZE * HFSPLUS_MAX_STRLEN; |
197 | err = hfsplus_uni2asc(sb, &fd.key->cat.name, strbuf, &len); | 203 | err = hfsplus_uni2asc(sb, &fd.key->cat.name, strbuf, &len); |
198 | if (err) | 204 | if (err) |
199 | goto out; | 205 | goto out; |
@@ -212,13 +218,31 @@ static int hfsplus_readdir(struct file *file, struct dir_context *ctx) | |||
212 | be32_to_cpu(entry.folder.id), DT_DIR)) | 218 | be32_to_cpu(entry.folder.id), DT_DIR)) |
213 | break; | 219 | break; |
214 | } else if (type == HFSPLUS_FILE) { | 220 | } else if (type == HFSPLUS_FILE) { |
221 | u16 mode; | ||
222 | unsigned type = DT_UNKNOWN; | ||
223 | |||
215 | if (fd.entrylength < sizeof(struct hfsplus_cat_file)) { | 224 | if (fd.entrylength < sizeof(struct hfsplus_cat_file)) { |
216 | pr_err("small file entry\n"); | 225 | pr_err("small file entry\n"); |
217 | err = -EIO; | 226 | err = -EIO; |
218 | goto out; | 227 | goto out; |
219 | } | 228 | } |
229 | |||
230 | mode = be16_to_cpu(entry.file.permissions.mode); | ||
231 | if (S_ISREG(mode)) | ||
232 | type = DT_REG; | ||
233 | else if (S_ISLNK(mode)) | ||
234 | type = DT_LNK; | ||
235 | else if (S_ISFIFO(mode)) | ||
236 | type = DT_FIFO; | ||
237 | else if (S_ISCHR(mode)) | ||
238 | type = DT_CHR; | ||
239 | else if (S_ISBLK(mode)) | ||
240 | type = DT_BLK; | ||
241 | else if (S_ISSOCK(mode)) | ||
242 | type = DT_SOCK; | ||
243 | |||
220 | if (!dir_emit(ctx, strbuf, len, | 244 | if (!dir_emit(ctx, strbuf, len, |
221 | be32_to_cpu(entry.file.id), DT_REG)) | 245 | be32_to_cpu(entry.file.id), type)) |
222 | break; | 246 | break; |
223 | } else { | 247 | } else { |
224 | pr_err("bad catalog entry type\n"); | 248 | pr_err("bad catalog entry type\n"); |
@@ -246,6 +270,7 @@ next: | |||
246 | } | 270 | } |
247 | memcpy(&rd->key, fd.key, sizeof(struct hfsplus_cat_key)); | 271 | memcpy(&rd->key, fd.key, sizeof(struct hfsplus_cat_key)); |
248 | out: | 272 | out: |
273 | kfree(strbuf); | ||
249 | hfs_find_exit(&fd); | 274 | hfs_find_exit(&fd); |
250 | return err; | 275 | return err; |
251 | } | 276 | } |
diff --git a/fs/hfsplus/extents.c b/fs/hfsplus/extents.c index a7aafb35b624..feca524ce2a5 100644 --- a/fs/hfsplus/extents.c +++ b/fs/hfsplus/extents.c | |||
@@ -235,7 +235,7 @@ int hfsplus_get_block(struct inode *inode, sector_t iblock, | |||
235 | if (iblock > hip->fs_blocks || !create) | 235 | if (iblock > hip->fs_blocks || !create) |
236 | return -EIO; | 236 | return -EIO; |
237 | if (ablock >= hip->alloc_blocks) { | 237 | if (ablock >= hip->alloc_blocks) { |
238 | res = hfsplus_file_extend(inode); | 238 | res = hfsplus_file_extend(inode, false); |
239 | if (res) | 239 | if (res) |
240 | return res; | 240 | return res; |
241 | } | 241 | } |
@@ -425,7 +425,7 @@ int hfsplus_free_fork(struct super_block *sb, u32 cnid, | |||
425 | return res; | 425 | return res; |
426 | } | 426 | } |
427 | 427 | ||
428 | int hfsplus_file_extend(struct inode *inode) | 428 | int hfsplus_file_extend(struct inode *inode, bool zeroout) |
429 | { | 429 | { |
430 | struct super_block *sb = inode->i_sb; | 430 | struct super_block *sb = inode->i_sb; |
431 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); | 431 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); |
@@ -436,10 +436,9 @@ int hfsplus_file_extend(struct inode *inode) | |||
436 | if (sbi->alloc_file->i_size * 8 < | 436 | if (sbi->alloc_file->i_size * 8 < |
437 | sbi->total_blocks - sbi->free_blocks + 8) { | 437 | sbi->total_blocks - sbi->free_blocks + 8) { |
438 | /* extend alloc file */ | 438 | /* extend alloc file */ |
439 | pr_err("extend alloc file! " | 439 | pr_err("extend alloc file! (%llu,%u,%u)\n", |
440 | "(%llu,%u,%u)\n", | 440 | sbi->alloc_file->i_size * 8, |
441 | sbi->alloc_file->i_size * 8, | 441 | sbi->total_blocks, sbi->free_blocks); |
442 | sbi->total_blocks, sbi->free_blocks); | ||
443 | return -ENOSPC; | 442 | return -ENOSPC; |
444 | } | 443 | } |
445 | 444 | ||
@@ -463,6 +462,12 @@ int hfsplus_file_extend(struct inode *inode) | |||
463 | } | 462 | } |
464 | } | 463 | } |
465 | 464 | ||
465 | if (zeroout) { | ||
466 | res = sb_issue_zeroout(sb, start, len, GFP_NOFS); | ||
467 | if (res) | ||
468 | goto out; | ||
469 | } | ||
470 | |||
466 | hfs_dbg(EXTENT, "extend %lu: %u,%u\n", inode->i_ino, start, len); | 471 | hfs_dbg(EXTENT, "extend %lu: %u,%u\n", inode->i_ino, start, len); |
467 | 472 | ||
468 | if (hip->alloc_blocks <= hip->first_blocks) { | 473 | if (hip->alloc_blocks <= hip->first_blocks) { |
diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h index 83dc29286b10..eb5e059f481a 100644 --- a/fs/hfsplus/hfsplus_fs.h +++ b/fs/hfsplus/hfsplus_fs.h | |||
@@ -369,114 +369,119 @@ typedef int (*search_strategy_t)(struct hfs_bnode *, | |||
369 | /* attributes.c */ | 369 | /* attributes.c */ |
370 | int __init hfsplus_create_attr_tree_cache(void); | 370 | int __init hfsplus_create_attr_tree_cache(void); |
371 | void hfsplus_destroy_attr_tree_cache(void); | 371 | void hfsplus_destroy_attr_tree_cache(void); |
372 | int hfsplus_attr_bin_cmp_key(const hfsplus_btree_key *k1, | ||
373 | const hfsplus_btree_key *k2); | ||
374 | int hfsplus_attr_build_key(struct super_block *sb, hfsplus_btree_key *key, | ||
375 | u32 cnid, const char *name); | ||
372 | hfsplus_attr_entry *hfsplus_alloc_attr_entry(void); | 376 | hfsplus_attr_entry *hfsplus_alloc_attr_entry(void); |
373 | void hfsplus_destroy_attr_entry(hfsplus_attr_entry *entry_p); | 377 | void hfsplus_destroy_attr_entry(hfsplus_attr_entry *entry); |
374 | int hfsplus_attr_bin_cmp_key(const hfsplus_btree_key *, | 378 | int hfsplus_find_attr(struct super_block *sb, u32 cnid, const char *name, |
375 | const hfsplus_btree_key *); | 379 | struct hfs_find_data *fd); |
376 | int hfsplus_attr_build_key(struct super_block *, hfsplus_btree_key *, | ||
377 | u32, const char *); | ||
378 | void hfsplus_attr_build_key_uni(hfsplus_btree_key *key, | ||
379 | u32 cnid, | ||
380 | struct hfsplus_attr_unistr *name); | ||
381 | int hfsplus_find_attr(struct super_block *, u32, | ||
382 | const char *, struct hfs_find_data *); | ||
383 | int hfsplus_attr_exists(struct inode *inode, const char *name); | 380 | int hfsplus_attr_exists(struct inode *inode, const char *name); |
384 | int hfsplus_create_attr(struct inode *, const char *, const void *, size_t); | 381 | int hfsplus_create_attr(struct inode *inode, const char *name, |
385 | int hfsplus_delete_attr(struct inode *, const char *); | 382 | const void *value, size_t size); |
383 | int hfsplus_delete_attr(struct inode *inode, const char *name); | ||
386 | int hfsplus_delete_all_attrs(struct inode *dir, u32 cnid); | 384 | int hfsplus_delete_all_attrs(struct inode *dir, u32 cnid); |
387 | 385 | ||
388 | /* bitmap.c */ | 386 | /* bitmap.c */ |
389 | int hfsplus_block_allocate(struct super_block *, u32, u32, u32 *); | 387 | int hfsplus_block_allocate(struct super_block *sb, u32 size, u32 offset, |
390 | int hfsplus_block_free(struct super_block *, u32, u32); | 388 | u32 *max); |
389 | int hfsplus_block_free(struct super_block *sb, u32 offset, u32 count); | ||
391 | 390 | ||
392 | /* btree.c */ | 391 | /* btree.c */ |
393 | u32 hfsplus_calc_btree_clump_size(u32, u32, u64, int); | 392 | u32 hfsplus_calc_btree_clump_size(u32 block_size, u32 node_size, u64 sectors, |
394 | struct hfs_btree *hfs_btree_open(struct super_block *, u32); | 393 | int file_id); |
395 | void hfs_btree_close(struct hfs_btree *); | 394 | struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id); |
396 | int hfs_btree_write(struct hfs_btree *); | 395 | void hfs_btree_close(struct hfs_btree *tree); |
397 | struct hfs_bnode *hfs_bmap_alloc(struct hfs_btree *); | 396 | int hfs_btree_write(struct hfs_btree *tree); |
398 | void hfs_bmap_free(struct hfs_bnode *); | 397 | struct hfs_bnode *hfs_bmap_alloc(struct hfs_btree *tree); |
398 | void hfs_bmap_free(struct hfs_bnode *node); | ||
399 | 399 | ||
400 | /* bnode.c */ | 400 | /* bnode.c */ |
401 | void hfs_bnode_read(struct hfs_bnode *, void *, int, int); | 401 | void hfs_bnode_read(struct hfs_bnode *node, void *buf, int off, int len); |
402 | u16 hfs_bnode_read_u16(struct hfs_bnode *, int); | 402 | u16 hfs_bnode_read_u16(struct hfs_bnode *node, int off); |
403 | u8 hfs_bnode_read_u8(struct hfs_bnode *, int); | 403 | u8 hfs_bnode_read_u8(struct hfs_bnode *node, int off); |
404 | void hfs_bnode_read_key(struct hfs_bnode *, void *, int); | 404 | void hfs_bnode_read_key(struct hfs_bnode *node, void *key, int off); |
405 | void hfs_bnode_write(struct hfs_bnode *, void *, int, int); | 405 | void hfs_bnode_write(struct hfs_bnode *node, void *buf, int off, int len); |
406 | void hfs_bnode_write_u16(struct hfs_bnode *, int, u16); | 406 | void hfs_bnode_write_u16(struct hfs_bnode *node, int off, u16 data); |
407 | void hfs_bnode_clear(struct hfs_bnode *, int, int); | 407 | void hfs_bnode_clear(struct hfs_bnode *node, int off, int len); |
408 | void hfs_bnode_copy(struct hfs_bnode *, int, | 408 | void hfs_bnode_copy(struct hfs_bnode *dst_node, int dst, |
409 | struct hfs_bnode *, int, int); | 409 | struct hfs_bnode *src_node, int src, int len); |
410 | void hfs_bnode_move(struct hfs_bnode *, int, int, int); | 410 | void hfs_bnode_move(struct hfs_bnode *node, int dst, int src, int len); |
411 | void hfs_bnode_dump(struct hfs_bnode *); | 411 | void hfs_bnode_dump(struct hfs_bnode *node); |
412 | void hfs_bnode_unlink(struct hfs_bnode *); | 412 | void hfs_bnode_unlink(struct hfs_bnode *node); |
413 | struct hfs_bnode *hfs_bnode_findhash(struct hfs_btree *, u32); | 413 | struct hfs_bnode *hfs_bnode_findhash(struct hfs_btree *tree, u32 cnid); |
414 | struct hfs_bnode *hfs_bnode_find(struct hfs_btree *, u32); | 414 | void hfs_bnode_unhash(struct hfs_bnode *node); |
415 | void hfs_bnode_unhash(struct hfs_bnode *); | 415 | struct hfs_bnode *hfs_bnode_find(struct hfs_btree *tree, u32 num); |
416 | void hfs_bnode_free(struct hfs_bnode *); | 416 | void hfs_bnode_free(struct hfs_bnode *node); |
417 | struct hfs_bnode *hfs_bnode_create(struct hfs_btree *, u32); | 417 | struct hfs_bnode *hfs_bnode_create(struct hfs_btree *tree, u32 num); |
418 | void hfs_bnode_get(struct hfs_bnode *); | 418 | void hfs_bnode_get(struct hfs_bnode *node); |
419 | void hfs_bnode_put(struct hfs_bnode *); | 419 | void hfs_bnode_put(struct hfs_bnode *node); |
420 | bool hfs_bnode_need_zeroout(struct hfs_btree *tree); | ||
420 | 421 | ||
421 | /* brec.c */ | 422 | /* brec.c */ |
422 | u16 hfs_brec_lenoff(struct hfs_bnode *, u16, u16 *); | 423 | u16 hfs_brec_lenoff(struct hfs_bnode *node, u16 rec, u16 *off); |
423 | u16 hfs_brec_keylen(struct hfs_bnode *, u16); | 424 | u16 hfs_brec_keylen(struct hfs_bnode *node, u16 rec); |
424 | int hfs_brec_insert(struct hfs_find_data *, void *, int); | 425 | int hfs_brec_insert(struct hfs_find_data *fd, void *entry, int entry_len); |
425 | int hfs_brec_remove(struct hfs_find_data *); | 426 | int hfs_brec_remove(struct hfs_find_data *fd); |
426 | 427 | ||
427 | /* bfind.c */ | 428 | /* bfind.c */ |
428 | int hfs_find_init(struct hfs_btree *, struct hfs_find_data *); | 429 | int hfs_find_init(struct hfs_btree *tree, struct hfs_find_data *fd); |
429 | void hfs_find_exit(struct hfs_find_data *); | 430 | void hfs_find_exit(struct hfs_find_data *fd); |
430 | int hfs_find_1st_rec_by_cnid(struct hfs_bnode *, | 431 | int hfs_find_1st_rec_by_cnid(struct hfs_bnode *bnode, struct hfs_find_data *fd, |
431 | struct hfs_find_data *, | 432 | int *begin, int *end, int *cur_rec); |
432 | int *, int *, int *); | 433 | int hfs_find_rec_by_key(struct hfs_bnode *bnode, struct hfs_find_data *fd, |
433 | int hfs_find_rec_by_key(struct hfs_bnode *, | 434 | int *begin, int *end, int *cur_rec); |
434 | struct hfs_find_data *, | 435 | int __hfs_brec_find(struct hfs_bnode *bnode, struct hfs_find_data *fd, |
435 | int *, int *, int *); | 436 | search_strategy_t rec_found); |
436 | int __hfs_brec_find(struct hfs_bnode *, struct hfs_find_data *, | 437 | int hfs_brec_find(struct hfs_find_data *fd, search_strategy_t do_key_compare); |
437 | search_strategy_t); | 438 | int hfs_brec_read(struct hfs_find_data *fd, void *rec, int rec_len); |
438 | int hfs_brec_find(struct hfs_find_data *, search_strategy_t); | 439 | int hfs_brec_goto(struct hfs_find_data *fd, int cnt); |
439 | int hfs_brec_read(struct hfs_find_data *, void *, int); | ||
440 | int hfs_brec_goto(struct hfs_find_data *, int); | ||
441 | 440 | ||
442 | /* catalog.c */ | 441 | /* catalog.c */ |
443 | int hfsplus_cat_case_cmp_key(const hfsplus_btree_key *, | 442 | int hfsplus_cat_case_cmp_key(const hfsplus_btree_key *k1, |
444 | const hfsplus_btree_key *); | 443 | const hfsplus_btree_key *k2); |
445 | int hfsplus_cat_bin_cmp_key(const hfsplus_btree_key *, | 444 | int hfsplus_cat_bin_cmp_key(const hfsplus_btree_key *k1, |
446 | const hfsplus_btree_key *); | 445 | const hfsplus_btree_key *k2); |
447 | void hfsplus_cat_build_key(struct super_block *sb, | 446 | void hfsplus_cat_build_key(struct super_block *sb, hfsplus_btree_key *key, |
448 | hfsplus_btree_key *, u32, struct qstr *); | 447 | u32 parent, struct qstr *str); |
449 | int hfsplus_find_cat(struct super_block *, u32, struct hfs_find_data *); | ||
450 | int hfsplus_create_cat(u32, struct inode *, struct qstr *, struct inode *); | ||
451 | int hfsplus_delete_cat(u32, struct inode *, struct qstr *); | ||
452 | int hfsplus_rename_cat(u32, struct inode *, struct qstr *, | ||
453 | struct inode *, struct qstr *); | ||
454 | void hfsplus_cat_set_perms(struct inode *inode, struct hfsplus_perm *perms); | 448 | void hfsplus_cat_set_perms(struct inode *inode, struct hfsplus_perm *perms); |
449 | int hfsplus_find_cat(struct super_block *sb, u32 cnid, | ||
450 | struct hfs_find_data *fd); | ||
451 | int hfsplus_create_cat(u32 cnid, struct inode *dir, struct qstr *str, | ||
452 | struct inode *inode); | ||
453 | int hfsplus_delete_cat(u32 cnid, struct inode *dir, struct qstr *str); | ||
454 | int hfsplus_rename_cat(u32 cnid, struct inode *src_dir, struct qstr *src_name, | ||
455 | struct inode *dst_dir, struct qstr *dst_name); | ||
455 | 456 | ||
456 | /* dir.c */ | 457 | /* dir.c */ |
457 | extern const struct inode_operations hfsplus_dir_inode_operations; | 458 | extern const struct inode_operations hfsplus_dir_inode_operations; |
458 | extern const struct file_operations hfsplus_dir_operations; | 459 | extern const struct file_operations hfsplus_dir_operations; |
459 | 460 | ||
460 | /* extents.c */ | 461 | /* extents.c */ |
461 | int hfsplus_ext_cmp_key(const hfsplus_btree_key *, const hfsplus_btree_key *); | 462 | int hfsplus_ext_cmp_key(const hfsplus_btree_key *k1, |
462 | int hfsplus_ext_write_extent(struct inode *); | 463 | const hfsplus_btree_key *k2); |
463 | int hfsplus_get_block(struct inode *, sector_t, struct buffer_head *, int); | 464 | int hfsplus_ext_write_extent(struct inode *inode); |
464 | int hfsplus_free_fork(struct super_block *, u32, | 465 | int hfsplus_get_block(struct inode *inode, sector_t iblock, |
465 | struct hfsplus_fork_raw *, int); | 466 | struct buffer_head *bh_result, int create); |
466 | int hfsplus_file_extend(struct inode *); | 467 | int hfsplus_free_fork(struct super_block *sb, u32 cnid, |
467 | void hfsplus_file_truncate(struct inode *); | 468 | struct hfsplus_fork_raw *fork, int type); |
469 | int hfsplus_file_extend(struct inode *inode, bool zeroout); | ||
470 | void hfsplus_file_truncate(struct inode *inode); | ||
468 | 471 | ||
469 | /* inode.c */ | 472 | /* inode.c */ |
470 | extern const struct address_space_operations hfsplus_aops; | 473 | extern const struct address_space_operations hfsplus_aops; |
471 | extern const struct address_space_operations hfsplus_btree_aops; | 474 | extern const struct address_space_operations hfsplus_btree_aops; |
472 | extern const struct dentry_operations hfsplus_dentry_operations; | 475 | extern const struct dentry_operations hfsplus_dentry_operations; |
473 | 476 | ||
474 | void hfsplus_inode_read_fork(struct inode *, struct hfsplus_fork_raw *); | 477 | struct inode *hfsplus_new_inode(struct super_block *sb, umode_t mode); |
475 | void hfsplus_inode_write_fork(struct inode *, struct hfsplus_fork_raw *); | 478 | void hfsplus_delete_inode(struct inode *inode); |
476 | int hfsplus_cat_read_inode(struct inode *, struct hfs_find_data *); | 479 | void hfsplus_inode_read_fork(struct inode *inode, |
477 | int hfsplus_cat_write_inode(struct inode *); | 480 | struct hfsplus_fork_raw *fork); |
478 | struct inode *hfsplus_new_inode(struct super_block *, umode_t); | 481 | void hfsplus_inode_write_fork(struct inode *inode, |
479 | void hfsplus_delete_inode(struct inode *); | 482 | struct hfsplus_fork_raw *fork); |
483 | int hfsplus_cat_read_inode(struct inode *inode, struct hfs_find_data *fd); | ||
484 | int hfsplus_cat_write_inode(struct inode *inode); | ||
480 | int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end, | 485 | int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end, |
481 | int datasync); | 486 | int datasync); |
482 | 487 | ||
@@ -484,13 +489,17 @@ int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end, | |||
484 | long hfsplus_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); | 489 | long hfsplus_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); |
485 | 490 | ||
486 | /* options.c */ | 491 | /* options.c */ |
487 | int hfsplus_parse_options(char *, struct hfsplus_sb_info *); | 492 | void hfsplus_fill_defaults(struct hfsplus_sb_info *opts); |
488 | int hfsplus_parse_options_remount(char *input, int *force); | 493 | int hfsplus_parse_options_remount(char *input, int *force); |
489 | void hfsplus_fill_defaults(struct hfsplus_sb_info *); | 494 | int hfsplus_parse_options(char *input, struct hfsplus_sb_info *sbi); |
490 | int hfsplus_show_options(struct seq_file *, struct dentry *); | 495 | int hfsplus_show_options(struct seq_file *seq, struct dentry *root); |
496 | |||
497 | /* part_tbl.c */ | ||
498 | int hfs_part_find(struct super_block *sb, sector_t *part_start, | ||
499 | sector_t *part_size); | ||
491 | 500 | ||
492 | /* super.c */ | 501 | /* super.c */ |
493 | struct inode *hfsplus_iget(struct super_block *, unsigned long); | 502 | struct inode *hfsplus_iget(struct super_block *sb, unsigned long ino); |
494 | void hfsplus_mark_mdb_dirty(struct super_block *sb); | 503 | void hfsplus_mark_mdb_dirty(struct super_block *sb); |
495 | 504 | ||
496 | /* tables.c */ | 505 | /* tables.c */ |
@@ -499,23 +508,23 @@ extern u16 hfsplus_decompose_table[]; | |||
499 | extern u16 hfsplus_compose_table[]; | 508 | extern u16 hfsplus_compose_table[]; |
500 | 509 | ||
501 | /* unicode.c */ | 510 | /* unicode.c */ |
502 | int hfsplus_strcasecmp(const struct hfsplus_unistr *, | 511 | int hfsplus_strcasecmp(const struct hfsplus_unistr *s1, |
503 | const struct hfsplus_unistr *); | 512 | const struct hfsplus_unistr *s2); |
504 | int hfsplus_strcmp(const struct hfsplus_unistr *, | 513 | int hfsplus_strcmp(const struct hfsplus_unistr *s1, |
505 | const struct hfsplus_unistr *); | 514 | const struct hfsplus_unistr *s2); |
506 | int hfsplus_uni2asc(struct super_block *, | 515 | int hfsplus_uni2asc(struct super_block *sb, const struct hfsplus_unistr *ustr, |
507 | const struct hfsplus_unistr *, char *, int *); | 516 | char *astr, int *len_p); |
508 | int hfsplus_asc2uni(struct super_block *, | 517 | int hfsplus_asc2uni(struct super_block *sb, struct hfsplus_unistr *ustr, |
509 | struct hfsplus_unistr *, int, const char *, int); | 518 | int max_unistr_len, const char *astr, int len); |
510 | int hfsplus_hash_dentry(const struct dentry *dentry, struct qstr *str); | 519 | int hfsplus_hash_dentry(const struct dentry *dentry, struct qstr *str); |
511 | int hfsplus_compare_dentry(const struct dentry *parent, const struct dentry *dentry, | 520 | int hfsplus_compare_dentry(const struct dentry *parent, |
512 | unsigned int len, const char *str, const struct qstr *name); | 521 | const struct dentry *dentry, unsigned int len, |
522 | const char *str, const struct qstr *name); | ||
513 | 523 | ||
514 | /* wrapper.c */ | 524 | /* wrapper.c */ |
515 | int hfsplus_read_wrapper(struct super_block *); | 525 | int hfsplus_submit_bio(struct super_block *sb, sector_t sector, void *buf, |
516 | int hfs_part_find(struct super_block *, sector_t *, sector_t *); | 526 | void **data, int rw); |
517 | int hfsplus_submit_bio(struct super_block *sb, sector_t sector, | 527 | int hfsplus_read_wrapper(struct super_block *sb); |
518 | void *buf, void **data, int rw); | ||
519 | 528 | ||
520 | /* time macros */ | 529 | /* time macros */ |
521 | #define __hfsp_mt2ut(t) (be32_to_cpu(t) - 2082844800U) | 530 | #define __hfsp_mt2ut(t) (be32_to_cpu(t) - 2082844800U) |
diff --git a/fs/hfsplus/hfsplus_raw.h b/fs/hfsplus/hfsplus_raw.h index 5a126828d85e..8298d0985f81 100644 --- a/fs/hfsplus/hfsplus_raw.h +++ b/fs/hfsplus/hfsplus_raw.h | |||
@@ -144,6 +144,7 @@ struct hfsplus_vh { | |||
144 | #define HFSPLUS_VOL_NODEID_REUSED (1 << 12) | 144 | #define HFSPLUS_VOL_NODEID_REUSED (1 << 12) |
145 | #define HFSPLUS_VOL_JOURNALED (1 << 13) | 145 | #define HFSPLUS_VOL_JOURNALED (1 << 13) |
146 | #define HFSPLUS_VOL_SOFTLOCK (1 << 15) | 146 | #define HFSPLUS_VOL_SOFTLOCK (1 << 15) |
147 | #define HFSPLUS_VOL_UNUSED_NODE_FIX (1 << 31) | ||
147 | 148 | ||
148 | /* HFS+ BTree node descriptor */ | 149 | /* HFS+ BTree node descriptor */ |
149 | struct hfs_bnode_desc { | 150 | struct hfs_bnode_desc { |
diff --git a/fs/hfsplus/options.c b/fs/hfsplus/options.c index 68537e8b7a09..c90b72ee676d 100644 --- a/fs/hfsplus/options.c +++ b/fs/hfsplus/options.c | |||
@@ -173,9 +173,8 @@ int hfsplus_parse_options(char *input, struct hfsplus_sb_info *sbi) | |||
173 | if (p) | 173 | if (p) |
174 | sbi->nls = load_nls(p); | 174 | sbi->nls = load_nls(p); |
175 | if (!sbi->nls) { | 175 | if (!sbi->nls) { |
176 | pr_err("unable to load " | 176 | pr_err("unable to load nls mapping \"%s\"\n", |
177 | "nls mapping \"%s\"\n", | 177 | p); |
178 | p); | ||
179 | kfree(p); | 178 | kfree(p); |
180 | return 0; | 179 | return 0; |
181 | } | 180 | } |
@@ -232,8 +231,8 @@ int hfsplus_show_options(struct seq_file *seq, struct dentry *root) | |||
232 | if (sbi->nls) | 231 | if (sbi->nls) |
233 | seq_printf(seq, ",nls=%s", sbi->nls->charset); | 232 | seq_printf(seq, ",nls=%s", sbi->nls->charset); |
234 | if (test_bit(HFSPLUS_SB_NODECOMPOSE, &sbi->flags)) | 233 | if (test_bit(HFSPLUS_SB_NODECOMPOSE, &sbi->flags)) |
235 | seq_printf(seq, ",nodecompose"); | 234 | seq_puts(seq, ",nodecompose"); |
236 | if (test_bit(HFSPLUS_SB_NOBARRIER, &sbi->flags)) | 235 | if (test_bit(HFSPLUS_SB_NOBARRIER, &sbi->flags)) |
237 | seq_printf(seq, ",nobarrier"); | 236 | seq_puts(seq, ",nobarrier"); |
238 | return 0; | 237 | return 0; |
239 | } | 238 | } |
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c index a513d2d36be9..4cf2024b87da 100644 --- a/fs/hfsplus/super.c +++ b/fs/hfsplus/super.c | |||
@@ -131,9 +131,10 @@ static int hfsplus_system_write_inode(struct inode *inode) | |||
131 | hfsplus_inode_write_fork(inode, fork); | 131 | hfsplus_inode_write_fork(inode, fork); |
132 | if (tree) { | 132 | if (tree) { |
133 | int err = hfs_btree_write(tree); | 133 | int err = hfs_btree_write(tree); |
134 | |||
134 | if (err) { | 135 | if (err) { |
135 | pr_err("b-tree write err: %d, ino %lu\n", | 136 | pr_err("b-tree write err: %d, ino %lu\n", |
136 | err, inode->i_ino); | 137 | err, inode->i_ino); |
137 | return err; | 138 | return err; |
138 | } | 139 | } |
139 | } | 140 | } |
diff --git a/fs/hfsplus/wrapper.c b/fs/hfsplus/wrapper.c index 3f999649587f..cc6235671437 100644 --- a/fs/hfsplus/wrapper.c +++ b/fs/hfsplus/wrapper.c | |||
@@ -24,8 +24,8 @@ struct hfsplus_wd { | |||
24 | u16 embed_count; | 24 | u16 embed_count; |
25 | }; | 25 | }; |
26 | 26 | ||
27 | /* | 27 | /** |
28 | * hfsplus_submit_bio - Perfrom block I/O | 28 | * hfsplus_submit_bio - Perform block I/O |
29 | * @sb: super block of volume for I/O | 29 | * @sb: super block of volume for I/O |
30 | * @sector: block to read or write, for blocks of HFSPLUS_SECTOR_SIZE bytes | 30 | * @sector: block to read or write, for blocks of HFSPLUS_SECTOR_SIZE bytes |
31 | * @buf: buffer for I/O | 31 | * @buf: buffer for I/O |
@@ -231,10 +231,8 @@ reread: | |||
231 | if (blocksize < HFSPLUS_SECTOR_SIZE || ((blocksize - 1) & blocksize)) | 231 | if (blocksize < HFSPLUS_SECTOR_SIZE || ((blocksize - 1) & blocksize)) |
232 | goto out_free_backup_vhdr; | 232 | goto out_free_backup_vhdr; |
233 | sbi->alloc_blksz = blocksize; | 233 | sbi->alloc_blksz = blocksize; |
234 | sbi->alloc_blksz_shift = 0; | 234 | sbi->alloc_blksz_shift = ilog2(blocksize); |
235 | while ((blocksize >>= 1) != 0) | 235 | blocksize = min_t(u32, sbi->alloc_blksz, PAGE_SIZE); |
236 | sbi->alloc_blksz_shift++; | ||
237 | blocksize = min(sbi->alloc_blksz, (u32)PAGE_SIZE); | ||
238 | 236 | ||
239 | /* | 237 | /* |
240 | * Align block size to block offset. | 238 | * Align block size to block offset. |
diff --git a/fs/hfsplus/xattr.c b/fs/hfsplus/xattr.c index 4e27edc082a4..d98094a9f476 100644 --- a/fs/hfsplus/xattr.c +++ b/fs/hfsplus/xattr.c | |||
@@ -8,6 +8,7 @@ | |||
8 | 8 | ||
9 | #include "hfsplus_fs.h" | 9 | #include "hfsplus_fs.h" |
10 | #include <linux/posix_acl_xattr.h> | 10 | #include <linux/posix_acl_xattr.h> |
11 | #include <linux/nls.h> | ||
11 | #include "xattr.h" | 12 | #include "xattr.h" |
12 | #include "acl.h" | 13 | #include "acl.h" |
13 | 14 | ||
@@ -66,10 +67,10 @@ static void hfsplus_init_header_node(struct inode *attr_file, | |||
66 | char *bmp; | 67 | char *bmp; |
67 | u32 used_nodes; | 68 | u32 used_nodes; |
68 | u32 used_bmp_bytes; | 69 | u32 used_bmp_bytes; |
69 | loff_t tmp; | 70 | u64 tmp; |
70 | 71 | ||
71 | hfs_dbg(ATTR_MOD, "init_hdr_attr_file: clump %u, node_size %u\n", | 72 | hfs_dbg(ATTR_MOD, "init_hdr_attr_file: clump %u, node_size %u\n", |
72 | clump_size, node_size); | 73 | clump_size, node_size); |
73 | 74 | ||
74 | /* The end of the node contains list of record offsets */ | 75 | /* The end of the node contains list of record offsets */ |
75 | rec_offsets = (__be16 *)(buf + node_size); | 76 | rec_offsets = (__be16 *)(buf + node_size); |
@@ -195,7 +196,7 @@ check_attr_tree_state_again: | |||
195 | } | 196 | } |
196 | 197 | ||
197 | while (hip->alloc_blocks < hip->clump_blocks) { | 198 | while (hip->alloc_blocks < hip->clump_blocks) { |
198 | err = hfsplus_file_extend(attr_file); | 199 | err = hfsplus_file_extend(attr_file, false); |
199 | if (unlikely(err)) { | 200 | if (unlikely(err)) { |
200 | pr_err("failed to extend attributes file\n"); | 201 | pr_err("failed to extend attributes file\n"); |
201 | goto end_attr_file_creation; | 202 | goto end_attr_file_creation; |
@@ -645,8 +646,7 @@ ssize_t hfsplus_listxattr(struct dentry *dentry, char *buffer, size_t size) | |||
645 | struct hfs_find_data fd; | 646 | struct hfs_find_data fd; |
646 | u16 key_len = 0; | 647 | u16 key_len = 0; |
647 | struct hfsplus_attr_key attr_key; | 648 | struct hfsplus_attr_key attr_key; |
648 | char strbuf[HFSPLUS_ATTR_MAX_STRLEN + | 649 | char *strbuf; |
649 | XATTR_MAC_OSX_PREFIX_LEN + 1] = {0}; | ||
650 | int xattr_name_len; | 650 | int xattr_name_len; |
651 | 651 | ||
652 | if ((!S_ISREG(inode->i_mode) && | 652 | if ((!S_ISREG(inode->i_mode) && |
@@ -666,6 +666,13 @@ ssize_t hfsplus_listxattr(struct dentry *dentry, char *buffer, size_t size) | |||
666 | return err; | 666 | return err; |
667 | } | 667 | } |
668 | 668 | ||
669 | strbuf = kmalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_ATTR_MAX_STRLEN + | ||
670 | XATTR_MAC_OSX_PREFIX_LEN + 1, GFP_KERNEL); | ||
671 | if (!strbuf) { | ||
672 | res = -ENOMEM; | ||
673 | goto out; | ||
674 | } | ||
675 | |||
669 | err = hfsplus_find_attr(inode->i_sb, inode->i_ino, NULL, &fd); | 676 | err = hfsplus_find_attr(inode->i_sb, inode->i_ino, NULL, &fd); |
670 | if (err) { | 677 | if (err) { |
671 | if (err == -ENOENT) { | 678 | if (err == -ENOENT) { |
@@ -692,7 +699,7 @@ ssize_t hfsplus_listxattr(struct dentry *dentry, char *buffer, size_t size) | |||
692 | if (be32_to_cpu(attr_key.cnid) != inode->i_ino) | 699 | if (be32_to_cpu(attr_key.cnid) != inode->i_ino) |
693 | goto end_listxattr; | 700 | goto end_listxattr; |
694 | 701 | ||
695 | xattr_name_len = HFSPLUS_ATTR_MAX_STRLEN; | 702 | xattr_name_len = NLS_MAX_CHARSET_SIZE * HFSPLUS_ATTR_MAX_STRLEN; |
696 | if (hfsplus_uni2asc(inode->i_sb, | 703 | if (hfsplus_uni2asc(inode->i_sb, |
697 | (const struct hfsplus_unistr *)&fd.key->attr.key_name, | 704 | (const struct hfsplus_unistr *)&fd.key->attr.key_name, |
698 | strbuf, &xattr_name_len)) { | 705 | strbuf, &xattr_name_len)) { |
@@ -718,6 +725,8 @@ ssize_t hfsplus_listxattr(struct dentry *dentry, char *buffer, size_t size) | |||
718 | } | 725 | } |
719 | 726 | ||
720 | end_listxattr: | 727 | end_listxattr: |
728 | kfree(strbuf); | ||
729 | out: | ||
721 | hfs_find_exit(&fd); | 730 | hfs_find_exit(&fd); |
722 | return res; | 731 | return res; |
723 | } | 732 | } |
@@ -797,47 +806,55 @@ end_removexattr: | |||
797 | static int hfsplus_osx_getxattr(struct dentry *dentry, const char *name, | 806 | static int hfsplus_osx_getxattr(struct dentry *dentry, const char *name, |
798 | void *buffer, size_t size, int type) | 807 | void *buffer, size_t size, int type) |
799 | { | 808 | { |
800 | char xattr_name[HFSPLUS_ATTR_MAX_STRLEN + | 809 | char *xattr_name; |
801 | XATTR_MAC_OSX_PREFIX_LEN + 1] = {0}; | 810 | int res; |
802 | size_t len = strlen(name); | ||
803 | 811 | ||
804 | if (!strcmp(name, "")) | 812 | if (!strcmp(name, "")) |
805 | return -EINVAL; | 813 | return -EINVAL; |
806 | 814 | ||
807 | if (len > HFSPLUS_ATTR_MAX_STRLEN) | ||
808 | return -EOPNOTSUPP; | ||
809 | |||
810 | /* | 815 | /* |
811 | * Don't allow retrieving properly prefixed attributes | 816 | * Don't allow retrieving properly prefixed attributes |
812 | * by prepending them with "osx." | 817 | * by prepending them with "osx." |
813 | */ | 818 | */ |
814 | if (is_known_namespace(name)) | 819 | if (is_known_namespace(name)) |
815 | return -EOPNOTSUPP; | 820 | return -EOPNOTSUPP; |
821 | xattr_name = kmalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_ATTR_MAX_STRLEN | ||
822 | + XATTR_MAC_OSX_PREFIX_LEN + 1, GFP_KERNEL); | ||
823 | if (!xattr_name) | ||
824 | return -ENOMEM; | ||
825 | strcpy(xattr_name, XATTR_MAC_OSX_PREFIX); | ||
826 | strcpy(xattr_name + XATTR_MAC_OSX_PREFIX_LEN, name); | ||
816 | 827 | ||
817 | return hfsplus_getxattr(dentry, xattr_name, buffer, size); | 828 | res = hfsplus_getxattr(dentry, xattr_name, buffer, size); |
829 | kfree(xattr_name); | ||
830 | return res; | ||
818 | } | 831 | } |
819 | 832 | ||
820 | static int hfsplus_osx_setxattr(struct dentry *dentry, const char *name, | 833 | static int hfsplus_osx_setxattr(struct dentry *dentry, const char *name, |
821 | const void *buffer, size_t size, int flags, int type) | 834 | const void *buffer, size_t size, int flags, int type) |
822 | { | 835 | { |
823 | char xattr_name[HFSPLUS_ATTR_MAX_STRLEN + | 836 | char *xattr_name; |
824 | XATTR_MAC_OSX_PREFIX_LEN + 1] = {0}; | 837 | int res; |
825 | size_t len = strlen(name); | ||
826 | 838 | ||
827 | if (!strcmp(name, "")) | 839 | if (!strcmp(name, "")) |
828 | return -EINVAL; | 840 | return -EINVAL; |
829 | 841 | ||
830 | if (len > HFSPLUS_ATTR_MAX_STRLEN) | ||
831 | return -EOPNOTSUPP; | ||
832 | |||
833 | /* | 842 | /* |
834 | * Don't allow setting properly prefixed attributes | 843 | * Don't allow setting properly prefixed attributes |
835 | * by prepending them with "osx." | 844 | * by prepending them with "osx." |
836 | */ | 845 | */ |
837 | if (is_known_namespace(name)) | 846 | if (is_known_namespace(name)) |
838 | return -EOPNOTSUPP; | 847 | return -EOPNOTSUPP; |
848 | xattr_name = kmalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_ATTR_MAX_STRLEN | ||
849 | + XATTR_MAC_OSX_PREFIX_LEN + 1, GFP_KERNEL); | ||
850 | if (!xattr_name) | ||
851 | return -ENOMEM; | ||
852 | strcpy(xattr_name, XATTR_MAC_OSX_PREFIX); | ||
853 | strcpy(xattr_name + XATTR_MAC_OSX_PREFIX_LEN, name); | ||
839 | 854 | ||
840 | return hfsplus_setxattr(dentry, xattr_name, buffer, size, flags); | 855 | res = hfsplus_setxattr(dentry, xattr_name, buffer, size, flags); |
856 | kfree(xattr_name); | ||
857 | return res; | ||
841 | } | 858 | } |
842 | 859 | ||
843 | static size_t hfsplus_osx_listxattr(struct dentry *dentry, char *list, | 860 | static size_t hfsplus_osx_listxattr(struct dentry *dentry, char *list, |
diff --git a/fs/hfsplus/xattr_security.c b/fs/hfsplus/xattr_security.c index 00722765ea79..6ec5e107691f 100644 --- a/fs/hfsplus/xattr_security.c +++ b/fs/hfsplus/xattr_security.c | |||
@@ -7,6 +7,8 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/security.h> | 9 | #include <linux/security.h> |
10 | #include <linux/nls.h> | ||
11 | |||
10 | #include "hfsplus_fs.h" | 12 | #include "hfsplus_fs.h" |
11 | #include "xattr.h" | 13 | #include "xattr.h" |
12 | #include "acl.h" | 14 | #include "acl.h" |
@@ -14,37 +16,43 @@ | |||
14 | static int hfsplus_security_getxattr(struct dentry *dentry, const char *name, | 16 | static int hfsplus_security_getxattr(struct dentry *dentry, const char *name, |
15 | void *buffer, size_t size, int type) | 17 | void *buffer, size_t size, int type) |
16 | { | 18 | { |
17 | char xattr_name[HFSPLUS_ATTR_MAX_STRLEN + 1] = {0}; | 19 | char *xattr_name; |
18 | size_t len = strlen(name); | 20 | int res; |
19 | 21 | ||
20 | if (!strcmp(name, "")) | 22 | if (!strcmp(name, "")) |
21 | return -EINVAL; | 23 | return -EINVAL; |
22 | 24 | ||
23 | if (len + XATTR_SECURITY_PREFIX_LEN > HFSPLUS_ATTR_MAX_STRLEN) | 25 | xattr_name = kmalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_ATTR_MAX_STRLEN + 1, |
24 | return -EOPNOTSUPP; | 26 | GFP_KERNEL); |
25 | 27 | if (!xattr_name) | |
28 | return -ENOMEM; | ||
26 | strcpy(xattr_name, XATTR_SECURITY_PREFIX); | 29 | strcpy(xattr_name, XATTR_SECURITY_PREFIX); |
27 | strcpy(xattr_name + XATTR_SECURITY_PREFIX_LEN, name); | 30 | strcpy(xattr_name + XATTR_SECURITY_PREFIX_LEN, name); |
28 | 31 | ||
29 | return hfsplus_getxattr(dentry, xattr_name, buffer, size); | 32 | res = hfsplus_getxattr(dentry, xattr_name, buffer, size); |
33 | kfree(xattr_name); | ||
34 | return res; | ||
30 | } | 35 | } |
31 | 36 | ||
32 | static int hfsplus_security_setxattr(struct dentry *dentry, const char *name, | 37 | static int hfsplus_security_setxattr(struct dentry *dentry, const char *name, |
33 | const void *buffer, size_t size, int flags, int type) | 38 | const void *buffer, size_t size, int flags, int type) |
34 | { | 39 | { |
35 | char xattr_name[HFSPLUS_ATTR_MAX_STRLEN + 1] = {0}; | 40 | char *xattr_name; |
36 | size_t len = strlen(name); | 41 | int res; |
37 | 42 | ||
38 | if (!strcmp(name, "")) | 43 | if (!strcmp(name, "")) |
39 | return -EINVAL; | 44 | return -EINVAL; |
40 | 45 | ||
41 | if (len + XATTR_SECURITY_PREFIX_LEN > HFSPLUS_ATTR_MAX_STRLEN) | 46 | xattr_name = kmalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_ATTR_MAX_STRLEN + 1, |
42 | return -EOPNOTSUPP; | 47 | GFP_KERNEL); |
43 | 48 | if (!xattr_name) | |
49 | return -ENOMEM; | ||
44 | strcpy(xattr_name, XATTR_SECURITY_PREFIX); | 50 | strcpy(xattr_name, XATTR_SECURITY_PREFIX); |
45 | strcpy(xattr_name + XATTR_SECURITY_PREFIX_LEN, name); | 51 | strcpy(xattr_name + XATTR_SECURITY_PREFIX_LEN, name); |
46 | 52 | ||
47 | return hfsplus_setxattr(dentry, xattr_name, buffer, size, flags); | 53 | res = hfsplus_setxattr(dentry, xattr_name, buffer, size, flags); |
54 | kfree(xattr_name); | ||
55 | return res; | ||
48 | } | 56 | } |
49 | 57 | ||
50 | static size_t hfsplus_security_listxattr(struct dentry *dentry, char *list, | 58 | static size_t hfsplus_security_listxattr(struct dentry *dentry, char *list, |
@@ -62,31 +70,30 @@ static int hfsplus_initxattrs(struct inode *inode, | |||
62 | void *fs_info) | 70 | void *fs_info) |
63 | { | 71 | { |
64 | const struct xattr *xattr; | 72 | const struct xattr *xattr; |
65 | char xattr_name[HFSPLUS_ATTR_MAX_STRLEN + 1] = {0}; | 73 | char *xattr_name; |
66 | size_t xattr_name_len; | ||
67 | int err = 0; | 74 | int err = 0; |
68 | 75 | ||
76 | xattr_name = kmalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_ATTR_MAX_STRLEN + 1, | ||
77 | GFP_KERNEL); | ||
78 | if (!xattr_name) | ||
79 | return -ENOMEM; | ||
69 | for (xattr = xattr_array; xattr->name != NULL; xattr++) { | 80 | for (xattr = xattr_array; xattr->name != NULL; xattr++) { |
70 | xattr_name_len = strlen(xattr->name); | ||
71 | 81 | ||
72 | if (xattr_name_len == 0) | 82 | if (!strcmp(xattr->name, "")) |
73 | continue; | 83 | continue; |
74 | 84 | ||
75 | if (xattr_name_len + XATTR_SECURITY_PREFIX_LEN > | ||
76 | HFSPLUS_ATTR_MAX_STRLEN) | ||
77 | return -EOPNOTSUPP; | ||
78 | |||
79 | strcpy(xattr_name, XATTR_SECURITY_PREFIX); | 85 | strcpy(xattr_name, XATTR_SECURITY_PREFIX); |
80 | strcpy(xattr_name + | 86 | strcpy(xattr_name + |
81 | XATTR_SECURITY_PREFIX_LEN, xattr->name); | 87 | XATTR_SECURITY_PREFIX_LEN, xattr->name); |
82 | memset(xattr_name + | 88 | memset(xattr_name + |
83 | XATTR_SECURITY_PREFIX_LEN + xattr_name_len, 0, 1); | 89 | XATTR_SECURITY_PREFIX_LEN + strlen(xattr->name), 0, 1); |
84 | 90 | ||
85 | err = __hfsplus_setxattr(inode, xattr_name, | 91 | err = __hfsplus_setxattr(inode, xattr_name, |
86 | xattr->value, xattr->value_len, 0); | 92 | xattr->value, xattr->value_len, 0); |
87 | if (err) | 93 | if (err) |
88 | break; | 94 | break; |
89 | } | 95 | } |
96 | kfree(xattr_name); | ||
90 | return err; | 97 | return err; |
91 | } | 98 | } |
92 | 99 | ||
diff --git a/fs/hfsplus/xattr_trusted.c b/fs/hfsplus/xattr_trusted.c index 426cee277542..3c5f27e4746a 100644 --- a/fs/hfsplus/xattr_trusted.c +++ b/fs/hfsplus/xattr_trusted.c | |||
@@ -6,43 +6,51 @@ | |||
6 | * Handler for trusted extended attributes. | 6 | * Handler for trusted extended attributes. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/nls.h> | ||
10 | |||
9 | #include "hfsplus_fs.h" | 11 | #include "hfsplus_fs.h" |
10 | #include "xattr.h" | 12 | #include "xattr.h" |
11 | 13 | ||
12 | static int hfsplus_trusted_getxattr(struct dentry *dentry, const char *name, | 14 | static int hfsplus_trusted_getxattr(struct dentry *dentry, const char *name, |
13 | void *buffer, size_t size, int type) | 15 | void *buffer, size_t size, int type) |
14 | { | 16 | { |
15 | char xattr_name[HFSPLUS_ATTR_MAX_STRLEN + 1] = {0}; | 17 | char *xattr_name; |
16 | size_t len = strlen(name); | 18 | int res; |
17 | 19 | ||
18 | if (!strcmp(name, "")) | 20 | if (!strcmp(name, "")) |
19 | return -EINVAL; | 21 | return -EINVAL; |
20 | 22 | ||
21 | if (len + XATTR_TRUSTED_PREFIX_LEN > HFSPLUS_ATTR_MAX_STRLEN) | 23 | xattr_name = kmalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_ATTR_MAX_STRLEN + 1, |
22 | return -EOPNOTSUPP; | 24 | GFP_KERNEL); |
23 | 25 | if (!xattr_name) | |
26 | return -ENOMEM; | ||
24 | strcpy(xattr_name, XATTR_TRUSTED_PREFIX); | 27 | strcpy(xattr_name, XATTR_TRUSTED_PREFIX); |
25 | strcpy(xattr_name + XATTR_TRUSTED_PREFIX_LEN, name); | 28 | strcpy(xattr_name + XATTR_TRUSTED_PREFIX_LEN, name); |
26 | 29 | ||
27 | return hfsplus_getxattr(dentry, xattr_name, buffer, size); | 30 | res = hfsplus_getxattr(dentry, xattr_name, buffer, size); |
31 | kfree(xattr_name); | ||
32 | return res; | ||
28 | } | 33 | } |
29 | 34 | ||
30 | static int hfsplus_trusted_setxattr(struct dentry *dentry, const char *name, | 35 | static int hfsplus_trusted_setxattr(struct dentry *dentry, const char *name, |
31 | const void *buffer, size_t size, int flags, int type) | 36 | const void *buffer, size_t size, int flags, int type) |
32 | { | 37 | { |
33 | char xattr_name[HFSPLUS_ATTR_MAX_STRLEN + 1] = {0}; | 38 | char *xattr_name; |
34 | size_t len = strlen(name); | 39 | int res; |
35 | 40 | ||
36 | if (!strcmp(name, "")) | 41 | if (!strcmp(name, "")) |
37 | return -EINVAL; | 42 | return -EINVAL; |
38 | 43 | ||
39 | if (len + XATTR_TRUSTED_PREFIX_LEN > HFSPLUS_ATTR_MAX_STRLEN) | 44 | xattr_name = kmalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_ATTR_MAX_STRLEN + 1, |
40 | return -EOPNOTSUPP; | 45 | GFP_KERNEL); |
41 | 46 | if (!xattr_name) | |
47 | return -ENOMEM; | ||
42 | strcpy(xattr_name, XATTR_TRUSTED_PREFIX); | 48 | strcpy(xattr_name, XATTR_TRUSTED_PREFIX); |
43 | strcpy(xattr_name + XATTR_TRUSTED_PREFIX_LEN, name); | 49 | strcpy(xattr_name + XATTR_TRUSTED_PREFIX_LEN, name); |
44 | 50 | ||
45 | return hfsplus_setxattr(dentry, xattr_name, buffer, size, flags); | 51 | res = hfsplus_setxattr(dentry, xattr_name, buffer, size, flags); |
52 | kfree(xattr_name); | ||
53 | return res; | ||
46 | } | 54 | } |
47 | 55 | ||
48 | static size_t hfsplus_trusted_listxattr(struct dentry *dentry, char *list, | 56 | static size_t hfsplus_trusted_listxattr(struct dentry *dentry, char *list, |
diff --git a/fs/hfsplus/xattr_user.c b/fs/hfsplus/xattr_user.c index e34016561ae0..2b625a538b64 100644 --- a/fs/hfsplus/xattr_user.c +++ b/fs/hfsplus/xattr_user.c | |||
@@ -6,43 +6,51 @@ | |||
6 | * Handler for user extended attributes. | 6 | * Handler for user extended attributes. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/nls.h> | ||
10 | |||
9 | #include "hfsplus_fs.h" | 11 | #include "hfsplus_fs.h" |
10 | #include "xattr.h" | 12 | #include "xattr.h" |
11 | 13 | ||
12 | static int hfsplus_user_getxattr(struct dentry *dentry, const char *name, | 14 | static int hfsplus_user_getxattr(struct dentry *dentry, const char *name, |
13 | void *buffer, size_t size, int type) | 15 | void *buffer, size_t size, int type) |
14 | { | 16 | { |
15 | char xattr_name[HFSPLUS_ATTR_MAX_STRLEN + 1] = {0}; | 17 | char *xattr_name; |
16 | size_t len = strlen(name); | 18 | int res; |
17 | 19 | ||
18 | if (!strcmp(name, "")) | 20 | if (!strcmp(name, "")) |
19 | return -EINVAL; | 21 | return -EINVAL; |
20 | 22 | ||
21 | if (len + XATTR_USER_PREFIX_LEN > HFSPLUS_ATTR_MAX_STRLEN) | 23 | xattr_name = kmalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_ATTR_MAX_STRLEN + 1, |
22 | return -EOPNOTSUPP; | 24 | GFP_KERNEL); |
23 | 25 | if (!xattr_name) | |
26 | return -ENOMEM; | ||
24 | strcpy(xattr_name, XATTR_USER_PREFIX); | 27 | strcpy(xattr_name, XATTR_USER_PREFIX); |
25 | strcpy(xattr_name + XATTR_USER_PREFIX_LEN, name); | 28 | strcpy(xattr_name + XATTR_USER_PREFIX_LEN, name); |
26 | 29 | ||
27 | return hfsplus_getxattr(dentry, xattr_name, buffer, size); | 30 | res = hfsplus_getxattr(dentry, xattr_name, buffer, size); |
31 | kfree(xattr_name); | ||
32 | return res; | ||
28 | } | 33 | } |
29 | 34 | ||
30 | static int hfsplus_user_setxattr(struct dentry *dentry, const char *name, | 35 | static int hfsplus_user_setxattr(struct dentry *dentry, const char *name, |
31 | const void *buffer, size_t size, int flags, int type) | 36 | const void *buffer, size_t size, int flags, int type) |
32 | { | 37 | { |
33 | char xattr_name[HFSPLUS_ATTR_MAX_STRLEN + 1] = {0}; | 38 | char *xattr_name; |
34 | size_t len = strlen(name); | 39 | int res; |
35 | 40 | ||
36 | if (!strcmp(name, "")) | 41 | if (!strcmp(name, "")) |
37 | return -EINVAL; | 42 | return -EINVAL; |
38 | 43 | ||
39 | if (len + XATTR_USER_PREFIX_LEN > HFSPLUS_ATTR_MAX_STRLEN) | 44 | xattr_name = kmalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_ATTR_MAX_STRLEN + 1, |
40 | return -EOPNOTSUPP; | 45 | GFP_KERNEL); |
41 | 46 | if (!xattr_name) | |
47 | return -ENOMEM; | ||
42 | strcpy(xattr_name, XATTR_USER_PREFIX); | 48 | strcpy(xattr_name, XATTR_USER_PREFIX); |
43 | strcpy(xattr_name + XATTR_USER_PREFIX_LEN, name); | 49 | strcpy(xattr_name + XATTR_USER_PREFIX_LEN, name); |
44 | 50 | ||
45 | return hfsplus_setxattr(dentry, xattr_name, buffer, size, flags); | 51 | res = hfsplus_setxattr(dentry, xattr_name, buffer, size, flags); |
52 | kfree(xattr_name); | ||
53 | return res; | ||
46 | } | 54 | } |
47 | 55 | ||
48 | static size_t hfsplus_user_listxattr(struct dentry *dentry, char *list, | 56 | static size_t hfsplus_user_listxattr(struct dentry *dentry, char *list, |
diff --git a/fs/hpfs/alloc.c b/fs/hpfs/alloc.c index 58b5106186d0..f005046e1591 100644 --- a/fs/hpfs/alloc.c +++ b/fs/hpfs/alloc.c | |||
@@ -316,7 +316,7 @@ void hpfs_free_sectors(struct super_block *s, secno sec, unsigned n) | |||
316 | struct quad_buffer_head qbh; | 316 | struct quad_buffer_head qbh; |
317 | __le32 *bmp; | 317 | __le32 *bmp; |
318 | struct hpfs_sb_info *sbi = hpfs_sb(s); | 318 | struct hpfs_sb_info *sbi = hpfs_sb(s); |
319 | /*printk("2 - ");*/ | 319 | /*pr_info("2 - ");*/ |
320 | if (!n) return; | 320 | if (!n) return; |
321 | if (sec < 0x12) { | 321 | if (sec < 0x12) { |
322 | hpfs_error(s, "Trying to free reserved sector %08x", sec); | 322 | hpfs_error(s, "Trying to free reserved sector %08x", sec); |
diff --git a/fs/hpfs/buffer.c b/fs/hpfs/buffer.c index 139ef1684d07..8057fe4e6574 100644 --- a/fs/hpfs/buffer.c +++ b/fs/hpfs/buffer.c | |||
@@ -55,7 +55,7 @@ void *hpfs_map_sector(struct super_block *s, unsigned secno, struct buffer_head | |||
55 | if (bh != NULL) | 55 | if (bh != NULL) |
56 | return bh->b_data; | 56 | return bh->b_data; |
57 | else { | 57 | else { |
58 | printk("HPFS: hpfs_map_sector: read error\n"); | 58 | pr_err("%s(): read error\n", __func__); |
59 | return NULL; | 59 | return NULL; |
60 | } | 60 | } |
61 | } | 61 | } |
@@ -76,7 +76,7 @@ void *hpfs_get_sector(struct super_block *s, unsigned secno, struct buffer_head | |||
76 | set_buffer_uptodate(bh); | 76 | set_buffer_uptodate(bh); |
77 | return bh->b_data; | 77 | return bh->b_data; |
78 | } else { | 78 | } else { |
79 | printk("HPFS: hpfs_get_sector: getblk failed\n"); | 79 | pr_err("%s(): getblk failed\n", __func__); |
80 | return NULL; | 80 | return NULL; |
81 | } | 81 | } |
82 | } | 82 | } |
@@ -93,7 +93,7 @@ void *hpfs_map_4sectors(struct super_block *s, unsigned secno, struct quad_buffe | |||
93 | cond_resched(); | 93 | cond_resched(); |
94 | 94 | ||
95 | if (secno & 3) { | 95 | if (secno & 3) { |
96 | printk("HPFS: hpfs_map_4sectors: unaligned read\n"); | 96 | pr_err("%s(): unaligned read\n", __func__); |
97 | return NULL; | 97 | return NULL; |
98 | } | 98 | } |
99 | 99 | ||
@@ -112,7 +112,7 @@ void *hpfs_map_4sectors(struct super_block *s, unsigned secno, struct quad_buffe | |||
112 | 112 | ||
113 | qbh->data = data = kmalloc(2048, GFP_NOFS); | 113 | qbh->data = data = kmalloc(2048, GFP_NOFS); |
114 | if (!data) { | 114 | if (!data) { |
115 | printk("HPFS: hpfs_map_4sectors: out of memory\n"); | 115 | pr_err("%s(): out of memory\n", __func__); |
116 | goto bail4; | 116 | goto bail4; |
117 | } | 117 | } |
118 | 118 | ||
@@ -145,7 +145,7 @@ void *hpfs_get_4sectors(struct super_block *s, unsigned secno, | |||
145 | hpfs_lock_assert(s); | 145 | hpfs_lock_assert(s); |
146 | 146 | ||
147 | if (secno & 3) { | 147 | if (secno & 3) { |
148 | printk("HPFS: hpfs_get_4sectors: unaligned read\n"); | 148 | pr_err("%s(): unaligned read\n", __func__); |
149 | return NULL; | 149 | return NULL; |
150 | } | 150 | } |
151 | 151 | ||
@@ -161,7 +161,7 @@ void *hpfs_get_4sectors(struct super_block *s, unsigned secno, | |||
161 | } | 161 | } |
162 | 162 | ||
163 | if (!(qbh->data = kmalloc(2048, GFP_NOFS))) { | 163 | if (!(qbh->data = kmalloc(2048, GFP_NOFS))) { |
164 | printk("HPFS: hpfs_get_4sectors: out of memory\n"); | 164 | pr_err("%s(): out of memory\n", __func__); |
165 | goto bail4; | 165 | goto bail4; |
166 | } | 166 | } |
167 | return qbh->data; | 167 | return qbh->data; |
diff --git a/fs/hpfs/dir.c b/fs/hpfs/dir.c index 292b1acb9b81..2a8e07425de0 100644 --- a/fs/hpfs/dir.c +++ b/fs/hpfs/dir.c | |||
@@ -36,7 +36,7 @@ static loff_t hpfs_dir_lseek(struct file *filp, loff_t off, int whence) | |||
36 | mutex_lock(&i->i_mutex); | 36 | mutex_lock(&i->i_mutex); |
37 | hpfs_lock(s); | 37 | hpfs_lock(s); |
38 | 38 | ||
39 | /*printk("dir lseek\n");*/ | 39 | /*pr_info("dir lseek\n");*/ |
40 | if (new_off == 0 || new_off == 1 || new_off == 11 || new_off == 12 || new_off == 13) goto ok; | 40 | if (new_off == 0 || new_off == 1 || new_off == 11 || new_off == 12 || new_off == 13) goto ok; |
41 | pos = ((loff_t) hpfs_de_as_down_as_possible(s, hpfs_inode->i_dno) << 4) + 1; | 41 | pos = ((loff_t) hpfs_de_as_down_as_possible(s, hpfs_inode->i_dno) << 4) + 1; |
42 | while (pos != new_off) { | 42 | while (pos != new_off) { |
@@ -51,7 +51,7 @@ ok: | |||
51 | mutex_unlock(&i->i_mutex); | 51 | mutex_unlock(&i->i_mutex); |
52 | return new_off; | 52 | return new_off; |
53 | fail: | 53 | fail: |
54 | /*printk("illegal lseek: %016llx\n", new_off);*/ | 54 | /*pr_warn("illegal lseek: %016llx\n", new_off);*/ |
55 | hpfs_unlock(s); | 55 | hpfs_unlock(s); |
56 | mutex_unlock(&i->i_mutex); | 56 | mutex_unlock(&i->i_mutex); |
57 | return -ESPIPE; | 57 | return -ESPIPE; |
@@ -127,7 +127,7 @@ static int hpfs_readdir(struct file *file, struct dir_context *ctx) | |||
127 | if (ctx->pos == 12) | 127 | if (ctx->pos == 12) |
128 | goto out; | 128 | goto out; |
129 | if (ctx->pos == 3 || ctx->pos == 4 || ctx->pos == 5) { | 129 | if (ctx->pos == 3 || ctx->pos == 4 || ctx->pos == 5) { |
130 | printk("HPFS: warning: pos==%d\n",(int)ctx->pos); | 130 | pr_err("pos==%d\n", (int)ctx->pos); |
131 | goto out; | 131 | goto out; |
132 | } | 132 | } |
133 | if (ctx->pos == 0) { | 133 | if (ctx->pos == 0) { |
diff --git a/fs/hpfs/dnode.c b/fs/hpfs/dnode.c index 4364b2a02c5d..f36fc010fccb 100644 --- a/fs/hpfs/dnode.c +++ b/fs/hpfs/dnode.c | |||
@@ -17,7 +17,7 @@ static loff_t get_pos(struct dnode *d, struct hpfs_dirent *fde) | |||
17 | if (de == fde) return ((loff_t) le32_to_cpu(d->self) << 4) | (loff_t)i; | 17 | if (de == fde) return ((loff_t) le32_to_cpu(d->self) << 4) | (loff_t)i; |
18 | i++; | 18 | i++; |
19 | } | 19 | } |
20 | printk("HPFS: get_pos: not_found\n"); | 20 | pr_info("%s(): not_found\n", __func__); |
21 | return ((loff_t)le32_to_cpu(d->self) << 4) | (loff_t)1; | 21 | return ((loff_t)le32_to_cpu(d->self) << 4) | (loff_t)1; |
22 | } | 22 | } |
23 | 23 | ||
@@ -32,7 +32,7 @@ void hpfs_add_pos(struct inode *inode, loff_t *pos) | |||
32 | if (hpfs_inode->i_rddir_off[i] == pos) return; | 32 | if (hpfs_inode->i_rddir_off[i] == pos) return; |
33 | if (!(i&0x0f)) { | 33 | if (!(i&0x0f)) { |
34 | if (!(ppos = kmalloc((i+0x11) * sizeof(loff_t*), GFP_NOFS))) { | 34 | if (!(ppos = kmalloc((i+0x11) * sizeof(loff_t*), GFP_NOFS))) { |
35 | printk("HPFS: out of memory for position list\n"); | 35 | pr_err("out of memory for position list\n"); |
36 | return; | 36 | return; |
37 | } | 37 | } |
38 | if (hpfs_inode->i_rddir_off) { | 38 | if (hpfs_inode->i_rddir_off) { |
@@ -63,7 +63,8 @@ void hpfs_del_pos(struct inode *inode, loff_t *pos) | |||
63 | } | 63 | } |
64 | return; | 64 | return; |
65 | not_f: | 65 | not_f: |
66 | /*printk("HPFS: warning: position pointer %p->%08x not found\n", pos, (int)*pos);*/ | 66 | /*pr_warn("position pointer %p->%08x not found\n", |
67 | pos, (int)*pos);*/ | ||
67 | return; | 68 | return; |
68 | } | 69 | } |
69 | 70 | ||
@@ -92,8 +93,11 @@ static void hpfs_pos_ins(loff_t *p, loff_t d, loff_t c) | |||
92 | { | 93 | { |
93 | if ((*p & ~0x3f) == (d & ~0x3f) && (*p & 0x3f) >= (d & 0x3f)) { | 94 | if ((*p & ~0x3f) == (d & ~0x3f) && (*p & 0x3f) >= (d & 0x3f)) { |
94 | int n = (*p & 0x3f) + c; | 95 | int n = (*p & 0x3f) + c; |
95 | if (n > 0x3f) printk("HPFS: hpfs_pos_ins: %08x + %d\n", (int)*p, (int)c >> 8); | 96 | if (n > 0x3f) |
96 | else *p = (*p & ~0x3f) | n; | 97 | pr_err("%s(): %08x + %d\n", |
98 | __func__, (int)*p, (int)c >> 8); | ||
99 | else | ||
100 | *p = (*p & ~0x3f) | n; | ||
97 | } | 101 | } |
98 | } | 102 | } |
99 | 103 | ||
@@ -101,8 +105,11 @@ static void hpfs_pos_del(loff_t *p, loff_t d, loff_t c) | |||
101 | { | 105 | { |
102 | if ((*p & ~0x3f) == (d & ~0x3f) && (*p & 0x3f) >= (d & 0x3f)) { | 106 | if ((*p & ~0x3f) == (d & ~0x3f) && (*p & 0x3f) >= (d & 0x3f)) { |
103 | int n = (*p & 0x3f) - c; | 107 | int n = (*p & 0x3f) - c; |
104 | if (n < 1) printk("HPFS: hpfs_pos_ins: %08x - %d\n", (int)*p, (int)c >> 8); | 108 | if (n < 1) |
105 | else *p = (*p & ~0x3f) | n; | 109 | pr_err("%s(): %08x - %d\n", |
110 | __func__, (int)*p, (int)c >> 8); | ||
111 | else | ||
112 | *p = (*p & ~0x3f) | n; | ||
106 | } | 113 | } |
107 | } | 114 | } |
108 | 115 | ||
@@ -239,12 +246,12 @@ static int hpfs_add_to_dnode(struct inode *i, dnode_secno dno, | |||
239 | struct fnode *fnode; | 246 | struct fnode *fnode; |
240 | int c1, c2 = 0; | 247 | int c1, c2 = 0; |
241 | if (!(nname = kmalloc(256, GFP_NOFS))) { | 248 | if (!(nname = kmalloc(256, GFP_NOFS))) { |
242 | printk("HPFS: out of memory, can't add to dnode\n"); | 249 | pr_err("out of memory, can't add to dnode\n"); |
243 | return 1; | 250 | return 1; |
244 | } | 251 | } |
245 | go_up: | 252 | go_up: |
246 | if (namelen >= 256) { | 253 | if (namelen >= 256) { |
247 | hpfs_error(i->i_sb, "hpfs_add_to_dnode: namelen == %d", namelen); | 254 | hpfs_error(i->i_sb, "%s(): namelen == %d", __func__, namelen); |
248 | kfree(nd); | 255 | kfree(nd); |
249 | kfree(nname); | 256 | kfree(nname); |
250 | return 1; | 257 | return 1; |
@@ -281,7 +288,7 @@ static int hpfs_add_to_dnode(struct inode *i, dnode_secno dno, | |||
281 | not be any error while splitting dnodes, otherwise the | 288 | not be any error while splitting dnodes, otherwise the |
282 | whole directory, not only file we're adding, would | 289 | whole directory, not only file we're adding, would |
283 | be lost. */ | 290 | be lost. */ |
284 | printk("HPFS: out of memory for dnode splitting\n"); | 291 | pr_err("out of memory for dnode splitting\n"); |
285 | hpfs_brelse4(&qbh); | 292 | hpfs_brelse4(&qbh); |
286 | kfree(nname); | 293 | kfree(nname); |
287 | return 1; | 294 | return 1; |
@@ -597,7 +604,7 @@ static void delete_empty_dnode(struct inode *i, dnode_secno dno) | |||
597 | if (!de_next->down) goto endm; | 604 | if (!de_next->down) goto endm; |
598 | ndown = de_down_pointer(de_next); | 605 | ndown = de_down_pointer(de_next); |
599 | if (!(de_cp = kmalloc(le16_to_cpu(de->length), GFP_NOFS))) { | 606 | if (!(de_cp = kmalloc(le16_to_cpu(de->length), GFP_NOFS))) { |
600 | printk("HPFS: out of memory for dtree balancing\n"); | 607 | pr_err("out of memory for dtree balancing\n"); |
601 | goto endm; | 608 | goto endm; |
602 | } | 609 | } |
603 | memcpy(de_cp, de, le16_to_cpu(de->length)); | 610 | memcpy(de_cp, de, le16_to_cpu(de->length)); |
@@ -612,7 +619,8 @@ static void delete_empty_dnode(struct inode *i, dnode_secno dno) | |||
612 | hpfs_brelse4(&qbh1); | 619 | hpfs_brelse4(&qbh1); |
613 | } | 620 | } |
614 | hpfs_add_to_dnode(i, ndown, de_cp->name, de_cp->namelen, de_cp, de_cp->down ? de_down_pointer(de_cp) : 0); | 621 | hpfs_add_to_dnode(i, ndown, de_cp->name, de_cp->namelen, de_cp, de_cp->down ? de_down_pointer(de_cp) : 0); |
615 | /*printk("UP-TO-DNODE: %08x (ndown = %08x, down = %08x, dno = %08x)\n", up, ndown, down, dno);*/ | 622 | /*pr_info("UP-TO-DNODE: %08x (ndown = %08x, down = %08x, dno = %08x)\n", |
623 | up, ndown, down, dno);*/ | ||
616 | dno = up; | 624 | dno = up; |
617 | kfree(de_cp); | 625 | kfree(de_cp); |
618 | goto try_it_again; | 626 | goto try_it_again; |
@@ -637,15 +645,15 @@ static void delete_empty_dnode(struct inode *i, dnode_secno dno) | |||
637 | if (!dlp && down) { | 645 | if (!dlp && down) { |
638 | if (le32_to_cpu(d1->first_free) > 2044) { | 646 | if (le32_to_cpu(d1->first_free) > 2044) { |
639 | if (hpfs_sb(i->i_sb)->sb_chk >= 2) { | 647 | if (hpfs_sb(i->i_sb)->sb_chk >= 2) { |
640 | printk("HPFS: warning: unbalanced dnode tree, see hpfs.txt 4 more info\n"); | 648 | pr_err("unbalanced dnode tree, see hpfs.txt 4 more info\n"); |
641 | printk("HPFS: warning: terminating balancing operation\n"); | 649 | pr_err("terminating balancing operation\n"); |
642 | } | 650 | } |
643 | hpfs_brelse4(&qbh1); | 651 | hpfs_brelse4(&qbh1); |
644 | goto endm; | 652 | goto endm; |
645 | } | 653 | } |
646 | if (hpfs_sb(i->i_sb)->sb_chk >= 2) { | 654 | if (hpfs_sb(i->i_sb)->sb_chk >= 2) { |
647 | printk("HPFS: warning: unbalanced dnode tree, see hpfs.txt 4 more info\n"); | 655 | pr_err("unbalanced dnode tree, see hpfs.txt 4 more info\n"); |
648 | printk("HPFS: warning: goin'on\n"); | 656 | pr_err("goin'on\n"); |
649 | } | 657 | } |
650 | le16_add_cpu(&del->length, 4); | 658 | le16_add_cpu(&del->length, 4); |
651 | del->down = 1; | 659 | del->down = 1; |
@@ -659,7 +667,7 @@ static void delete_empty_dnode(struct inode *i, dnode_secno dno) | |||
659 | *(__le32 *) ((void *) del + le16_to_cpu(del->length) - 4) = cpu_to_le32(down); | 667 | *(__le32 *) ((void *) del + le16_to_cpu(del->length) - 4) = cpu_to_le32(down); |
660 | } else goto endm; | 668 | } else goto endm; |
661 | if (!(de_cp = kmalloc(le16_to_cpu(de_prev->length), GFP_NOFS))) { | 669 | if (!(de_cp = kmalloc(le16_to_cpu(de_prev->length), GFP_NOFS))) { |
662 | printk("HPFS: out of memory for dtree balancing\n"); | 670 | pr_err("out of memory for dtree balancing\n"); |
663 | hpfs_brelse4(&qbh1); | 671 | hpfs_brelse4(&qbh1); |
664 | goto endm; | 672 | goto endm; |
665 | } | 673 | } |
@@ -1000,7 +1008,7 @@ struct hpfs_dirent *map_fnode_dirent(struct super_block *s, fnode_secno fno, | |||
1000 | int d1, d2 = 0; | 1008 | int d1, d2 = 0; |
1001 | name1 = f->name; | 1009 | name1 = f->name; |
1002 | if (!(name2 = kmalloc(256, GFP_NOFS))) { | 1010 | if (!(name2 = kmalloc(256, GFP_NOFS))) { |
1003 | printk("HPFS: out of memory, can't map dirent\n"); | 1011 | pr_err("out of memory, can't map dirent\n"); |
1004 | return NULL; | 1012 | return NULL; |
1005 | } | 1013 | } |
1006 | if (f->len <= 15) | 1014 | if (f->len <= 15) |
diff --git a/fs/hpfs/ea.c b/fs/hpfs/ea.c index bcaafcd2666a..ce3f98ba993a 100644 --- a/fs/hpfs/ea.c +++ b/fs/hpfs/ea.c | |||
@@ -51,7 +51,7 @@ static char *get_indirect_ea(struct super_block *s, int ano, secno a, int size) | |||
51 | { | 51 | { |
52 | char *ret; | 52 | char *ret; |
53 | if (!(ret = kmalloc(size + 1, GFP_NOFS))) { | 53 | if (!(ret = kmalloc(size + 1, GFP_NOFS))) { |
54 | printk("HPFS: out of memory for EA\n"); | 54 | pr_err("out of memory for EA\n"); |
55 | return NULL; | 55 | return NULL; |
56 | } | 56 | } |
57 | if (hpfs_ea_read(s, a, ano, 0, size, ret)) { | 57 | if (hpfs_ea_read(s, a, ano, 0, size, ret)) { |
@@ -139,7 +139,7 @@ char *hpfs_get_ea(struct super_block *s, struct fnode *fnode, char *key, int *si | |||
139 | if (ea_indirect(ea)) | 139 | if (ea_indirect(ea)) |
140 | return get_indirect_ea(s, ea_in_anode(ea), ea_sec(ea), *size = ea_len(ea)); | 140 | return get_indirect_ea(s, ea_in_anode(ea), ea_sec(ea), *size = ea_len(ea)); |
141 | if (!(ret = kmalloc((*size = ea_valuelen(ea)) + 1, GFP_NOFS))) { | 141 | if (!(ret = kmalloc((*size = ea_valuelen(ea)) + 1, GFP_NOFS))) { |
142 | printk("HPFS: out of memory for EA\n"); | 142 | pr_err("out of memory for EA\n"); |
143 | return NULL; | 143 | return NULL; |
144 | } | 144 | } |
145 | memcpy(ret, ea_data(ea), ea_valuelen(ea)); | 145 | memcpy(ret, ea_data(ea), ea_valuelen(ea)); |
@@ -165,7 +165,7 @@ char *hpfs_get_ea(struct super_block *s, struct fnode *fnode, char *key, int *si | |||
165 | if (ea_indirect(ea)) | 165 | if (ea_indirect(ea)) |
166 | return get_indirect_ea(s, ea_in_anode(ea), ea_sec(ea), *size = ea_len(ea)); | 166 | return get_indirect_ea(s, ea_in_anode(ea), ea_sec(ea), *size = ea_len(ea)); |
167 | if (!(ret = kmalloc((*size = ea_valuelen(ea)) + 1, GFP_NOFS))) { | 167 | if (!(ret = kmalloc((*size = ea_valuelen(ea)) + 1, GFP_NOFS))) { |
168 | printk("HPFS: out of memory for EA\n"); | 168 | pr_err("out of memory for EA\n"); |
169 | return NULL; | 169 | return NULL; |
170 | } | 170 | } |
171 | if (hpfs_ea_read(s, a, ano, pos + 4 + ea->namelen + 1, ea_valuelen(ea), ret)) { | 171 | if (hpfs_ea_read(s, a, ano, pos + 4 + ea->namelen + 1, ea_valuelen(ea), ret)) { |
diff --git a/fs/hpfs/hpfs_fn.h b/fs/hpfs/hpfs_fn.h index 3ba49c080e42..b63b75fa00e7 100644 --- a/fs/hpfs/hpfs_fn.h +++ b/fs/hpfs/hpfs_fn.h | |||
@@ -8,6 +8,11 @@ | |||
8 | 8 | ||
9 | //#define DBG | 9 | //#define DBG |
10 | //#define DEBUG_LOCKS | 10 | //#define DEBUG_LOCKS |
11 | #ifdef pr_fmt | ||
12 | #undef pr_fmt | ||
13 | #endif | ||
14 | |||
15 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
11 | 16 | ||
12 | #include <linux/mutex.h> | 17 | #include <linux/mutex.h> |
13 | #include <linux/pagemap.h> | 18 | #include <linux/pagemap.h> |
diff --git a/fs/hpfs/inode.c b/fs/hpfs/inode.c index 50a427313835..7ce4b74234a1 100644 --- a/fs/hpfs/inode.c +++ b/fs/hpfs/inode.c | |||
@@ -183,7 +183,8 @@ void hpfs_write_inode(struct inode *i) | |||
183 | struct inode *parent; | 183 | struct inode *parent; |
184 | if (i->i_ino == hpfs_sb(i->i_sb)->sb_root) return; | 184 | if (i->i_ino == hpfs_sb(i->i_sb)->sb_root) return; |
185 | if (hpfs_inode->i_rddir_off && !atomic_read(&i->i_count)) { | 185 | if (hpfs_inode->i_rddir_off && !atomic_read(&i->i_count)) { |
186 | if (*hpfs_inode->i_rddir_off) printk("HPFS: write_inode: some position still there\n"); | 186 | if (*hpfs_inode->i_rddir_off) |
187 | pr_err("write_inode: some position still there\n"); | ||
187 | kfree(hpfs_inode->i_rddir_off); | 188 | kfree(hpfs_inode->i_rddir_off); |
188 | hpfs_inode->i_rddir_off = NULL; | 189 | hpfs_inode->i_rddir_off = NULL; |
189 | } | 190 | } |
diff --git a/fs/hpfs/map.c b/fs/hpfs/map.c index 3aa66ae1031e..442770edcdc7 100644 --- a/fs/hpfs/map.c +++ b/fs/hpfs/map.c | |||
@@ -65,12 +65,13 @@ unsigned char *hpfs_load_code_page(struct super_block *s, secno cps) | |||
65 | struct code_page_directory *cp = hpfs_map_sector(s, cps, &bh, 0); | 65 | struct code_page_directory *cp = hpfs_map_sector(s, cps, &bh, 0); |
66 | if (!cp) return NULL; | 66 | if (!cp) return NULL; |
67 | if (le32_to_cpu(cp->magic) != CP_DIR_MAGIC) { | 67 | if (le32_to_cpu(cp->magic) != CP_DIR_MAGIC) { |
68 | printk("HPFS: Code page directory magic doesn't match (magic = %08x)\n", le32_to_cpu(cp->magic)); | 68 | pr_err("Code page directory magic doesn't match (magic = %08x)\n", |
69 | le32_to_cpu(cp->magic)); | ||
69 | brelse(bh); | 70 | brelse(bh); |
70 | return NULL; | 71 | return NULL; |
71 | } | 72 | } |
72 | if (!le32_to_cpu(cp->n_code_pages)) { | 73 | if (!le32_to_cpu(cp->n_code_pages)) { |
73 | printk("HPFS: n_code_pages == 0\n"); | 74 | pr_err("n_code_pages == 0\n"); |
74 | brelse(bh); | 75 | brelse(bh); |
75 | return NULL; | 76 | return NULL; |
76 | } | 77 | } |
@@ -79,19 +80,19 @@ unsigned char *hpfs_load_code_page(struct super_block *s, secno cps) | |||
79 | brelse(bh); | 80 | brelse(bh); |
80 | 81 | ||
81 | if (cpi >= 3) { | 82 | if (cpi >= 3) { |
82 | printk("HPFS: Code page index out of array\n"); | 83 | pr_err("Code page index out of array\n"); |
83 | return NULL; | 84 | return NULL; |
84 | } | 85 | } |
85 | 86 | ||
86 | if (!(cpd = hpfs_map_sector(s, cpds, &bh, 0))) return NULL; | 87 | if (!(cpd = hpfs_map_sector(s, cpds, &bh, 0))) return NULL; |
87 | if (le16_to_cpu(cpd->offs[cpi]) > 0x178) { | 88 | if (le16_to_cpu(cpd->offs[cpi]) > 0x178) { |
88 | printk("HPFS: Code page index out of sector\n"); | 89 | pr_err("Code page index out of sector\n"); |
89 | brelse(bh); | 90 | brelse(bh); |
90 | return NULL; | 91 | return NULL; |
91 | } | 92 | } |
92 | ptr = (unsigned char *)cpd + le16_to_cpu(cpd->offs[cpi]) + 6; | 93 | ptr = (unsigned char *)cpd + le16_to_cpu(cpd->offs[cpi]) + 6; |
93 | if (!(cp_table = kmalloc(256, GFP_KERNEL))) { | 94 | if (!(cp_table = kmalloc(256, GFP_KERNEL))) { |
94 | printk("HPFS: out of memory for code page table\n"); | 95 | pr_err("out of memory for code page table\n"); |
95 | brelse(bh); | 96 | brelse(bh); |
96 | return NULL; | 97 | return NULL; |
97 | } | 98 | } |
@@ -114,7 +115,7 @@ __le32 *hpfs_load_bitmap_directory(struct super_block *s, secno bmp) | |||
114 | int i; | 115 | int i; |
115 | __le32 *b; | 116 | __le32 *b; |
116 | if (!(b = kmalloc(n * 512, GFP_KERNEL))) { | 117 | if (!(b = kmalloc(n * 512, GFP_KERNEL))) { |
117 | printk("HPFS: can't allocate memory for bitmap directory\n"); | 118 | pr_err("can't allocate memory for bitmap directory\n"); |
118 | return NULL; | 119 | return NULL; |
119 | } | 120 | } |
120 | for (i=0;i<n;i++) { | 121 | for (i=0;i<n;i++) { |
@@ -281,7 +282,9 @@ struct dnode *hpfs_map_dnode(struct super_block *s, unsigned secno, | |||
281 | hpfs_error(s, "dnode %08x does not end with \\377 entry", secno); | 282 | hpfs_error(s, "dnode %08x does not end with \\377 entry", secno); |
282 | goto bail; | 283 | goto bail; |
283 | } | 284 | } |
284 | if (b == 3) printk("HPFS: warning: unbalanced dnode tree, dnode %08x; see hpfs.txt 4 more info\n", secno); | 285 | if (b == 3) |
286 | pr_err("unbalanced dnode tree, dnode %08x; see hpfs.txt 4 more info\n", | ||
287 | secno); | ||
285 | } | 288 | } |
286 | return dnode; | 289 | return dnode; |
287 | bail: | 290 | bail: |
diff --git a/fs/hpfs/name.c b/fs/hpfs/name.c index 9acdf338def0..b00d396d22c6 100644 --- a/fs/hpfs/name.c +++ b/fs/hpfs/name.c | |||
@@ -56,14 +56,15 @@ unsigned char *hpfs_translate_name(struct super_block *s, unsigned char *from, | |||
56 | unsigned char *to; | 56 | unsigned char *to; |
57 | int i; | 57 | int i; |
58 | if (hpfs_sb(s)->sb_chk >= 2) if (hpfs_is_name_long(from, len) != lng) { | 58 | if (hpfs_sb(s)->sb_chk >= 2) if (hpfs_is_name_long(from, len) != lng) { |
59 | printk("HPFS: Long name flag mismatch - name "); | 59 | pr_err("Long name flag mismatch - name "); |
60 | for (i=0; i<len; i++) printk("%c", from[i]); | 60 | for (i = 0; i < len; i++) |
61 | printk(" misidentified as %s.\n", lng ? "short" : "long"); | 61 | pr_cont("%c", from[i]); |
62 | printk("HPFS: It's nothing serious. It could happen because of bug in OS/2.\nHPFS: Set checks=normal to disable this message.\n"); | 62 | pr_cont(" misidentified as %s.\n", lng ? "short" : "long"); |
63 | pr_err("It's nothing serious. It could happen because of bug in OS/2.\nSet checks=normal to disable this message.\n"); | ||
63 | } | 64 | } |
64 | if (!lc) return from; | 65 | if (!lc) return from; |
65 | if (!(to = kmalloc(len, GFP_KERNEL))) { | 66 | if (!(to = kmalloc(len, GFP_KERNEL))) { |
66 | printk("HPFS: can't allocate memory for name conversion buffer\n"); | 67 | pr_err("can't allocate memory for name conversion buffer\n"); |
67 | return from; | 68 | return from; |
68 | } | 69 | } |
69 | for (i = 0; i < len; i++) to[i] = locase(hpfs_sb(s)->sb_cp_table,from[i]); | 70 | for (i = 0; i < len; i++) to[i] = locase(hpfs_sb(s)->sb_cp_table,from[i]); |
diff --git a/fs/hpfs/namei.c b/fs/hpfs/namei.c index 1b39afdd86fd..bdbc2c3080a4 100644 --- a/fs/hpfs/namei.c +++ b/fs/hpfs/namei.c | |||
@@ -404,7 +404,7 @@ again: | |||
404 | d_rehash(dentry); | 404 | d_rehash(dentry); |
405 | } else { | 405 | } else { |
406 | struct iattr newattrs; | 406 | struct iattr newattrs; |
407 | /*printk("HPFS: truncating file before delete.\n");*/ | 407 | /*pr_info("truncating file before delete.\n");*/ |
408 | newattrs.ia_size = 0; | 408 | newattrs.ia_size = 0; |
409 | newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME; | 409 | newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME; |
410 | err = notify_change(dentry, &newattrs, NULL); | 410 | err = notify_change(dentry, &newattrs, NULL); |
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c index fe3463a43236..7cd00d3a7c9b 100644 --- a/fs/hpfs/super.c +++ b/fs/hpfs/super.c | |||
@@ -62,22 +62,26 @@ void hpfs_error(struct super_block *s, const char *fmt, ...) | |||
62 | vsnprintf(err_buf, sizeof(err_buf), fmt, args); | 62 | vsnprintf(err_buf, sizeof(err_buf), fmt, args); |
63 | va_end(args); | 63 | va_end(args); |
64 | 64 | ||
65 | printk("HPFS: filesystem error: %s", err_buf); | 65 | pr_err("filesystem error: %s", err_buf); |
66 | if (!hpfs_sb(s)->sb_was_error) { | 66 | if (!hpfs_sb(s)->sb_was_error) { |
67 | if (hpfs_sb(s)->sb_err == 2) { | 67 | if (hpfs_sb(s)->sb_err == 2) { |
68 | printk("; crashing the system because you wanted it\n"); | 68 | pr_cont("; crashing the system because you wanted it\n"); |
69 | mark_dirty(s, 0); | 69 | mark_dirty(s, 0); |
70 | panic("HPFS panic"); | 70 | panic("HPFS panic"); |
71 | } else if (hpfs_sb(s)->sb_err == 1) { | 71 | } else if (hpfs_sb(s)->sb_err == 1) { |
72 | if (s->s_flags & MS_RDONLY) printk("; already mounted read-only\n"); | 72 | if (s->s_flags & MS_RDONLY) |
73 | pr_cont("; already mounted read-only\n"); | ||
73 | else { | 74 | else { |
74 | printk("; remounting read-only\n"); | 75 | pr_cont("; remounting read-only\n"); |
75 | mark_dirty(s, 0); | 76 | mark_dirty(s, 0); |
76 | s->s_flags |= MS_RDONLY; | 77 | s->s_flags |= MS_RDONLY; |
77 | } | 78 | } |
78 | } else if (s->s_flags & MS_RDONLY) printk("; going on - but anything won't be destroyed because it's read-only\n"); | 79 | } else if (s->s_flags & MS_RDONLY) |
79 | else printk("; corrupted filesystem mounted read/write - your computer will explode within 20 seconds ... but you wanted it so!\n"); | 80 | pr_cont("; going on - but anything won't be destroyed because it's read-only\n"); |
80 | } else printk("\n"); | 81 | else |
82 | pr_cont("; corrupted filesystem mounted read/write - your computer will explode within 20 seconds ... but you wanted it so!\n"); | ||
83 | } else | ||
84 | pr_cont("\n"); | ||
81 | hpfs_sb(s)->sb_was_error = 1; | 85 | hpfs_sb(s)->sb_was_error = 1; |
82 | } | 86 | } |
83 | 87 | ||
@@ -292,7 +296,7 @@ static int parse_opts(char *opts, kuid_t *uid, kgid_t *gid, umode_t *umask, | |||
292 | if (!opts) | 296 | if (!opts) |
293 | return 1; | 297 | return 1; |
294 | 298 | ||
295 | /*printk("Parsing opts: '%s'\n",opts);*/ | 299 | /*pr_info("Parsing opts: '%s'\n",opts);*/ |
296 | 300 | ||
297 | while ((p = strsep(&opts, ",")) != NULL) { | 301 | while ((p = strsep(&opts, ",")) != NULL) { |
298 | substring_t args[MAX_OPT_ARGS]; | 302 | substring_t args[MAX_OPT_ARGS]; |
@@ -387,7 +391,7 @@ static int parse_opts(char *opts, kuid_t *uid, kgid_t *gid, umode_t *umask, | |||
387 | 391 | ||
388 | static inline void hpfs_help(void) | 392 | static inline void hpfs_help(void) |
389 | { | 393 | { |
390 | printk("\n\ | 394 | pr_info("\n\ |
391 | HPFS filesystem options:\n\ | 395 | HPFS filesystem options:\n\ |
392 | help do not mount and display this text\n\ | 396 | help do not mount and display this text\n\ |
393 | uid=xxx set uid of files that don't have uid specified in eas\n\ | 397 | uid=xxx set uid of files that don't have uid specified in eas\n\ |
@@ -434,7 +438,7 @@ static int hpfs_remount_fs(struct super_block *s, int *flags, char *data) | |||
434 | 438 | ||
435 | if (!(o = parse_opts(data, &uid, &gid, &umask, &lowercase, | 439 | if (!(o = parse_opts(data, &uid, &gid, &umask, &lowercase, |
436 | &eas, &chk, &errs, &chkdsk, ×hift))) { | 440 | &eas, &chk, &errs, &chkdsk, ×hift))) { |
437 | printk("HPFS: bad mount options.\n"); | 441 | pr_err("bad mount options.\n"); |
438 | goto out_err; | 442 | goto out_err; |
439 | } | 443 | } |
440 | if (o == 2) { | 444 | if (o == 2) { |
@@ -442,7 +446,7 @@ static int hpfs_remount_fs(struct super_block *s, int *flags, char *data) | |||
442 | goto out_err; | 446 | goto out_err; |
443 | } | 447 | } |
444 | if (timeshift != sbi->sb_timeshift) { | 448 | if (timeshift != sbi->sb_timeshift) { |
445 | printk("HPFS: timeshift can't be changed using remount.\n"); | 449 | pr_err("timeshift can't be changed using remount.\n"); |
446 | goto out_err; | 450 | goto out_err; |
447 | } | 451 | } |
448 | 452 | ||
@@ -523,7 +527,7 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent) | |||
523 | 527 | ||
524 | if (!(o = parse_opts(options, &uid, &gid, &umask, &lowercase, | 528 | if (!(o = parse_opts(options, &uid, &gid, &umask, &lowercase, |
525 | &eas, &chk, &errs, &chkdsk, ×hift))) { | 529 | &eas, &chk, &errs, &chkdsk, ×hift))) { |
526 | printk("HPFS: bad mount options.\n"); | 530 | pr_err("bad mount options.\n"); |
527 | goto bail0; | 531 | goto bail0; |
528 | } | 532 | } |
529 | if (o==2) { | 533 | if (o==2) { |
@@ -542,16 +546,17 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent) | |||
542 | if (/*le16_to_cpu(bootblock->magic) != BB_MAGIC | 546 | if (/*le16_to_cpu(bootblock->magic) != BB_MAGIC |
543 | ||*/ le32_to_cpu(superblock->magic) != SB_MAGIC | 547 | ||*/ le32_to_cpu(superblock->magic) != SB_MAGIC |
544 | || le32_to_cpu(spareblock->magic) != SP_MAGIC) { | 548 | || le32_to_cpu(spareblock->magic) != SP_MAGIC) { |
545 | if (!silent) printk("HPFS: Bad magic ... probably not HPFS\n"); | 549 | if (!silent) |
550 | pr_err("Bad magic ... probably not HPFS\n"); | ||
546 | goto bail4; | 551 | goto bail4; |
547 | } | 552 | } |
548 | 553 | ||
549 | /* Check version */ | 554 | /* Check version */ |
550 | if (!(s->s_flags & MS_RDONLY) && | 555 | if (!(s->s_flags & MS_RDONLY) && |
551 | superblock->funcversion != 2 && superblock->funcversion != 3) { | 556 | superblock->funcversion != 2 && superblock->funcversion != 3) { |
552 | printk("HPFS: Bad version %d,%d. Mount readonly to go around\n", | 557 | pr_err("Bad version %d,%d. Mount readonly to go around\n", |
553 | (int)superblock->version, (int)superblock->funcversion); | 558 | (int)superblock->version, (int)superblock->funcversion); |
554 | printk("HPFS: please try recent version of HPFS driver at http://artax.karlin.mff.cuni.cz/~mikulas/vyplody/hpfs/index-e.cgi and if it still can't understand this format, contact author - mikulas@artax.karlin.mff.cuni.cz\n"); | 559 | pr_err("please try recent version of HPFS driver at http://artax.karlin.mff.cuni.cz/~mikulas/vyplody/hpfs/index-e.cgi and if it still can't understand this format, contact author - mikulas@artax.karlin.mff.cuni.cz\n"); |
555 | goto bail4; | 560 | goto bail4; |
556 | } | 561 | } |
557 | 562 | ||
@@ -597,7 +602,7 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent) | |||
597 | /* Check for general fs errors*/ | 602 | /* Check for general fs errors*/ |
598 | if (spareblock->dirty && !spareblock->old_wrote) { | 603 | if (spareblock->dirty && !spareblock->old_wrote) { |
599 | if (errs == 2) { | 604 | if (errs == 2) { |
600 | printk("HPFS: Improperly stopped, not mounted\n"); | 605 | pr_err("Improperly stopped, not mounted\n"); |
601 | goto bail4; | 606 | goto bail4; |
602 | } | 607 | } |
603 | hpfs_error(s, "improperly stopped"); | 608 | hpfs_error(s, "improperly stopped"); |
@@ -611,22 +616,25 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent) | |||
611 | 616 | ||
612 | if (spareblock->hotfixes_used || spareblock->n_spares_used) { | 617 | if (spareblock->hotfixes_used || spareblock->n_spares_used) { |
613 | if (errs >= 2) { | 618 | if (errs >= 2) { |
614 | printk("HPFS: Hotfixes not supported here, try chkdsk\n"); | 619 | pr_err("Hotfixes not supported here, try chkdsk\n"); |
615 | mark_dirty(s, 0); | 620 | mark_dirty(s, 0); |
616 | goto bail4; | 621 | goto bail4; |
617 | } | 622 | } |
618 | hpfs_error(s, "hotfixes not supported here, try chkdsk"); | 623 | hpfs_error(s, "hotfixes not supported here, try chkdsk"); |
619 | if (errs == 0) printk("HPFS: Proceeding, but your filesystem will be probably corrupted by this driver...\n"); | 624 | if (errs == 0) |
620 | else printk("HPFS: This driver may read bad files or crash when operating on disk with hotfixes.\n"); | 625 | pr_err("Proceeding, but your filesystem will be probably corrupted by this driver...\n"); |
626 | else | ||
627 | pr_err("This driver may read bad files or crash when operating on disk with hotfixes.\n"); | ||
621 | } | 628 | } |
622 | if (le32_to_cpu(spareblock->n_dnode_spares) != le32_to_cpu(spareblock->n_dnode_spares_free)) { | 629 | if (le32_to_cpu(spareblock->n_dnode_spares) != le32_to_cpu(spareblock->n_dnode_spares_free)) { |
623 | if (errs >= 2) { | 630 | if (errs >= 2) { |
624 | printk("HPFS: Spare dnodes used, try chkdsk\n"); | 631 | pr_err("Spare dnodes used, try chkdsk\n"); |
625 | mark_dirty(s, 0); | 632 | mark_dirty(s, 0); |
626 | goto bail4; | 633 | goto bail4; |
627 | } | 634 | } |
628 | hpfs_error(s, "warning: spare dnodes used, try chkdsk"); | 635 | hpfs_error(s, "warning: spare dnodes used, try chkdsk"); |
629 | if (errs == 0) printk("HPFS: Proceeding, but your filesystem could be corrupted if you delete files or directories\n"); | 636 | if (errs == 0) |
637 | pr_err("Proceeding, but your filesystem could be corrupted if you delete files or directories\n"); | ||
630 | } | 638 | } |
631 | if (chk) { | 639 | if (chk) { |
632 | unsigned a; | 640 | unsigned a; |
@@ -645,12 +653,13 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent) | |||
645 | goto bail4; | 653 | goto bail4; |
646 | } | 654 | } |
647 | sbi->sb_dirband_size = a; | 655 | sbi->sb_dirband_size = a; |
648 | } else printk("HPFS: You really don't want any checks? You are crazy...\n"); | 656 | } else |
657 | pr_err("You really don't want any checks? You are crazy...\n"); | ||
649 | 658 | ||
650 | /* Load code page table */ | 659 | /* Load code page table */ |
651 | if (le32_to_cpu(spareblock->n_code_pages)) | 660 | if (le32_to_cpu(spareblock->n_code_pages)) |
652 | if (!(sbi->sb_cp_table = hpfs_load_code_page(s, le32_to_cpu(spareblock->code_page_dir)))) | 661 | if (!(sbi->sb_cp_table = hpfs_load_code_page(s, le32_to_cpu(spareblock->code_page_dir)))) |
653 | printk("HPFS: Warning: code page support is disabled\n"); | 662 | pr_err("code page support is disabled\n"); |
654 | 663 | ||
655 | brelse(bh2); | 664 | brelse(bh2); |
656 | brelse(bh1); | 665 | brelse(bh1); |
diff --git a/fs/inode.c b/fs/inode.c index f96d2a6f88cc..2feb9b69f1be 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -105,7 +105,7 @@ long get_nr_dirty_inodes(void) | |||
105 | * Handle nr_inode sysctl | 105 | * Handle nr_inode sysctl |
106 | */ | 106 | */ |
107 | #ifdef CONFIG_SYSCTL | 107 | #ifdef CONFIG_SYSCTL |
108 | int proc_nr_inodes(ctl_table *table, int write, | 108 | int proc_nr_inodes(struct ctl_table *table, int write, |
109 | void __user *buffer, size_t *lenp, loff_t *ppos) | 109 | void __user *buffer, size_t *lenp, loff_t *ppos) |
110 | { | 110 | { |
111 | inodes_stat.nr_inodes = get_nr_inodes(); | 111 | inodes_stat.nr_inodes = get_nr_inodes(); |
diff --git a/fs/jffs2/background.c b/fs/jffs2/background.c index 2b60ce1996aa..bb9cebc9ca8a 100644 --- a/fs/jffs2/background.c +++ b/fs/jffs2/background.c | |||
@@ -75,10 +75,13 @@ void jffs2_stop_garbage_collect_thread(struct jffs2_sb_info *c) | |||
75 | static int jffs2_garbage_collect_thread(void *_c) | 75 | static int jffs2_garbage_collect_thread(void *_c) |
76 | { | 76 | { |
77 | struct jffs2_sb_info *c = _c; | 77 | struct jffs2_sb_info *c = _c; |
78 | sigset_t hupmask; | ||
78 | 79 | ||
80 | siginitset(&hupmask, sigmask(SIGHUP)); | ||
79 | allow_signal(SIGKILL); | 81 | allow_signal(SIGKILL); |
80 | allow_signal(SIGSTOP); | 82 | allow_signal(SIGSTOP); |
81 | allow_signal(SIGCONT); | 83 | allow_signal(SIGCONT); |
84 | allow_signal(SIGHUP); | ||
82 | 85 | ||
83 | c->gc_task = current; | 86 | c->gc_task = current; |
84 | complete(&c->gc_thread_start); | 87 | complete(&c->gc_thread_start); |
@@ -87,7 +90,7 @@ static int jffs2_garbage_collect_thread(void *_c) | |||
87 | 90 | ||
88 | set_freezable(); | 91 | set_freezable(); |
89 | for (;;) { | 92 | for (;;) { |
90 | allow_signal(SIGHUP); | 93 | sigprocmask(SIG_UNBLOCK, &hupmask, NULL); |
91 | again: | 94 | again: |
92 | spin_lock(&c->erase_completion_lock); | 95 | spin_lock(&c->erase_completion_lock); |
93 | if (!jffs2_thread_should_wake(c)) { | 96 | if (!jffs2_thread_should_wake(c)) { |
@@ -95,10 +98,9 @@ static int jffs2_garbage_collect_thread(void *_c) | |||
95 | spin_unlock(&c->erase_completion_lock); | 98 | spin_unlock(&c->erase_completion_lock); |
96 | jffs2_dbg(1, "%s(): sleeping...\n", __func__); | 99 | jffs2_dbg(1, "%s(): sleeping...\n", __func__); |
97 | schedule(); | 100 | schedule(); |
98 | } else | 101 | } else { |
99 | spin_unlock(&c->erase_completion_lock); | 102 | spin_unlock(&c->erase_completion_lock); |
100 | 103 | } | |
101 | |||
102 | /* Problem - immediately after bootup, the GCD spends a lot | 104 | /* Problem - immediately after bootup, the GCD spends a lot |
103 | * of time in places like jffs2_kill_fragtree(); so much so | 105 | * of time in places like jffs2_kill_fragtree(); so much so |
104 | * that userspace processes (like gdm and X) are starved | 106 | * that userspace processes (like gdm and X) are starved |
@@ -150,7 +152,7 @@ static int jffs2_garbage_collect_thread(void *_c) | |||
150 | } | 152 | } |
151 | } | 153 | } |
152 | /* We don't want SIGHUP to interrupt us. STOP and KILL are OK though. */ | 154 | /* We don't want SIGHUP to interrupt us. STOP and KILL are OK though. */ |
153 | disallow_signal(SIGHUP); | 155 | sigprocmask(SIG_BLOCK, &hupmask, NULL); |
154 | 156 | ||
155 | jffs2_dbg(1, "%s(): pass\n", __func__); | 157 | jffs2_dbg(1, "%s(): pass\n", __func__); |
156 | if (jffs2_garbage_collect_pass(c) == -ENOSPC) { | 158 | if (jffs2_garbage_collect_pass(c) == -ENOSPC) { |
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c index 6bf06a07f3e0..de051cb1f553 100644 --- a/fs/lockd/svc.c +++ b/fs/lockd/svc.c | |||
@@ -436,7 +436,7 @@ EXPORT_SYMBOL_GPL(lockd_down); | |||
436 | * Sysctl parameters (same as module parameters, different interface). | 436 | * Sysctl parameters (same as module parameters, different interface). |
437 | */ | 437 | */ |
438 | 438 | ||
439 | static ctl_table nlm_sysctls[] = { | 439 | static struct ctl_table nlm_sysctls[] = { |
440 | { | 440 | { |
441 | .procname = "nlm_grace_period", | 441 | .procname = "nlm_grace_period", |
442 | .data = &nlm_grace_period, | 442 | .data = &nlm_grace_period, |
@@ -490,7 +490,7 @@ static ctl_table nlm_sysctls[] = { | |||
490 | { } | 490 | { } |
491 | }; | 491 | }; |
492 | 492 | ||
493 | static ctl_table nlm_sysctl_dir[] = { | 493 | static struct ctl_table nlm_sysctl_dir[] = { |
494 | { | 494 | { |
495 | .procname = "nfs", | 495 | .procname = "nfs", |
496 | .mode = 0555, | 496 | .mode = 0555, |
@@ -499,7 +499,7 @@ static ctl_table nlm_sysctl_dir[] = { | |||
499 | { } | 499 | { } |
500 | }; | 500 | }; |
501 | 501 | ||
502 | static ctl_table nlm_sysctl_root[] = { | 502 | static struct ctl_table nlm_sysctl_root[] = { |
503 | { | 503 | { |
504 | .procname = "fs", | 504 | .procname = "fs", |
505 | .mode = 0555, | 505 | .mode = 0555, |
diff --git a/fs/nfs/nfs4sysctl.c b/fs/nfs/nfs4sysctl.c index 2628d921b7e3..b6ebe7e445f6 100644 --- a/fs/nfs/nfs4sysctl.c +++ b/fs/nfs/nfs4sysctl.c | |||
@@ -16,7 +16,7 @@ static const int nfs_set_port_min = 0; | |||
16 | static const int nfs_set_port_max = 65535; | 16 | static const int nfs_set_port_max = 65535; |
17 | static struct ctl_table_header *nfs4_callback_sysctl_table; | 17 | static struct ctl_table_header *nfs4_callback_sysctl_table; |
18 | 18 | ||
19 | static ctl_table nfs4_cb_sysctls[] = { | 19 | static struct ctl_table nfs4_cb_sysctls[] = { |
20 | { | 20 | { |
21 | .procname = "nfs_callback_tcpport", | 21 | .procname = "nfs_callback_tcpport", |
22 | .data = &nfs_callback_set_tcpport, | 22 | .data = &nfs_callback_set_tcpport, |
@@ -36,7 +36,7 @@ static ctl_table nfs4_cb_sysctls[] = { | |||
36 | { } | 36 | { } |
37 | }; | 37 | }; |
38 | 38 | ||
39 | static ctl_table nfs4_cb_sysctl_dir[] = { | 39 | static struct ctl_table nfs4_cb_sysctl_dir[] = { |
40 | { | 40 | { |
41 | .procname = "nfs", | 41 | .procname = "nfs", |
42 | .mode = 0555, | 42 | .mode = 0555, |
@@ -45,7 +45,7 @@ static ctl_table nfs4_cb_sysctl_dir[] = { | |||
45 | { } | 45 | { } |
46 | }; | 46 | }; |
47 | 47 | ||
48 | static ctl_table nfs4_cb_sysctl_root[] = { | 48 | static struct ctl_table nfs4_cb_sysctl_root[] = { |
49 | { | 49 | { |
50 | .procname = "fs", | 50 | .procname = "fs", |
51 | .mode = 0555, | 51 | .mode = 0555, |
diff --git a/fs/nfs/sysctl.c b/fs/nfs/sysctl.c index 6b3f2535a3ec..bb6ed810fa6f 100644 --- a/fs/nfs/sysctl.c +++ b/fs/nfs/sysctl.c | |||
@@ -13,7 +13,7 @@ | |||
13 | 13 | ||
14 | static struct ctl_table_header *nfs_callback_sysctl_table; | 14 | static struct ctl_table_header *nfs_callback_sysctl_table; |
15 | 15 | ||
16 | static ctl_table nfs_cb_sysctls[] = { | 16 | static struct ctl_table nfs_cb_sysctls[] = { |
17 | { | 17 | { |
18 | .procname = "nfs_mountpoint_timeout", | 18 | .procname = "nfs_mountpoint_timeout", |
19 | .data = &nfs_mountpoint_expiry_timeout, | 19 | .data = &nfs_mountpoint_expiry_timeout, |
@@ -31,7 +31,7 @@ static ctl_table nfs_cb_sysctls[] = { | |||
31 | { } | 31 | { } |
32 | }; | 32 | }; |
33 | 33 | ||
34 | static ctl_table nfs_cb_sysctl_dir[] = { | 34 | static struct ctl_table nfs_cb_sysctl_dir[] = { |
35 | { | 35 | { |
36 | .procname = "nfs", | 36 | .procname = "nfs", |
37 | .mode = 0555, | 37 | .mode = 0555, |
@@ -40,7 +40,7 @@ static ctl_table nfs_cb_sysctl_dir[] = { | |||
40 | { } | 40 | { } |
41 | }; | 41 | }; |
42 | 42 | ||
43 | static ctl_table nfs_cb_sysctl_root[] = { | 43 | static struct ctl_table nfs_cb_sysctl_root[] = { |
44 | { | 44 | { |
45 | .procname = "fs", | 45 | .procname = "fs", |
46 | .mode = 0555, | 46 | .mode = 0555, |
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c index 78a2ca3966c3..cc423a30a0c8 100644 --- a/fs/notify/inotify/inotify_user.c +++ b/fs/notify/inotify/inotify_user.c | |||
@@ -57,7 +57,7 @@ static struct kmem_cache *inotify_inode_mark_cachep __read_mostly; | |||
57 | 57 | ||
58 | static int zero; | 58 | static int zero; |
59 | 59 | ||
60 | ctl_table inotify_table[] = { | 60 | struct ctl_table inotify_table[] = { |
61 | { | 61 | { |
62 | .procname = "max_user_instances", | 62 | .procname = "max_user_instances", |
63 | .data = &inotify_max_user_instances, | 63 | .data = &inotify_max_user_instances, |
diff --git a/fs/ntfs/sysctl.c b/fs/ntfs/sysctl.c index 1927170a35ce..a503156ec15f 100644 --- a/fs/ntfs/sysctl.c +++ b/fs/ntfs/sysctl.c | |||
@@ -34,7 +34,7 @@ | |||
34 | #include "debug.h" | 34 | #include "debug.h" |
35 | 35 | ||
36 | /* Definition of the ntfs sysctl. */ | 36 | /* Definition of the ntfs sysctl. */ |
37 | static ctl_table ntfs_sysctls[] = { | 37 | static struct ctl_table ntfs_sysctls[] = { |
38 | { | 38 | { |
39 | .procname = "ntfs-debug", | 39 | .procname = "ntfs-debug", |
40 | .data = &debug_msgs, /* Data pointer and size. */ | 40 | .data = &debug_msgs, /* Data pointer and size. */ |
@@ -46,7 +46,7 @@ static ctl_table ntfs_sysctls[] = { | |||
46 | }; | 46 | }; |
47 | 47 | ||
48 | /* Define the parent directory /proc/sys/fs. */ | 48 | /* Define the parent directory /proc/sys/fs. */ |
49 | static ctl_table sysctls_root[] = { | 49 | static struct ctl_table sysctls_root[] = { |
50 | { | 50 | { |
51 | .procname = "fs", | 51 | .procname = "fs", |
52 | .mode = 0555, | 52 | .mode = 0555, |
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 48cbe4c0b2a5..5d9da22e29b0 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
@@ -1418,10 +1418,10 @@ static int show_numa_map(struct seq_file *m, void *v, int is_pid) | |||
1418 | seq_printf(m, "%08lx %s", vma->vm_start, buffer); | 1418 | seq_printf(m, "%08lx %s", vma->vm_start, buffer); |
1419 | 1419 | ||
1420 | if (file) { | 1420 | if (file) { |
1421 | seq_printf(m, " file="); | 1421 | seq_puts(m, " file="); |
1422 | seq_path(m, &file->f_path, "\n\t= "); | 1422 | seq_path(m, &file->f_path, "\n\t= "); |
1423 | } else if (vma->vm_start <= mm->brk && vma->vm_end >= mm->start_brk) { | 1423 | } else if (vma->vm_start <= mm->brk && vma->vm_end >= mm->start_brk) { |
1424 | seq_printf(m, " heap"); | 1424 | seq_puts(m, " heap"); |
1425 | } else { | 1425 | } else { |
1426 | pid_t tid = vm_is_stack(task, vma, is_pid); | 1426 | pid_t tid = vm_is_stack(task, vma, is_pid); |
1427 | if (tid != 0) { | 1427 | if (tid != 0) { |
@@ -1431,14 +1431,14 @@ static int show_numa_map(struct seq_file *m, void *v, int is_pid) | |||
1431 | */ | 1431 | */ |
1432 | if (!is_pid || (vma->vm_start <= mm->start_stack && | 1432 | if (!is_pid || (vma->vm_start <= mm->start_stack && |
1433 | vma->vm_end >= mm->start_stack)) | 1433 | vma->vm_end >= mm->start_stack)) |
1434 | seq_printf(m, " stack"); | 1434 | seq_puts(m, " stack"); |
1435 | else | 1435 | else |
1436 | seq_printf(m, " stack:%d", tid); | 1436 | seq_printf(m, " stack:%d", tid); |
1437 | } | 1437 | } |
1438 | } | 1438 | } |
1439 | 1439 | ||
1440 | if (is_vm_hugetlb_page(vma)) | 1440 | if (is_vm_hugetlb_page(vma)) |
1441 | seq_printf(m, " huge"); | 1441 | seq_puts(m, " huge"); |
1442 | 1442 | ||
1443 | walk_page_range(vma->vm_start, vma->vm_end, &walk); | 1443 | walk_page_range(vma->vm_start, vma->vm_end, &walk); |
1444 | 1444 | ||
diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c index 6a8e785b29da..382aa890e228 100644 --- a/fs/proc/vmcore.c +++ b/fs/proc/vmcore.c | |||
@@ -42,7 +42,7 @@ static size_t elfnotes_sz; | |||
42 | /* Total size of vmcore file. */ | 42 | /* Total size of vmcore file. */ |
43 | static u64 vmcore_size; | 43 | static u64 vmcore_size; |
44 | 44 | ||
45 | static struct proc_dir_entry *proc_vmcore = NULL; | 45 | static struct proc_dir_entry *proc_vmcore; |
46 | 46 | ||
47 | /* | 47 | /* |
48 | * Returns > 0 for RAM pages, 0 for non-RAM pages, < 0 on error | 48 | * Returns > 0 for RAM pages, 0 for non-RAM pages, < 0 on error |
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c index 46d269e38706..0a9b72cdfeca 100644 --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c | |||
@@ -18,6 +18,8 @@ | |||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #define pr_fmt(fmt) "pstore: " fmt | ||
22 | |||
21 | #include <linux/atomic.h> | 23 | #include <linux/atomic.h> |
22 | #include <linux/types.h> | 24 | #include <linux/types.h> |
23 | #include <linux/errno.h> | 25 | #include <linux/errno.h> |
@@ -224,14 +226,12 @@ static void allocate_buf_for_compression(void) | |||
224 | zlib_inflate_workspacesize()); | 226 | zlib_inflate_workspacesize()); |
225 | stream.workspace = kmalloc(size, GFP_KERNEL); | 227 | stream.workspace = kmalloc(size, GFP_KERNEL); |
226 | if (!stream.workspace) { | 228 | if (!stream.workspace) { |
227 | pr_err("pstore: No memory for compression workspace; " | 229 | pr_err("No memory for compression workspace; skipping compression\n"); |
228 | "skipping compression\n"); | ||
229 | kfree(big_oops_buf); | 230 | kfree(big_oops_buf); |
230 | big_oops_buf = NULL; | 231 | big_oops_buf = NULL; |
231 | } | 232 | } |
232 | } else { | 233 | } else { |
233 | pr_err("No memory for uncompressed data; " | 234 | pr_err("No memory for uncompressed data; skipping compression\n"); |
234 | "skipping compression\n"); | ||
235 | stream.workspace = NULL; | 235 | stream.workspace = NULL; |
236 | } | 236 | } |
237 | 237 | ||
@@ -455,8 +455,7 @@ int pstore_register(struct pstore_info *psi) | |||
455 | add_timer(&pstore_timer); | 455 | add_timer(&pstore_timer); |
456 | } | 456 | } |
457 | 457 | ||
458 | pr_info("pstore: Registered %s as persistent store backend\n", | 458 | pr_info("Registered %s as persistent store backend\n", psi->name); |
459 | psi->name); | ||
460 | 459 | ||
461 | return 0; | 460 | return 0; |
462 | } | 461 | } |
@@ -502,8 +501,8 @@ void pstore_get_records(int quiet) | |||
502 | size = unzipped_len; | 501 | size = unzipped_len; |
503 | compressed = false; | 502 | compressed = false; |
504 | } else { | 503 | } else { |
505 | pr_err("pstore: decompression failed;" | 504 | pr_err("decompression failed;returned %d\n", |
506 | "returned %d\n", unzipped_len); | 505 | unzipped_len); |
507 | compressed = true; | 506 | compressed = true; |
508 | } | 507 | } |
509 | } | 508 | } |
@@ -524,8 +523,8 @@ out: | |||
524 | mutex_unlock(&psi->read_mutex); | 523 | mutex_unlock(&psi->read_mutex); |
525 | 524 | ||
526 | if (failed) | 525 | if (failed) |
527 | printk(KERN_WARNING "pstore: failed to load %d record(s) from '%s'\n", | 526 | pr_warn("failed to load %d record(s) from '%s'\n", |
528 | failed, psi->name); | 527 | failed, psi->name); |
529 | } | 528 | } |
530 | 529 | ||
531 | static void pstore_dowork(struct work_struct *work) | 530 | static void pstore_dowork(struct work_struct *work) |
diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c index ff7e3d4df5a1..34a1e5aa848c 100644 --- a/fs/pstore/ram_core.c +++ b/fs/pstore/ram_core.c | |||
@@ -12,6 +12,8 @@ | |||
12 | * | 12 | * |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #define pr_fmt(fmt) "persistent_ram: " fmt | ||
16 | |||
15 | #include <linux/device.h> | 17 | #include <linux/device.h> |
16 | #include <linux/err.h> | 18 | #include <linux/err.h> |
17 | #include <linux/errno.h> | 19 | #include <linux/errno.h> |
@@ -205,12 +207,10 @@ static void persistent_ram_ecc_old(struct persistent_ram_zone *prz) | |||
205 | size = buffer->data + prz->buffer_size - block; | 207 | size = buffer->data + prz->buffer_size - block; |
206 | numerr = persistent_ram_decode_rs8(prz, block, size, par); | 208 | numerr = persistent_ram_decode_rs8(prz, block, size, par); |
207 | if (numerr > 0) { | 209 | if (numerr > 0) { |
208 | pr_devel("persistent_ram: error in block %p, %d\n", | 210 | pr_devel("error in block %p, %d\n", block, numerr); |
209 | block, numerr); | ||
210 | prz->corrected_bytes += numerr; | 211 | prz->corrected_bytes += numerr; |
211 | } else if (numerr < 0) { | 212 | } else if (numerr < 0) { |
212 | pr_devel("persistent_ram: uncorrectable error in block %p\n", | 213 | pr_devel("uncorrectable error in block %p\n", block); |
213 | block); | ||
214 | prz->bad_blocks++; | 214 | prz->bad_blocks++; |
215 | } | 215 | } |
216 | block += prz->ecc_info.block_size; | 216 | block += prz->ecc_info.block_size; |
@@ -257,7 +257,7 @@ static int persistent_ram_init_ecc(struct persistent_ram_zone *prz, | |||
257 | prz->rs_decoder = init_rs(prz->ecc_info.symsize, prz->ecc_info.poly, | 257 | prz->rs_decoder = init_rs(prz->ecc_info.symsize, prz->ecc_info.poly, |
258 | 0, 1, prz->ecc_info.ecc_size); | 258 | 0, 1, prz->ecc_info.ecc_size); |
259 | if (prz->rs_decoder == NULL) { | 259 | if (prz->rs_decoder == NULL) { |
260 | pr_info("persistent_ram: init_rs failed\n"); | 260 | pr_info("init_rs failed\n"); |
261 | return -EINVAL; | 261 | return -EINVAL; |
262 | } | 262 | } |
263 | 263 | ||
@@ -267,10 +267,10 @@ static int persistent_ram_init_ecc(struct persistent_ram_zone *prz, | |||
267 | numerr = persistent_ram_decode_rs8(prz, buffer, sizeof(*buffer), | 267 | numerr = persistent_ram_decode_rs8(prz, buffer, sizeof(*buffer), |
268 | prz->par_header); | 268 | prz->par_header); |
269 | if (numerr > 0) { | 269 | if (numerr > 0) { |
270 | pr_info("persistent_ram: error in header, %d\n", numerr); | 270 | pr_info("error in header, %d\n", numerr); |
271 | prz->corrected_bytes += numerr; | 271 | prz->corrected_bytes += numerr; |
272 | } else if (numerr < 0) { | 272 | } else if (numerr < 0) { |
273 | pr_info("persistent_ram: uncorrectable error in header\n"); | 273 | pr_info("uncorrectable error in header\n"); |
274 | prz->bad_blocks++; | 274 | prz->bad_blocks++; |
275 | } | 275 | } |
276 | 276 | ||
@@ -317,7 +317,7 @@ void persistent_ram_save_old(struct persistent_ram_zone *prz) | |||
317 | prz->old_log = kmalloc(size, GFP_KERNEL); | 317 | prz->old_log = kmalloc(size, GFP_KERNEL); |
318 | } | 318 | } |
319 | if (!prz->old_log) { | 319 | if (!prz->old_log) { |
320 | pr_err("persistent_ram: failed to allocate buffer\n"); | 320 | pr_err("failed to allocate buffer\n"); |
321 | return; | 321 | return; |
322 | } | 322 | } |
323 | 323 | ||
@@ -396,8 +396,8 @@ static void *persistent_ram_vmap(phys_addr_t start, size_t size) | |||
396 | 396 | ||
397 | pages = kmalloc(sizeof(struct page *) * page_count, GFP_KERNEL); | 397 | pages = kmalloc(sizeof(struct page *) * page_count, GFP_KERNEL); |
398 | if (!pages) { | 398 | if (!pages) { |
399 | pr_err("%s: Failed to allocate array for %u pages\n", __func__, | 399 | pr_err("%s: Failed to allocate array for %u pages\n", |
400 | page_count); | 400 | __func__, page_count); |
401 | return NULL; | 401 | return NULL; |
402 | } | 402 | } |
403 | 403 | ||
@@ -462,19 +462,17 @@ static int persistent_ram_post_init(struct persistent_ram_zone *prz, u32 sig, | |||
462 | if (prz->buffer->sig == sig) { | 462 | if (prz->buffer->sig == sig) { |
463 | if (buffer_size(prz) > prz->buffer_size || | 463 | if (buffer_size(prz) > prz->buffer_size || |
464 | buffer_start(prz) > buffer_size(prz)) | 464 | buffer_start(prz) > buffer_size(prz)) |
465 | pr_info("persistent_ram: found existing invalid buffer," | 465 | pr_info("found existing invalid buffer, size %zu, start %zu\n", |
466 | " size %zu, start %zu\n", | 466 | buffer_size(prz), buffer_start(prz)); |
467 | buffer_size(prz), buffer_start(prz)); | ||
468 | else { | 467 | else { |
469 | pr_debug("persistent_ram: found existing buffer," | 468 | pr_debug("found existing buffer, size %zu, start %zu\n", |
470 | " size %zu, start %zu\n", | 469 | buffer_size(prz), buffer_start(prz)); |
471 | buffer_size(prz), buffer_start(prz)); | ||
472 | persistent_ram_save_old(prz); | 470 | persistent_ram_save_old(prz); |
473 | return 0; | 471 | return 0; |
474 | } | 472 | } |
475 | } else { | 473 | } else { |
476 | pr_debug("persistent_ram: no valid data in buffer" | 474 | pr_debug("no valid data in buffer (sig = 0x%08x)\n", |
477 | " (sig = 0x%08x)\n", prz->buffer->sig); | 475 | prz->buffer->sig); |
478 | } | 476 | } |
479 | 477 | ||
480 | prz->buffer->sig = sig; | 478 | prz->buffer->sig = sig; |
@@ -509,7 +507,7 @@ struct persistent_ram_zone *persistent_ram_new(phys_addr_t start, size_t size, | |||
509 | 507 | ||
510 | prz = kzalloc(sizeof(struct persistent_ram_zone), GFP_KERNEL); | 508 | prz = kzalloc(sizeof(struct persistent_ram_zone), GFP_KERNEL); |
511 | if (!prz) { | 509 | if (!prz) { |
512 | pr_err("persistent_ram: failed to allocate persistent ram zone\n"); | 510 | pr_err("failed to allocate persistent ram zone\n"); |
513 | goto err; | 511 | goto err; |
514 | } | 512 | } |
515 | 513 | ||
diff --git a/fs/reiserfs/bitmap.c b/fs/reiserfs/bitmap.c index dc9a6829f7c6..1bcffeab713c 100644 --- a/fs/reiserfs/bitmap.c +++ b/fs/reiserfs/bitmap.c | |||
@@ -142,7 +142,6 @@ static int scan_bitmap_block(struct reiserfs_transaction_handle *th, | |||
142 | int org = *beg; | 142 | int org = *beg; |
143 | 143 | ||
144 | BUG_ON(!th->t_trans_id); | 144 | BUG_ON(!th->t_trans_id); |
145 | |||
146 | RFALSE(bmap_n >= reiserfs_bmap_count(s), "Bitmap %u is out of " | 145 | RFALSE(bmap_n >= reiserfs_bmap_count(s), "Bitmap %u is out of " |
147 | "range (0..%u)", bmap_n, reiserfs_bmap_count(s) - 1); | 146 | "range (0..%u)", bmap_n, reiserfs_bmap_count(s) - 1); |
148 | PROC_INFO_INC(s, scan_bitmap.bmap); | 147 | PROC_INFO_INC(s, scan_bitmap.bmap); |
@@ -321,7 +320,6 @@ static int scan_bitmap(struct reiserfs_transaction_handle *th, | |||
321 | unsigned int off_max = s->s_blocksize << 3; | 320 | unsigned int off_max = s->s_blocksize << 3; |
322 | 321 | ||
323 | BUG_ON(!th->t_trans_id); | 322 | BUG_ON(!th->t_trans_id); |
324 | |||
325 | PROC_INFO_INC(s, scan_bitmap.call); | 323 | PROC_INFO_INC(s, scan_bitmap.call); |
326 | if (SB_FREE_BLOCKS(s) <= 0) | 324 | if (SB_FREE_BLOCKS(s) <= 0) |
327 | return 0; // No point in looking for more free blocks | 325 | return 0; // No point in looking for more free blocks |
@@ -388,9 +386,7 @@ static void _reiserfs_free_block(struct reiserfs_transaction_handle *th, | |||
388 | unsigned int nr, offset; | 386 | unsigned int nr, offset; |
389 | 387 | ||
390 | BUG_ON(!th->t_trans_id); | 388 | BUG_ON(!th->t_trans_id); |
391 | |||
392 | PROC_INFO_INC(s, free_block); | 389 | PROC_INFO_INC(s, free_block); |
393 | |||
394 | rs = SB_DISK_SUPER_BLOCK(s); | 390 | rs = SB_DISK_SUPER_BLOCK(s); |
395 | sbh = SB_BUFFER_WITH_SB(s); | 391 | sbh = SB_BUFFER_WITH_SB(s); |
396 | apbi = SB_AP_BITMAP(s); | 392 | apbi = SB_AP_BITMAP(s); |
@@ -435,8 +431,8 @@ void reiserfs_free_block(struct reiserfs_transaction_handle *th, | |||
435 | int for_unformatted) | 431 | int for_unformatted) |
436 | { | 432 | { |
437 | struct super_block *s = th->t_super; | 433 | struct super_block *s = th->t_super; |
438 | BUG_ON(!th->t_trans_id); | ||
439 | 434 | ||
435 | BUG_ON(!th->t_trans_id); | ||
440 | RFALSE(!s, "vs-4061: trying to free block on nonexistent device"); | 436 | RFALSE(!s, "vs-4061: trying to free block on nonexistent device"); |
441 | if (!is_reusable(s, block, 1)) | 437 | if (!is_reusable(s, block, 1)) |
442 | return; | 438 | return; |
@@ -471,6 +467,7 @@ static void __discard_prealloc(struct reiserfs_transaction_handle *th, | |||
471 | unsigned long save = ei->i_prealloc_block; | 467 | unsigned long save = ei->i_prealloc_block; |
472 | int dirty = 0; | 468 | int dirty = 0; |
473 | struct inode *inode = &ei->vfs_inode; | 469 | struct inode *inode = &ei->vfs_inode; |
470 | |||
474 | BUG_ON(!th->t_trans_id); | 471 | BUG_ON(!th->t_trans_id); |
475 | #ifdef CONFIG_REISERFS_CHECK | 472 | #ifdef CONFIG_REISERFS_CHECK |
476 | if (ei->i_prealloc_count < 0) | 473 | if (ei->i_prealloc_count < 0) |
@@ -494,6 +491,7 @@ void reiserfs_discard_prealloc(struct reiserfs_transaction_handle *th, | |||
494 | struct inode *inode) | 491 | struct inode *inode) |
495 | { | 492 | { |
496 | struct reiserfs_inode_info *ei = REISERFS_I(inode); | 493 | struct reiserfs_inode_info *ei = REISERFS_I(inode); |
494 | |||
497 | BUG_ON(!th->t_trans_id); | 495 | BUG_ON(!th->t_trans_id); |
498 | if (ei->i_prealloc_count) | 496 | if (ei->i_prealloc_count) |
499 | __discard_prealloc(th, ei); | 497 | __discard_prealloc(th, ei); |
@@ -504,7 +502,6 @@ void reiserfs_discard_all_prealloc(struct reiserfs_transaction_handle *th) | |||
504 | struct list_head *plist = &SB_JOURNAL(th->t_super)->j_prealloc_list; | 502 | struct list_head *plist = &SB_JOURNAL(th->t_super)->j_prealloc_list; |
505 | 503 | ||
506 | BUG_ON(!th->t_trans_id); | 504 | BUG_ON(!th->t_trans_id); |
507 | |||
508 | while (!list_empty(plist)) { | 505 | while (!list_empty(plist)) { |
509 | struct reiserfs_inode_info *ei; | 506 | struct reiserfs_inode_info *ei; |
510 | ei = list_entry(plist->next, struct reiserfs_inode_info, | 507 | ei = list_entry(plist->next, struct reiserfs_inode_info, |
@@ -562,7 +559,7 @@ int reiserfs_parse_alloc_options(struct super_block *s, char *options) | |||
562 | if (!strcmp(this_char, "displacing_new_packing_localities")) { | 559 | if (!strcmp(this_char, "displacing_new_packing_localities")) { |
563 | SET_OPTION(displacing_new_packing_localities); | 560 | SET_OPTION(displacing_new_packing_localities); |
564 | continue; | 561 | continue; |
565 | }; | 562 | } |
566 | 563 | ||
567 | if (!strcmp(this_char, "old_hashed_relocation")) { | 564 | if (!strcmp(this_char, "old_hashed_relocation")) { |
568 | SET_OPTION(old_hashed_relocation); | 565 | SET_OPTION(old_hashed_relocation); |
@@ -729,6 +726,7 @@ void show_alloc_options(struct seq_file *seq, struct super_block *s) | |||
729 | static inline void new_hashed_relocation(reiserfs_blocknr_hint_t * hint) | 726 | static inline void new_hashed_relocation(reiserfs_blocknr_hint_t * hint) |
730 | { | 727 | { |
731 | char *hash_in; | 728 | char *hash_in; |
729 | |||
732 | if (hint->formatted_node) { | 730 | if (hint->formatted_node) { |
733 | hash_in = (char *)&hint->key.k_dir_id; | 731 | hash_in = (char *)&hint->key.k_dir_id; |
734 | } else { | 732 | } else { |
@@ -757,6 +755,7 @@ static void dirid_groups(reiserfs_blocknr_hint_t * hint) | |||
757 | __u32 dirid = 0; | 755 | __u32 dirid = 0; |
758 | int bm = 0; | 756 | int bm = 0; |
759 | struct super_block *sb = hint->th->t_super; | 757 | struct super_block *sb = hint->th->t_super; |
758 | |||
760 | if (hint->inode) | 759 | if (hint->inode) |
761 | dirid = le32_to_cpu(INODE_PKEY(hint->inode)->k_dir_id); | 760 | dirid = le32_to_cpu(INODE_PKEY(hint->inode)->k_dir_id); |
762 | else if (hint->formatted_node) | 761 | else if (hint->formatted_node) |
diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c index b14706a05d52..615cd9ab7940 100644 --- a/fs/reiserfs/stree.c +++ b/fs/reiserfs/stree.c | |||
@@ -228,10 +228,10 @@ const struct reiserfs_key MIN_KEY = { 0, 0, {{0, 0},} }; | |||
228 | 228 | ||
229 | /* Maximal possible key. It is never in the tree. */ | 229 | /* Maximal possible key. It is never in the tree. */ |
230 | static const struct reiserfs_key MAX_KEY = { | 230 | static const struct reiserfs_key MAX_KEY = { |
231 | __constant_cpu_to_le32(0xffffffff), | 231 | cpu_to_le32(0xffffffff), |
232 | __constant_cpu_to_le32(0xffffffff), | 232 | cpu_to_le32(0xffffffff), |
233 | {{__constant_cpu_to_le32(0xffffffff), | 233 | {{cpu_to_le32(0xffffffff), |
234 | __constant_cpu_to_le32(0xffffffff)},} | 234 | cpu_to_le32(0xffffffff)},} |
235 | }; | 235 | }; |
236 | 236 | ||
237 | /* Get delimiting key of the buffer by looking for it in the buffers in the path, starting from the bottom | 237 | /* Get delimiting key of the buffer by looking for it in the buffers in the path, starting from the bottom |
diff --git a/fs/ufs/balloc.c b/fs/ufs/balloc.c index 0ab1de4b39a5..7bc20809c99e 100644 --- a/fs/ufs/balloc.c +++ b/fs/ufs/balloc.c | |||
@@ -24,7 +24,7 @@ | |||
24 | 24 | ||
25 | #define INVBLOCK ((u64)-1L) | 25 | #define INVBLOCK ((u64)-1L) |
26 | 26 | ||
27 | static u64 ufs_add_fragments(struct inode *, u64, unsigned, unsigned, int *); | 27 | static u64 ufs_add_fragments(struct inode *, u64, unsigned, unsigned); |
28 | static u64 ufs_alloc_fragments(struct inode *, unsigned, u64, unsigned, int *); | 28 | static u64 ufs_alloc_fragments(struct inode *, unsigned, u64, unsigned, int *); |
29 | static u64 ufs_alloccg_block(struct inode *, struct ufs_cg_private_info *, u64, int *); | 29 | static u64 ufs_alloccg_block(struct inode *, struct ufs_cg_private_info *, u64, int *); |
30 | static u64 ufs_bitmap_search (struct super_block *, struct ufs_cg_private_info *, u64, unsigned); | 30 | static u64 ufs_bitmap_search (struct super_block *, struct ufs_cg_private_info *, u64, unsigned); |
@@ -52,7 +52,7 @@ void ufs_free_fragments(struct inode *inode, u64 fragment, unsigned count) | |||
52 | if (ufs_fragnum(fragment) + count > uspi->s_fpg) | 52 | if (ufs_fragnum(fragment) + count > uspi->s_fpg) |
53 | ufs_error (sb, "ufs_free_fragments", "internal error"); | 53 | ufs_error (sb, "ufs_free_fragments", "internal error"); |
54 | 54 | ||
55 | mutex_lock(&UFS_SB(sb)->s_lock); | 55 | lock_ufs(sb); |
56 | 56 | ||
57 | cgno = ufs_dtog(uspi, fragment); | 57 | cgno = ufs_dtog(uspi, fragment); |
58 | bit = ufs_dtogd(uspi, fragment); | 58 | bit = ufs_dtogd(uspi, fragment); |
@@ -116,12 +116,12 @@ void ufs_free_fragments(struct inode *inode, u64 fragment, unsigned count) | |||
116 | ubh_sync_block(UCPI_UBH(ucpi)); | 116 | ubh_sync_block(UCPI_UBH(ucpi)); |
117 | ufs_mark_sb_dirty(sb); | 117 | ufs_mark_sb_dirty(sb); |
118 | 118 | ||
119 | mutex_unlock(&UFS_SB(sb)->s_lock); | 119 | unlock_ufs(sb); |
120 | UFSD("EXIT\n"); | 120 | UFSD("EXIT\n"); |
121 | return; | 121 | return; |
122 | 122 | ||
123 | failed: | 123 | failed: |
124 | mutex_unlock(&UFS_SB(sb)->s_lock); | 124 | unlock_ufs(sb); |
125 | UFSD("EXIT (FAILED)\n"); | 125 | UFSD("EXIT (FAILED)\n"); |
126 | return; | 126 | return; |
127 | } | 127 | } |
@@ -151,7 +151,7 @@ void ufs_free_blocks(struct inode *inode, u64 fragment, unsigned count) | |||
151 | goto failed; | 151 | goto failed; |
152 | } | 152 | } |
153 | 153 | ||
154 | mutex_lock(&UFS_SB(sb)->s_lock); | 154 | lock_ufs(sb); |
155 | 155 | ||
156 | do_more: | 156 | do_more: |
157 | overflow = 0; | 157 | overflow = 0; |
@@ -211,12 +211,12 @@ do_more: | |||
211 | } | 211 | } |
212 | 212 | ||
213 | ufs_mark_sb_dirty(sb); | 213 | ufs_mark_sb_dirty(sb); |
214 | mutex_unlock(&UFS_SB(sb)->s_lock); | 214 | unlock_ufs(sb); |
215 | UFSD("EXIT\n"); | 215 | UFSD("EXIT\n"); |
216 | return; | 216 | return; |
217 | 217 | ||
218 | failed_unlock: | 218 | failed_unlock: |
219 | mutex_unlock(&UFS_SB(sb)->s_lock); | 219 | unlock_ufs(sb); |
220 | failed: | 220 | failed: |
221 | UFSD("EXIT (FAILED)\n"); | 221 | UFSD("EXIT (FAILED)\n"); |
222 | return; | 222 | return; |
@@ -357,7 +357,7 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment, | |||
357 | usb1 = ubh_get_usb_first(uspi); | 357 | usb1 = ubh_get_usb_first(uspi); |
358 | *err = -ENOSPC; | 358 | *err = -ENOSPC; |
359 | 359 | ||
360 | mutex_lock(&UFS_SB(sb)->s_lock); | 360 | lock_ufs(sb); |
361 | tmp = ufs_data_ptr_to_cpu(sb, p); | 361 | tmp = ufs_data_ptr_to_cpu(sb, p); |
362 | 362 | ||
363 | if (count + ufs_fragnum(fragment) > uspi->s_fpb) { | 363 | if (count + ufs_fragnum(fragment) > uspi->s_fpb) { |
@@ -378,19 +378,19 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment, | |||
378 | "fragment %llu, tmp %llu\n", | 378 | "fragment %llu, tmp %llu\n", |
379 | (unsigned long long)fragment, | 379 | (unsigned long long)fragment, |
380 | (unsigned long long)tmp); | 380 | (unsigned long long)tmp); |
381 | mutex_unlock(&UFS_SB(sb)->s_lock); | 381 | unlock_ufs(sb); |
382 | return INVBLOCK; | 382 | return INVBLOCK; |
383 | } | 383 | } |
384 | if (fragment < UFS_I(inode)->i_lastfrag) { | 384 | if (fragment < UFS_I(inode)->i_lastfrag) { |
385 | UFSD("EXIT (ALREADY ALLOCATED)\n"); | 385 | UFSD("EXIT (ALREADY ALLOCATED)\n"); |
386 | mutex_unlock(&UFS_SB(sb)->s_lock); | 386 | unlock_ufs(sb); |
387 | return 0; | 387 | return 0; |
388 | } | 388 | } |
389 | } | 389 | } |
390 | else { | 390 | else { |
391 | if (tmp) { | 391 | if (tmp) { |
392 | UFSD("EXIT (ALREADY ALLOCATED)\n"); | 392 | UFSD("EXIT (ALREADY ALLOCATED)\n"); |
393 | mutex_unlock(&UFS_SB(sb)->s_lock); | 393 | unlock_ufs(sb); |
394 | return 0; | 394 | return 0; |
395 | } | 395 | } |
396 | } | 396 | } |
@@ -399,7 +399,7 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment, | |||
399 | * There is not enough space for user on the device | 399 | * There is not enough space for user on the device |
400 | */ | 400 | */ |
401 | if (!capable(CAP_SYS_RESOURCE) && ufs_freespace(uspi, UFS_MINFREE) <= 0) { | 401 | if (!capable(CAP_SYS_RESOURCE) && ufs_freespace(uspi, UFS_MINFREE) <= 0) { |
402 | mutex_unlock(&UFS_SB(sb)->s_lock); | 402 | unlock_ufs(sb); |
403 | UFSD("EXIT (FAILED)\n"); | 403 | UFSD("EXIT (FAILED)\n"); |
404 | return 0; | 404 | return 0; |
405 | } | 405 | } |
@@ -424,7 +424,7 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment, | |||
424 | ufs_clear_frags(inode, result + oldcount, | 424 | ufs_clear_frags(inode, result + oldcount, |
425 | newcount - oldcount, locked_page != NULL); | 425 | newcount - oldcount, locked_page != NULL); |
426 | } | 426 | } |
427 | mutex_unlock(&UFS_SB(sb)->s_lock); | 427 | unlock_ufs(sb); |
428 | UFSD("EXIT, result %llu\n", (unsigned long long)result); | 428 | UFSD("EXIT, result %llu\n", (unsigned long long)result); |
429 | return result; | 429 | return result; |
430 | } | 430 | } |
@@ -432,14 +432,14 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment, | |||
432 | /* | 432 | /* |
433 | * resize block | 433 | * resize block |
434 | */ | 434 | */ |
435 | result = ufs_add_fragments (inode, tmp, oldcount, newcount, err); | 435 | result = ufs_add_fragments(inode, tmp, oldcount, newcount); |
436 | if (result) { | 436 | if (result) { |
437 | *err = 0; | 437 | *err = 0; |
438 | UFS_I(inode)->i_lastfrag = max(UFS_I(inode)->i_lastfrag, | 438 | UFS_I(inode)->i_lastfrag = max(UFS_I(inode)->i_lastfrag, |
439 | fragment + count); | 439 | fragment + count); |
440 | ufs_clear_frags(inode, result + oldcount, newcount - oldcount, | 440 | ufs_clear_frags(inode, result + oldcount, newcount - oldcount, |
441 | locked_page != NULL); | 441 | locked_page != NULL); |
442 | mutex_unlock(&UFS_SB(sb)->s_lock); | 442 | unlock_ufs(sb); |
443 | UFSD("EXIT, result %llu\n", (unsigned long long)result); | 443 | UFSD("EXIT, result %llu\n", (unsigned long long)result); |
444 | return result; | 444 | return result; |
445 | } | 445 | } |
@@ -477,7 +477,7 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment, | |||
477 | *err = 0; | 477 | *err = 0; |
478 | UFS_I(inode)->i_lastfrag = max(UFS_I(inode)->i_lastfrag, | 478 | UFS_I(inode)->i_lastfrag = max(UFS_I(inode)->i_lastfrag, |
479 | fragment + count); | 479 | fragment + count); |
480 | mutex_unlock(&UFS_SB(sb)->s_lock); | 480 | unlock_ufs(sb); |
481 | if (newcount < request) | 481 | if (newcount < request) |
482 | ufs_free_fragments (inode, result + newcount, request - newcount); | 482 | ufs_free_fragments (inode, result + newcount, request - newcount); |
483 | ufs_free_fragments (inode, tmp, oldcount); | 483 | ufs_free_fragments (inode, tmp, oldcount); |
@@ -485,13 +485,13 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment, | |||
485 | return result; | 485 | return result; |
486 | } | 486 | } |
487 | 487 | ||
488 | mutex_unlock(&UFS_SB(sb)->s_lock); | 488 | unlock_ufs(sb); |
489 | UFSD("EXIT (FAILED)\n"); | 489 | UFSD("EXIT (FAILED)\n"); |
490 | return 0; | 490 | return 0; |
491 | } | 491 | } |
492 | 492 | ||
493 | static u64 ufs_add_fragments(struct inode *inode, u64 fragment, | 493 | static u64 ufs_add_fragments(struct inode *inode, u64 fragment, |
494 | unsigned oldcount, unsigned newcount, int *err) | 494 | unsigned oldcount, unsigned newcount) |
495 | { | 495 | { |
496 | struct super_block * sb; | 496 | struct super_block * sb; |
497 | struct ufs_sb_private_info * uspi; | 497 | struct ufs_sb_private_info * uspi; |
diff --git a/fs/ufs/ialloc.c b/fs/ufs/ialloc.c index 98f7211599ff..a9cc75ffa925 100644 --- a/fs/ufs/ialloc.c +++ b/fs/ufs/ialloc.c | |||
@@ -69,11 +69,11 @@ void ufs_free_inode (struct inode * inode) | |||
69 | 69 | ||
70 | ino = inode->i_ino; | 70 | ino = inode->i_ino; |
71 | 71 | ||
72 | mutex_lock(&UFS_SB(sb)->s_lock); | 72 | lock_ufs(sb); |
73 | 73 | ||
74 | if (!((ino > 1) && (ino < (uspi->s_ncg * uspi->s_ipg )))) { | 74 | if (!((ino > 1) && (ino < (uspi->s_ncg * uspi->s_ipg )))) { |
75 | ufs_warning(sb, "ufs_free_inode", "reserved inode or nonexistent inode %u\n", ino); | 75 | ufs_warning(sb, "ufs_free_inode", "reserved inode or nonexistent inode %u\n", ino); |
76 | mutex_unlock(&UFS_SB(sb)->s_lock); | 76 | unlock_ufs(sb); |
77 | return; | 77 | return; |
78 | } | 78 | } |
79 | 79 | ||
@@ -81,7 +81,7 @@ void ufs_free_inode (struct inode * inode) | |||
81 | bit = ufs_inotocgoff (ino); | 81 | bit = ufs_inotocgoff (ino); |
82 | ucpi = ufs_load_cylinder (sb, cg); | 82 | ucpi = ufs_load_cylinder (sb, cg); |
83 | if (!ucpi) { | 83 | if (!ucpi) { |
84 | mutex_unlock(&UFS_SB(sb)->s_lock); | 84 | unlock_ufs(sb); |
85 | return; | 85 | return; |
86 | } | 86 | } |
87 | ucg = ubh_get_ucg(UCPI_UBH(ucpi)); | 87 | ucg = ubh_get_ucg(UCPI_UBH(ucpi)); |
@@ -115,7 +115,7 @@ void ufs_free_inode (struct inode * inode) | |||
115 | ubh_sync_block(UCPI_UBH(ucpi)); | 115 | ubh_sync_block(UCPI_UBH(ucpi)); |
116 | 116 | ||
117 | ufs_mark_sb_dirty(sb); | 117 | ufs_mark_sb_dirty(sb); |
118 | mutex_unlock(&UFS_SB(sb)->s_lock); | 118 | unlock_ufs(sb); |
119 | UFSD("EXIT\n"); | 119 | UFSD("EXIT\n"); |
120 | } | 120 | } |
121 | 121 | ||
@@ -193,7 +193,7 @@ struct inode *ufs_new_inode(struct inode *dir, umode_t mode) | |||
193 | sbi = UFS_SB(sb); | 193 | sbi = UFS_SB(sb); |
194 | uspi = sbi->s_uspi; | 194 | uspi = sbi->s_uspi; |
195 | 195 | ||
196 | mutex_lock(&sbi->s_lock); | 196 | lock_ufs(sb); |
197 | 197 | ||
198 | /* | 198 | /* |
199 | * Try to place the inode in its parent directory | 199 | * Try to place the inode in its parent directory |
@@ -328,21 +328,20 @@ cg_found: | |||
328 | sync_dirty_buffer(bh); | 328 | sync_dirty_buffer(bh); |
329 | brelse(bh); | 329 | brelse(bh); |
330 | } | 330 | } |
331 | 331 | unlock_ufs(sb); | |
332 | mutex_unlock(&sbi->s_lock); | ||
333 | 332 | ||
334 | UFSD("allocating inode %lu\n", inode->i_ino); | 333 | UFSD("allocating inode %lu\n", inode->i_ino); |
335 | UFSD("EXIT\n"); | 334 | UFSD("EXIT\n"); |
336 | return inode; | 335 | return inode; |
337 | 336 | ||
338 | fail_remove_inode: | 337 | fail_remove_inode: |
339 | mutex_unlock(&sbi->s_lock); | 338 | unlock_ufs(sb); |
340 | clear_nlink(inode); | 339 | clear_nlink(inode); |
341 | iput(inode); | 340 | iput(inode); |
342 | UFSD("EXIT (FAILED): err %d\n", err); | 341 | UFSD("EXIT (FAILED): err %d\n", err); |
343 | return ERR_PTR(err); | 342 | return ERR_PTR(err); |
344 | failed: | 343 | failed: |
345 | mutex_unlock(&sbi->s_lock); | 344 | unlock_ufs(sb); |
346 | make_bad_inode(inode); | 345 | make_bad_inode(inode); |
347 | iput (inode); | 346 | iput (inode); |
348 | UFSD("EXIT (FAILED): err %d\n", err); | 347 | UFSD("EXIT (FAILED): err %d\n", err); |
diff --git a/fs/ufs/super.c b/fs/ufs/super.c index c1183f9f69dc..b879f1ba3439 100644 --- a/fs/ufs/super.c +++ b/fs/ufs/super.c | |||
@@ -697,7 +697,6 @@ static int ufs_sync_fs(struct super_block *sb, int wait) | |||
697 | unsigned flags; | 697 | unsigned flags; |
698 | 698 | ||
699 | lock_ufs(sb); | 699 | lock_ufs(sb); |
700 | mutex_lock(&UFS_SB(sb)->s_lock); | ||
701 | 700 | ||
702 | UFSD("ENTER\n"); | 701 | UFSD("ENTER\n"); |
703 | 702 | ||
@@ -715,7 +714,6 @@ static int ufs_sync_fs(struct super_block *sb, int wait) | |||
715 | ufs_put_cstotal(sb); | 714 | ufs_put_cstotal(sb); |
716 | 715 | ||
717 | UFSD("EXIT\n"); | 716 | UFSD("EXIT\n"); |
718 | mutex_unlock(&UFS_SB(sb)->s_lock); | ||
719 | unlock_ufs(sb); | 717 | unlock_ufs(sb); |
720 | 718 | ||
721 | return 0; | 719 | return 0; |
@@ -760,6 +758,7 @@ static void ufs_put_super(struct super_block *sb) | |||
760 | 758 | ||
761 | ubh_brelse_uspi (sbi->s_uspi); | 759 | ubh_brelse_uspi (sbi->s_uspi); |
762 | kfree (sbi->s_uspi); | 760 | kfree (sbi->s_uspi); |
761 | mutex_destroy(&sbi->mutex); | ||
763 | kfree (sbi); | 762 | kfree (sbi); |
764 | sb->s_fs_info = NULL; | 763 | sb->s_fs_info = NULL; |
765 | UFSD("EXIT\n"); | 764 | UFSD("EXIT\n"); |
@@ -786,6 +785,14 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent) | |||
786 | flags = 0; | 785 | flags = 0; |
787 | 786 | ||
788 | UFSD("ENTER\n"); | 787 | UFSD("ENTER\n"); |
788 | |||
789 | #ifndef CONFIG_UFS_FS_WRITE | ||
790 | if (!(sb->s_flags & MS_RDONLY)) { | ||
791 | printk("ufs was compiled with read-only support, " | ||
792 | "can't be mounted as read-write\n"); | ||
793 | return -EROFS; | ||
794 | } | ||
795 | #endif | ||
789 | 796 | ||
790 | sbi = kzalloc(sizeof(struct ufs_sb_info), GFP_KERNEL); | 797 | sbi = kzalloc(sizeof(struct ufs_sb_info), GFP_KERNEL); |
791 | if (!sbi) | 798 | if (!sbi) |
@@ -795,15 +802,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent) | |||
795 | 802 | ||
796 | UFSD("flag %u\n", (int)(sb->s_flags & MS_RDONLY)); | 803 | UFSD("flag %u\n", (int)(sb->s_flags & MS_RDONLY)); |
797 | 804 | ||
798 | #ifndef CONFIG_UFS_FS_WRITE | ||
799 | if (!(sb->s_flags & MS_RDONLY)) { | ||
800 | printk("ufs was compiled with read-only support, " | ||
801 | "can't be mounted as read-write\n"); | ||
802 | goto failed; | ||
803 | } | ||
804 | #endif | ||
805 | mutex_init(&sbi->mutex); | 805 | mutex_init(&sbi->mutex); |
806 | mutex_init(&sbi->s_lock); | ||
807 | spin_lock_init(&sbi->work_lock); | 806 | spin_lock_init(&sbi->work_lock); |
808 | INIT_DELAYED_WORK(&sbi->sync_work, delayed_sync_fs); | 807 | INIT_DELAYED_WORK(&sbi->sync_work, delayed_sync_fs); |
809 | /* | 808 | /* |
@@ -1257,6 +1256,7 @@ magic_found: | |||
1257 | return 0; | 1256 | return 0; |
1258 | 1257 | ||
1259 | failed: | 1258 | failed: |
1259 | mutex_destroy(&sbi->mutex); | ||
1260 | if (ubh) | 1260 | if (ubh) |
1261 | ubh_brelse_uspi (uspi); | 1261 | ubh_brelse_uspi (uspi); |
1262 | kfree (uspi); | 1262 | kfree (uspi); |
@@ -1280,7 +1280,6 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data) | |||
1280 | 1280 | ||
1281 | sync_filesystem(sb); | 1281 | sync_filesystem(sb); |
1282 | lock_ufs(sb); | 1282 | lock_ufs(sb); |
1283 | mutex_lock(&UFS_SB(sb)->s_lock); | ||
1284 | uspi = UFS_SB(sb)->s_uspi; | 1283 | uspi = UFS_SB(sb)->s_uspi; |
1285 | flags = UFS_SB(sb)->s_flags; | 1284 | flags = UFS_SB(sb)->s_flags; |
1286 | usb1 = ubh_get_usb_first(uspi); | 1285 | usb1 = ubh_get_usb_first(uspi); |
@@ -1294,7 +1293,6 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data) | |||
1294 | new_mount_opt = 0; | 1293 | new_mount_opt = 0; |
1295 | ufs_set_opt (new_mount_opt, ONERROR_LOCK); | 1294 | ufs_set_opt (new_mount_opt, ONERROR_LOCK); |
1296 | if (!ufs_parse_options (data, &new_mount_opt)) { | 1295 | if (!ufs_parse_options (data, &new_mount_opt)) { |
1297 | mutex_unlock(&UFS_SB(sb)->s_lock); | ||
1298 | unlock_ufs(sb); | 1296 | unlock_ufs(sb); |
1299 | return -EINVAL; | 1297 | return -EINVAL; |
1300 | } | 1298 | } |
@@ -1302,14 +1300,12 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data) | |||
1302 | new_mount_opt |= ufstype; | 1300 | new_mount_opt |= ufstype; |
1303 | } else if ((new_mount_opt & UFS_MOUNT_UFSTYPE) != ufstype) { | 1301 | } else if ((new_mount_opt & UFS_MOUNT_UFSTYPE) != ufstype) { |
1304 | printk("ufstype can't be changed during remount\n"); | 1302 | printk("ufstype can't be changed during remount\n"); |
1305 | mutex_unlock(&UFS_SB(sb)->s_lock); | ||
1306 | unlock_ufs(sb); | 1303 | unlock_ufs(sb); |
1307 | return -EINVAL; | 1304 | return -EINVAL; |
1308 | } | 1305 | } |
1309 | 1306 | ||
1310 | if ((*mount_flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) { | 1307 | if ((*mount_flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) { |
1311 | UFS_SB(sb)->s_mount_opt = new_mount_opt; | 1308 | UFS_SB(sb)->s_mount_opt = new_mount_opt; |
1312 | mutex_unlock(&UFS_SB(sb)->s_lock); | ||
1313 | unlock_ufs(sb); | 1309 | unlock_ufs(sb); |
1314 | return 0; | 1310 | return 0; |
1315 | } | 1311 | } |
@@ -1334,7 +1330,6 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data) | |||
1334 | #ifndef CONFIG_UFS_FS_WRITE | 1330 | #ifndef CONFIG_UFS_FS_WRITE |
1335 | printk("ufs was compiled with read-only support, " | 1331 | printk("ufs was compiled with read-only support, " |
1336 | "can't be mounted as read-write\n"); | 1332 | "can't be mounted as read-write\n"); |
1337 | mutex_unlock(&UFS_SB(sb)->s_lock); | ||
1338 | unlock_ufs(sb); | 1333 | unlock_ufs(sb); |
1339 | return -EINVAL; | 1334 | return -EINVAL; |
1340 | #else | 1335 | #else |
@@ -1344,13 +1339,11 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data) | |||
1344 | ufstype != UFS_MOUNT_UFSTYPE_SUNx86 && | 1339 | ufstype != UFS_MOUNT_UFSTYPE_SUNx86 && |
1345 | ufstype != UFS_MOUNT_UFSTYPE_UFS2) { | 1340 | ufstype != UFS_MOUNT_UFSTYPE_UFS2) { |
1346 | printk("this ufstype is read-only supported\n"); | 1341 | printk("this ufstype is read-only supported\n"); |
1347 | mutex_unlock(&UFS_SB(sb)->s_lock); | ||
1348 | unlock_ufs(sb); | 1342 | unlock_ufs(sb); |
1349 | return -EINVAL; | 1343 | return -EINVAL; |
1350 | } | 1344 | } |
1351 | if (!ufs_read_cylinder_structures(sb)) { | 1345 | if (!ufs_read_cylinder_structures(sb)) { |
1352 | printk("failed during remounting\n"); | 1346 | printk("failed during remounting\n"); |
1353 | mutex_unlock(&UFS_SB(sb)->s_lock); | ||
1354 | unlock_ufs(sb); | 1347 | unlock_ufs(sb); |
1355 | return -EPERM; | 1348 | return -EPERM; |
1356 | } | 1349 | } |
@@ -1358,7 +1351,6 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data) | |||
1358 | #endif | 1351 | #endif |
1359 | } | 1352 | } |
1360 | UFS_SB(sb)->s_mount_opt = new_mount_opt; | 1353 | UFS_SB(sb)->s_mount_opt = new_mount_opt; |
1361 | mutex_unlock(&UFS_SB(sb)->s_lock); | ||
1362 | unlock_ufs(sb); | 1354 | unlock_ufs(sb); |
1363 | return 0; | 1355 | return 0; |
1364 | } | 1356 | } |
diff --git a/fs/ufs/ufs.h b/fs/ufs/ufs.h index ff2c15ab81aa..343e6fc571e5 100644 --- a/fs/ufs/ufs.h +++ b/fs/ufs/ufs.h | |||
@@ -24,7 +24,6 @@ struct ufs_sb_info { | |||
24 | int work_queued; /* non-zero if the delayed work is queued */ | 24 | int work_queued; /* non-zero if the delayed work is queued */ |
25 | struct delayed_work sync_work; /* FS sync delayed work */ | 25 | struct delayed_work sync_work; /* FS sync delayed work */ |
26 | spinlock_t work_lock; /* protects sync_work and work_queued */ | 26 | spinlock_t work_lock; /* protects sync_work and work_queued */ |
27 | struct mutex s_lock; | ||
28 | }; | 27 | }; |
29 | 28 | ||
30 | struct ufs_inode_info { | 29 | struct ufs_inode_info { |