forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-09 958e46acc8e900e8569dd467c1af9b8d2d019394
kernel/fs/nilfs2/the_nilfs.c
....@@ -183,7 +183,7 @@
183183 nilfs_get_segnum_of_block(nilfs, nilfs->ns_last_pseg);
184184 nilfs->ns_cno = nilfs->ns_last_cno + 1;
185185 if (nilfs->ns_segnum >= nilfs->ns_nsegments) {
186
- nilfs_msg(nilfs->ns_sb, KERN_ERR,
186
+ nilfs_err(nilfs->ns_sb,
187187 "pointed segment number is out of range: segnum=%llu, nsegments=%lu",
188188 (unsigned long long)nilfs->ns_segnum,
189189 nilfs->ns_nsegments);
....@@ -210,12 +210,12 @@
210210 int err;
211211
212212 if (!valid_fs) {
213
- nilfs_msg(sb, KERN_WARNING, "mounting unchecked fs");
213
+ nilfs_warn(sb, "mounting unchecked fs");
214214 if (s_flags & SB_RDONLY) {
215
- nilfs_msg(sb, KERN_INFO,
216
- "recovery required for readonly filesystem");
217
- nilfs_msg(sb, KERN_INFO,
218
- "write access will be enabled during recovery");
215
+ nilfs_info(sb,
216
+ "recovery required for readonly filesystem");
217
+ nilfs_info(sb,
218
+ "write access will be enabled during recovery");
219219 }
220220 }
221221
....@@ -230,12 +230,11 @@
230230 goto scan_error;
231231
232232 if (!nilfs_valid_sb(sbp[1])) {
233
- nilfs_msg(sb, KERN_WARNING,
234
- "unable to fall back to spare super block");
233
+ nilfs_warn(sb,
234
+ "unable to fall back to spare super block");
235235 goto scan_error;
236236 }
237
- nilfs_msg(sb, KERN_INFO,
238
- "trying rollback from an earlier position");
237
+ nilfs_info(sb, "trying rollback from an earlier position");
239238
240239 /*
241240 * restore super block with its spare and reconfigure
....@@ -248,9 +247,9 @@
248247 /* verify consistency between two super blocks */
249248 blocksize = BLOCK_SIZE << le32_to_cpu(sbp[0]->s_log_block_size);
250249 if (blocksize != nilfs->ns_blocksize) {
251
- nilfs_msg(sb, KERN_WARNING,
252
- "blocksize differs between two super blocks (%d != %d)",
253
- blocksize, nilfs->ns_blocksize);
250
+ nilfs_warn(sb,
251
+ "blocksize differs between two super blocks (%d != %d)",
252
+ blocksize, nilfs->ns_blocksize);
254253 goto scan_error;
255254 }
256255
....@@ -269,8 +268,7 @@
269268
270269 err = nilfs_load_super_root(nilfs, sb, ri.ri_super_root);
271270 if (unlikely(err)) {
272
- nilfs_msg(sb, KERN_ERR, "error %d while loading super root",
273
- err);
271
+ nilfs_err(sb, "error %d while loading super root", err);
274272 goto failed;
275273 }
276274
....@@ -281,28 +279,28 @@
281279 __u64 features;
282280
283281 if (nilfs_test_opt(nilfs, NORECOVERY)) {
284
- nilfs_msg(sb, KERN_INFO,
285
- "norecovery option specified, skipping roll-forward recovery");
282
+ nilfs_info(sb,
283
+ "norecovery option specified, skipping roll-forward recovery");
286284 goto skip_recovery;
287285 }
288286 features = le64_to_cpu(nilfs->ns_sbp[0]->s_feature_compat_ro) &
289287 ~NILFS_FEATURE_COMPAT_RO_SUPP;
290288 if (features) {
291
- nilfs_msg(sb, KERN_ERR,
289
+ nilfs_err(sb,
292290 "couldn't proceed with recovery because of unsupported optional features (%llx)",
293291 (unsigned long long)features);
294292 err = -EROFS;
295293 goto failed_unload;
296294 }
297295 if (really_read_only) {
298
- nilfs_msg(sb, KERN_ERR,
296
+ nilfs_err(sb,
299297 "write access unavailable, cannot proceed");
300298 err = -EROFS;
301299 goto failed_unload;
302300 }
303301 sb->s_flags &= ~SB_RDONLY;
304302 } else if (nilfs_test_opt(nilfs, NORECOVERY)) {
305
- nilfs_msg(sb, KERN_ERR,
303
+ nilfs_err(sb,
306304 "recovery cancelled because norecovery option was specified for a read/write mount");
307305 err = -EINVAL;
308306 goto failed_unload;
....@@ -318,12 +316,12 @@
318316 up_write(&nilfs->ns_sem);
319317
320318 if (err) {
321
- nilfs_msg(sb, KERN_ERR,
319
+ nilfs_err(sb,
322320 "error %d updating super block. recovery unfinished.",
323321 err);
324322 goto failed_unload;
325323 }
326
- nilfs_msg(sb, KERN_INFO, "recovery complete");
324
+ nilfs_info(sb, "recovery complete");
327325
328326 skip_recovery:
329327 nilfs_clear_recovery_info(&ri);
....@@ -331,7 +329,7 @@
331329 return 0;
332330
333331 scan_error:
334
- nilfs_msg(sb, KERN_ERR, "error %d while searching super root", err);
332
+ nilfs_err(sb, "error %d while searching super root", err);
335333 goto failed;
336334
337335 failed_unload:
....@@ -378,7 +376,7 @@
378376 struct nilfs_super_block *sbp)
379377 {
380378 if (le32_to_cpu(sbp->s_rev_level) < NILFS_MIN_SUPP_REV) {
381
- nilfs_msg(nilfs->ns_sb, KERN_ERR,
379
+ nilfs_err(nilfs->ns_sb,
382380 "unsupported revision (superblock rev.=%d.%d, current rev.=%d.%d). Please check the version of mkfs.nilfs(2).",
383381 le32_to_cpu(sbp->s_rev_level),
384382 le16_to_cpu(sbp->s_minor_rev_level),
....@@ -391,13 +389,11 @@
391389
392390 nilfs->ns_inode_size = le16_to_cpu(sbp->s_inode_size);
393391 if (nilfs->ns_inode_size > nilfs->ns_blocksize) {
394
- nilfs_msg(nilfs->ns_sb, KERN_ERR,
395
- "too large inode size: %d bytes",
392
+ nilfs_err(nilfs->ns_sb, "too large inode size: %d bytes",
396393 nilfs->ns_inode_size);
397394 return -EINVAL;
398395 } else if (nilfs->ns_inode_size < NILFS_MIN_INODE_SIZE) {
399
- nilfs_msg(nilfs->ns_sb, KERN_ERR,
400
- "too small inode size: %d bytes",
396
+ nilfs_err(nilfs->ns_sb, "too small inode size: %d bytes",
401397 nilfs->ns_inode_size);
402398 return -EINVAL;
403399 }
....@@ -406,8 +402,7 @@
406402
407403 nilfs->ns_blocks_per_segment = le32_to_cpu(sbp->s_blocks_per_segment);
408404 if (nilfs->ns_blocks_per_segment < NILFS_SEG_MIN_BLOCKS) {
409
- nilfs_msg(nilfs->ns_sb, KERN_ERR,
410
- "too short segment: %lu blocks",
405
+ nilfs_err(nilfs->ns_sb, "too short segment: %lu blocks",
411406 nilfs->ns_blocks_per_segment);
412407 return -EINVAL;
413408 }
....@@ -417,7 +412,7 @@
417412 le32_to_cpu(sbp->s_r_segments_percentage);
418413 if (nilfs->ns_r_segments_percentage < 1 ||
419414 nilfs->ns_r_segments_percentage > 99) {
420
- nilfs_msg(nilfs->ns_sb, KERN_ERR,
415
+ nilfs_err(nilfs->ns_sb,
421416 "invalid reserved segments percentage: %lu",
422417 nilfs->ns_r_segments_percentage);
423418 return -EINVAL;
....@@ -503,16 +498,16 @@
503498
504499 if (!sbp[0]) {
505500 if (!sbp[1]) {
506
- nilfs_msg(sb, KERN_ERR, "unable to read superblock");
501
+ nilfs_err(sb, "unable to read superblock");
507502 return -EIO;
508503 }
509
- nilfs_msg(sb, KERN_WARNING,
510
- "unable to read primary superblock (blocksize = %d)",
511
- blocksize);
504
+ nilfs_warn(sb,
505
+ "unable to read primary superblock (blocksize = %d)",
506
+ blocksize);
512507 } else if (!sbp[1]) {
513
- nilfs_msg(sb, KERN_WARNING,
514
- "unable to read secondary superblock (blocksize = %d)",
515
- blocksize);
508
+ nilfs_warn(sb,
509
+ "unable to read secondary superblock (blocksize = %d)",
510
+ blocksize);
516511 }
517512
518513 /*
....@@ -534,14 +529,14 @@
534529 }
535530 if (!valid[swp]) {
536531 nilfs_release_super_block(nilfs);
537
- nilfs_msg(sb, KERN_ERR, "couldn't find nilfs on the device");
532
+ nilfs_err(sb, "couldn't find nilfs on the device");
538533 return -EINVAL;
539534 }
540535
541536 if (!valid[!swp])
542
- nilfs_msg(sb, KERN_WARNING,
543
- "broken superblock, retrying with spare superblock (blocksize = %d)",
544
- blocksize);
537
+ nilfs_warn(sb,
538
+ "broken superblock, retrying with spare superblock (blocksize = %d)",
539
+ blocksize);
545540 if (swp)
546541 nilfs_swap_super_block(nilfs);
547542
....@@ -575,7 +570,7 @@
575570
576571 blocksize = sb_min_blocksize(sb, NILFS_MIN_BLOCK_SIZE);
577572 if (!blocksize) {
578
- nilfs_msg(sb, KERN_ERR, "unable to set blocksize");
573
+ nilfs_err(sb, "unable to set blocksize");
579574 err = -EINVAL;
580575 goto out;
581576 }
....@@ -594,7 +589,7 @@
594589 blocksize = BLOCK_SIZE << le32_to_cpu(sbp->s_log_block_size);
595590 if (blocksize < NILFS_MIN_BLOCK_SIZE ||
596591 blocksize > NILFS_MAX_BLOCK_SIZE) {
597
- nilfs_msg(sb, KERN_ERR,
592
+ nilfs_err(sb,
598593 "couldn't mount because of unsupported filesystem blocksize %d",
599594 blocksize);
600595 err = -EINVAL;
....@@ -604,7 +599,7 @@
604599 int hw_blocksize = bdev_logical_block_size(sb->s_bdev);
605600
606601 if (blocksize < hw_blocksize) {
607
- nilfs_msg(sb, KERN_ERR,
602
+ nilfs_err(sb,
608603 "blocksize %d too small for device (sector-size = %d)",
609604 blocksize, hw_blocksize);
610605 err = -EINVAL;
....@@ -695,9 +690,7 @@
695690 {
696691 unsigned long ncleansegs;
697692
698
- down_read(&NILFS_MDT(nilfs->ns_dat)->mi_sem);
699693 ncleansegs = nilfs_sufile_get_ncleansegs(nilfs->ns_sufile);
700
- up_read(&NILFS_MDT(nilfs->ns_dat)->mi_sem);
701694 *nblocks = (sector_t)ncleansegs * nilfs->ns_blocks_per_segment;
702695 return 0;
703696 }