diff options
Diffstat (limited to 'fs/nilfs2/segment.c')
| -rw-r--r-- | fs/nilfs2/segment.c | 61 |
1 files changed, 30 insertions, 31 deletions
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c index e78b68a81aec..bedcae2c28e6 100644 --- a/fs/nilfs2/segment.c +++ b/fs/nilfs2/segment.c | |||
| @@ -150,7 +150,8 @@ static void nilfs_dispose_list(struct the_nilfs *, struct list_head *, int); | |||
| 150 | #define nilfs_cnt32_lt(a, b) nilfs_cnt32_gt(b, a) | 150 | #define nilfs_cnt32_lt(a, b) nilfs_cnt32_gt(b, a) |
| 151 | #define nilfs_cnt32_le(a, b) nilfs_cnt32_ge(b, a) | 151 | #define nilfs_cnt32_le(a, b) nilfs_cnt32_ge(b, a) |
| 152 | 152 | ||
| 153 | static int nilfs_prepare_segment_lock(struct nilfs_transaction_info *ti) | 153 | static int nilfs_prepare_segment_lock(struct super_block *sb, |
| 154 | struct nilfs_transaction_info *ti) | ||
| 154 | { | 155 | { |
| 155 | struct nilfs_transaction_info *cur_ti = current->journal_info; | 156 | struct nilfs_transaction_info *cur_ti = current->journal_info; |
| 156 | void *save = NULL; | 157 | void *save = NULL; |
| @@ -164,8 +165,7 @@ static int nilfs_prepare_segment_lock(struct nilfs_transaction_info *ti) | |||
| 164 | * it is saved and will be restored on | 165 | * it is saved and will be restored on |
| 165 | * nilfs_transaction_commit(). | 166 | * nilfs_transaction_commit(). |
| 166 | */ | 167 | */ |
| 167 | printk(KERN_WARNING | 168 | nilfs_msg(sb, KERN_WARNING, "journal info from a different FS"); |
| 168 | "NILFS warning: journal info from a different FS\n"); | ||
| 169 | save = current->journal_info; | 169 | save = current->journal_info; |
| 170 | } | 170 | } |
| 171 | if (!ti) { | 171 | if (!ti) { |
| @@ -215,7 +215,7 @@ int nilfs_transaction_begin(struct super_block *sb, | |||
| 215 | int vacancy_check) | 215 | int vacancy_check) |
| 216 | { | 216 | { |
| 217 | struct the_nilfs *nilfs; | 217 | struct the_nilfs *nilfs; |
| 218 | int ret = nilfs_prepare_segment_lock(ti); | 218 | int ret = nilfs_prepare_segment_lock(sb, ti); |
| 219 | struct nilfs_transaction_info *trace_ti; | 219 | struct nilfs_transaction_info *trace_ti; |
| 220 | 220 | ||
| 221 | if (unlikely(ret < 0)) | 221 | if (unlikely(ret < 0)) |
| @@ -373,7 +373,7 @@ static void nilfs_transaction_lock(struct super_block *sb, | |||
| 373 | nilfs_segctor_do_immediate_flush(sci); | 373 | nilfs_segctor_do_immediate_flush(sci); |
| 374 | 374 | ||
| 375 | up_write(&nilfs->ns_segctor_sem); | 375 | up_write(&nilfs->ns_segctor_sem); |
| 376 | yield(); | 376 | cond_resched(); |
| 377 | } | 377 | } |
| 378 | if (gcflag) | 378 | if (gcflag) |
| 379 | ti->ti_flags |= NILFS_TI_GC; | 379 | ti->ti_flags |= NILFS_TI_GC; |
| @@ -1858,11 +1858,11 @@ static void nilfs_segctor_complete_write(struct nilfs_sc_info *sci) | |||
| 1858 | */ | 1858 | */ |
| 1859 | list_for_each_entry(bh, &segbuf->sb_payload_buffers, | 1859 | list_for_each_entry(bh, &segbuf->sb_payload_buffers, |
| 1860 | b_assoc_buffers) { | 1860 | b_assoc_buffers) { |
| 1861 | const unsigned long set_bits = (1 << BH_Uptodate); | 1861 | const unsigned long set_bits = BIT(BH_Uptodate); |
| 1862 | const unsigned long clear_bits = | 1862 | const unsigned long clear_bits = |
| 1863 | (1 << BH_Dirty | 1 << BH_Async_Write | | 1863 | (BIT(BH_Dirty) | BIT(BH_Async_Write) | |
| 1864 | 1 << BH_Delay | 1 << BH_NILFS_Volatile | | 1864 | BIT(BH_Delay) | BIT(BH_NILFS_Volatile) | |
| 1865 | 1 << BH_NILFS_Redirected); | 1865 | BIT(BH_NILFS_Redirected)); |
| 1866 | 1866 | ||
| 1867 | set_mask_bits(&bh->b_state, clear_bits, set_bits); | 1867 | set_mask_bits(&bh->b_state, clear_bits, set_bits); |
| 1868 | if (bh == segbuf->sb_super_root) { | 1868 | if (bh == segbuf->sb_super_root) { |
| @@ -1951,8 +1951,9 @@ static int nilfs_segctor_collect_dirty_files(struct nilfs_sc_info *sci, | |||
| 1951 | err = nilfs_ifile_get_inode_block( | 1951 | err = nilfs_ifile_get_inode_block( |
| 1952 | ifile, ii->vfs_inode.i_ino, &ibh); | 1952 | ifile, ii->vfs_inode.i_ino, &ibh); |
| 1953 | if (unlikely(err)) { | 1953 | if (unlikely(err)) { |
| 1954 | nilfs_warning(sci->sc_super, __func__, | 1954 | nilfs_msg(sci->sc_super, KERN_WARNING, |
| 1955 | "failed to get inode block."); | 1955 | "log writer: error %d getting inode block (ino=%lu)", |
| 1956 | err, ii->vfs_inode.i_ino); | ||
| 1956 | return err; | 1957 | return err; |
| 1957 | } | 1958 | } |
| 1958 | mark_buffer_dirty(ibh); | 1959 | mark_buffer_dirty(ibh); |
| @@ -2131,10 +2132,10 @@ static void nilfs_segctor_start_timer(struct nilfs_sc_info *sci) | |||
| 2131 | static void nilfs_segctor_do_flush(struct nilfs_sc_info *sci, int bn) | 2132 | static void nilfs_segctor_do_flush(struct nilfs_sc_info *sci, int bn) |
| 2132 | { | 2133 | { |
| 2133 | spin_lock(&sci->sc_state_lock); | 2134 | spin_lock(&sci->sc_state_lock); |
| 2134 | if (!(sci->sc_flush_request & (1 << bn))) { | 2135 | if (!(sci->sc_flush_request & BIT(bn))) { |
| 2135 | unsigned long prev_req = sci->sc_flush_request; | 2136 | unsigned long prev_req = sci->sc_flush_request; |
| 2136 | 2137 | ||
| 2137 | sci->sc_flush_request |= (1 << bn); | 2138 | sci->sc_flush_request |= BIT(bn); |
| 2138 | if (!prev_req) | 2139 | if (!prev_req) |
| 2139 | wake_up(&sci->sc_wait_daemon); | 2140 | wake_up(&sci->sc_wait_daemon); |
| 2140 | } | 2141 | } |
| @@ -2318,7 +2319,7 @@ int nilfs_construct_dsync_segment(struct super_block *sb, struct inode *inode, | |||
| 2318 | } | 2319 | } |
| 2319 | 2320 | ||
| 2320 | #define FLUSH_FILE_BIT (0x1) /* data file only */ | 2321 | #define FLUSH_FILE_BIT (0x1) /* data file only */ |
| 2321 | #define FLUSH_DAT_BIT (1 << NILFS_DAT_INO) /* DAT only */ | 2322 | #define FLUSH_DAT_BIT BIT(NILFS_DAT_INO) /* DAT only */ |
| 2322 | 2323 | ||
| 2323 | /** | 2324 | /** |
| 2324 | * nilfs_segctor_accept - record accepted sequence count of log-write requests | 2325 | * nilfs_segctor_accept - record accepted sequence count of log-write requests |
| @@ -2458,8 +2459,7 @@ int nilfs_clean_segments(struct super_block *sb, struct nilfs_argv *argv, | |||
| 2458 | if (likely(!err)) | 2459 | if (likely(!err)) |
| 2459 | break; | 2460 | break; |
| 2460 | 2461 | ||
| 2461 | nilfs_warning(sb, __func__, | 2462 | nilfs_msg(sb, KERN_WARNING, "error %d cleaning segments", err); |
| 2462 | "segment construction failed. (err=%d)", err); | ||
| 2463 | set_current_state(TASK_INTERRUPTIBLE); | 2463 | set_current_state(TASK_INTERRUPTIBLE); |
| 2464 | schedule_timeout(sci->sc_interval); | 2464 | schedule_timeout(sci->sc_interval); |
| 2465 | } | 2465 | } |
| @@ -2467,9 +2467,9 @@ int nilfs_clean_segments(struct super_block *sb, struct nilfs_argv *argv, | |||
| 2467 | int ret = nilfs_discard_segments(nilfs, sci->sc_freesegs, | 2467 | int ret = nilfs_discard_segments(nilfs, sci->sc_freesegs, |
| 2468 | sci->sc_nfreesegs); | 2468 | sci->sc_nfreesegs); |
| 2469 | if (ret) { | 2469 | if (ret) { |
| 2470 | printk(KERN_WARNING | 2470 | nilfs_msg(sb, KERN_WARNING, |
| 2471 | "NILFS warning: error %d on discard request, " | 2471 | "error %d on discard request, turning discards off for the device", |
| 2472 | "turning discards off for the device\n", ret); | 2472 | ret); |
| 2473 | nilfs_clear_opt(nilfs, DISCARD); | 2473 | nilfs_clear_opt(nilfs, DISCARD); |
| 2474 | } | 2474 | } |
| 2475 | } | 2475 | } |
| @@ -2551,10 +2551,9 @@ static int nilfs_segctor_thread(void *arg) | |||
| 2551 | /* start sync. */ | 2551 | /* start sync. */ |
| 2552 | sci->sc_task = current; | 2552 | sci->sc_task = current; |
| 2553 | wake_up(&sci->sc_wait_task); /* for nilfs_segctor_start_thread() */ | 2553 | wake_up(&sci->sc_wait_task); /* for nilfs_segctor_start_thread() */ |
| 2554 | printk(KERN_INFO | 2554 | nilfs_msg(sci->sc_super, KERN_INFO, |
| 2555 | "segctord starting. Construction interval = %lu seconds, " | 2555 | "segctord starting. Construction interval = %lu seconds, CP frequency < %lu seconds", |
| 2556 | "CP frequency < %lu seconds\n", | 2556 | sci->sc_interval / HZ, sci->sc_mjcp_freq / HZ); |
| 2557 | sci->sc_interval / HZ, sci->sc_mjcp_freq / HZ); | ||
| 2558 | 2557 | ||
| 2559 | spin_lock(&sci->sc_state_lock); | 2558 | spin_lock(&sci->sc_state_lock); |
| 2560 | loop: | 2559 | loop: |
| @@ -2628,8 +2627,8 @@ static int nilfs_segctor_start_thread(struct nilfs_sc_info *sci) | |||
| 2628 | if (IS_ERR(t)) { | 2627 | if (IS_ERR(t)) { |
| 2629 | int err = PTR_ERR(t); | 2628 | int err = PTR_ERR(t); |
| 2630 | 2629 | ||
| 2631 | printk(KERN_ERR "NILFS: error %d creating segctord thread\n", | 2630 | nilfs_msg(sci->sc_super, KERN_ERR, |
| 2632 | err); | 2631 | "error %d creating segctord thread", err); |
| 2633 | return err; | 2632 | return err; |
| 2634 | } | 2633 | } |
| 2635 | wait_event(sci->sc_wait_task, sci->sc_task != NULL); | 2634 | wait_event(sci->sc_wait_task, sci->sc_task != NULL); |
| @@ -2739,14 +2738,14 @@ static void nilfs_segctor_destroy(struct nilfs_sc_info *sci) | |||
| 2739 | nilfs_segctor_write_out(sci); | 2738 | nilfs_segctor_write_out(sci); |
| 2740 | 2739 | ||
| 2741 | if (!list_empty(&sci->sc_dirty_files)) { | 2740 | if (!list_empty(&sci->sc_dirty_files)) { |
| 2742 | nilfs_warning(sci->sc_super, __func__, | 2741 | nilfs_msg(sci->sc_super, KERN_WARNING, |
| 2743 | "dirty file(s) after the final construction"); | 2742 | "disposed unprocessed dirty file(s) when stopping log writer"); |
| 2744 | nilfs_dispose_list(nilfs, &sci->sc_dirty_files, 1); | 2743 | nilfs_dispose_list(nilfs, &sci->sc_dirty_files, 1); |
| 2745 | } | 2744 | } |
| 2746 | 2745 | ||
| 2747 | if (!list_empty(&sci->sc_iput_queue)) { | 2746 | if (!list_empty(&sci->sc_iput_queue)) { |
| 2748 | nilfs_warning(sci->sc_super, __func__, | 2747 | nilfs_msg(sci->sc_super, KERN_WARNING, |
| 2749 | "iput queue is not empty"); | 2748 | "disposed unprocessed inode(s) in iput queue when stopping log writer"); |
| 2750 | nilfs_dispose_list(nilfs, &sci->sc_iput_queue, 1); | 2749 | nilfs_dispose_list(nilfs, &sci->sc_iput_queue, 1); |
| 2751 | } | 2750 | } |
| 2752 | 2751 | ||
| @@ -2822,8 +2821,8 @@ void nilfs_detach_log_writer(struct super_block *sb) | |||
| 2822 | spin_lock(&nilfs->ns_inode_lock); | 2821 | spin_lock(&nilfs->ns_inode_lock); |
| 2823 | if (!list_empty(&nilfs->ns_dirty_files)) { | 2822 | if (!list_empty(&nilfs->ns_dirty_files)) { |
| 2824 | list_splice_init(&nilfs->ns_dirty_files, &garbage_list); | 2823 | list_splice_init(&nilfs->ns_dirty_files, &garbage_list); |
| 2825 | nilfs_warning(sb, __func__, | 2824 | nilfs_msg(sb, KERN_WARNING, |
| 2826 | "Hit dirty file after stopped log writer"); | 2825 | "disposed unprocessed dirty file(s) when detaching log writer"); |
| 2827 | } | 2826 | } |
| 2828 | spin_unlock(&nilfs->ns_inode_lock); | 2827 | spin_unlock(&nilfs->ns_inode_lock); |
| 2829 | up_write(&nilfs->ns_segctor_sem); | 2828 | up_write(&nilfs->ns_segctor_sem); |
