Lines Matching refs:sh
308 struct stripe_head *sh, int disks) in r5c_handle_cached_data_endio() argument
312 for (i = sh->disks; i--; ) { in r5c_handle_cached_data_endio()
313 if (sh->dev[i].written) { in r5c_handle_cached_data_endio()
314 set_bit(R5_UPTODATE, &sh->dev[i].flags); in r5c_handle_cached_data_endio()
315 r5c_return_dev_pending_writes(conf, &sh->dev[i]); in r5c_handle_cached_data_endio()
316 md_bitmap_endwrite(conf->mddev->bitmap, sh->sector, in r5c_handle_cached_data_endio()
318 !test_bit(STRIPE_DEGRADED, &sh->state), in r5c_handle_cached_data_endio()
449 void r5c_make_stripe_write_out(struct stripe_head *sh) in r5c_make_stripe_write_out() argument
451 struct r5conf *conf = sh->raid_conf; in r5c_make_stripe_write_out()
456 WARN_ON(!test_bit(STRIPE_R5C_CACHING, &sh->state)); in r5c_make_stripe_write_out()
457 clear_bit(STRIPE_R5C_CACHING, &sh->state); in r5c_make_stripe_write_out()
459 if (!test_and_set_bit(STRIPE_PREREAD_ACTIVE, &sh->state)) in r5c_make_stripe_write_out()
463 static void r5c_handle_data_cached(struct stripe_head *sh) in r5c_handle_data_cached() argument
467 for (i = sh->disks; i--; ) in r5c_handle_data_cached()
468 if (test_and_clear_bit(R5_Wantwrite, &sh->dev[i].flags)) { in r5c_handle_data_cached()
469 set_bit(R5_InJournal, &sh->dev[i].flags); in r5c_handle_data_cached()
470 clear_bit(R5_LOCKED, &sh->dev[i].flags); in r5c_handle_data_cached()
472 clear_bit(STRIPE_LOG_TRAPPED, &sh->state); in r5c_handle_data_cached()
479 static void r5c_handle_parity_cached(struct stripe_head *sh) in r5c_handle_parity_cached() argument
483 for (i = sh->disks; i--; ) in r5c_handle_parity_cached()
484 if (test_bit(R5_InJournal, &sh->dev[i].flags)) in r5c_handle_parity_cached()
485 set_bit(R5_Wantwrite, &sh->dev[i].flags); in r5c_handle_parity_cached()
492 static void r5c_finish_cache_stripe(struct stripe_head *sh) in r5c_finish_cache_stripe() argument
494 struct r5l_log *log = sh->raid_conf->log; in r5c_finish_cache_stripe()
497 BUG_ON(test_bit(STRIPE_R5C_CACHING, &sh->state)); in r5c_finish_cache_stripe()
504 set_bit(R5_InJournal, &sh->dev[sh->pd_idx].flags); in r5c_finish_cache_stripe()
505 } else if (test_bit(STRIPE_R5C_CACHING, &sh->state)) { in r5c_finish_cache_stripe()
506 r5c_handle_data_cached(sh); in r5c_finish_cache_stripe()
508 r5c_handle_parity_cached(sh); in r5c_finish_cache_stripe()
509 set_bit(R5_InJournal, &sh->dev[sh->pd_idx].flags); in r5c_finish_cache_stripe()
515 struct stripe_head *sh, *next; in r5l_io_run_stripes() local
517 list_for_each_entry_safe(sh, next, &io->stripe_list, log_list) { in r5l_io_run_stripes()
518 list_del_init(&sh->log_list); in r5l_io_run_stripes()
520 r5c_finish_cache_stripe(sh); in r5l_io_run_stripes()
522 set_bit(STRIPE_HANDLE, &sh->state); in r5l_io_run_stripes()
523 raid5_release_stripe(sh); in r5l_io_run_stripes()
901 static int r5l_log_stripe(struct r5l_log *log, struct stripe_head *sh, in r5l_log_stripe() argument
921 if (test_and_clear_bit(STRIPE_R5C_PREFLUSH, &sh->state)) in r5l_log_stripe()
924 for (i = 0; i < sh->disks; i++) { in r5l_log_stripe()
925 if (!test_bit(R5_Wantwrite, &sh->dev[i].flags) || in r5l_log_stripe()
926 test_bit(R5_InJournal, &sh->dev[i].flags)) in r5l_log_stripe()
928 if (i == sh->pd_idx || i == sh->qd_idx) in r5l_log_stripe()
930 if (test_bit(R5_WantFUA, &sh->dev[i].flags) && in r5l_log_stripe()
940 raid5_compute_blocknr(sh, i, 0), in r5l_log_stripe()
941 sh->dev[i].log_checksum, 0, false); in r5l_log_stripe()
942 r5l_append_payload_page(log, sh->dev[i].page); in r5l_log_stripe()
947 sh->sector, sh->dev[sh->pd_idx].log_checksum, in r5l_log_stripe()
948 sh->dev[sh->qd_idx].log_checksum, true); in r5l_log_stripe()
949 r5l_append_payload_page(log, sh->dev[sh->pd_idx].page); in r5l_log_stripe()
950 r5l_append_payload_page(log, sh->dev[sh->qd_idx].page); in r5l_log_stripe()
953 sh->sector, sh->dev[sh->pd_idx].log_checksum, in r5l_log_stripe()
955 r5l_append_payload_page(log, sh->dev[sh->pd_idx].page); in r5l_log_stripe()
959 list_add_tail(&sh->log_list, &io->stripe_list); in r5l_log_stripe()
961 sh->log_io = io; in r5l_log_stripe()
966 if (sh->log_start == MaxSector) { in r5l_log_stripe()
967 BUG_ON(!list_empty(&sh->r5c)); in r5l_log_stripe()
968 sh->log_start = io->log_start; in r5l_log_stripe()
970 list_add_tail(&sh->r5c, in r5l_log_stripe()
980 struct stripe_head *sh) in r5l_add_no_space_stripe() argument
983 list_add_tail(&sh->log_list, &log->no_space_stripes); in r5l_add_no_space_stripe()
991 int r5l_write_stripe(struct r5l_log *log, struct stripe_head *sh) in r5l_write_stripe() argument
993 struct r5conf *conf = sh->raid_conf; in r5l_write_stripe()
1004 if (sh->log_io || !test_bit(R5_Wantwrite, &sh->dev[sh->pd_idx].flags) || in r5l_write_stripe()
1005 test_bit(STRIPE_SYNCING, &sh->state)) { in r5l_write_stripe()
1007 clear_bit(STRIPE_LOG_TRAPPED, &sh->state); in r5l_write_stripe()
1011 WARN_ON(test_bit(STRIPE_R5C_CACHING, &sh->state)); in r5l_write_stripe()
1013 for (i = 0; i < sh->disks; i++) { in r5l_write_stripe()
1016 if (!test_bit(R5_Wantwrite, &sh->dev[i].flags) || in r5l_write_stripe()
1017 test_bit(R5_InJournal, &sh->dev[i].flags)) in r5l_write_stripe()
1022 if (test_bit(STRIPE_LOG_TRAPPED, &sh->state)) in r5l_write_stripe()
1024 addr = kmap_atomic(sh->dev[i].page); in r5l_write_stripe()
1025 sh->dev[i].log_checksum = crc32c_le(log->uuid_checksum, in r5l_write_stripe()
1029 parity_pages = 1 + !!(sh->qd_idx >= 0); in r5l_write_stripe()
1032 set_bit(STRIPE_LOG_TRAPPED, &sh->state); in r5l_write_stripe()
1037 clear_bit(STRIPE_DELAYED, &sh->state); in r5l_write_stripe()
1038 atomic_inc(&sh->count); in r5l_write_stripe()
1046 r5l_add_no_space_stripe(log, sh); in r5l_write_stripe()
1049 ret = r5l_log_stripe(log, sh, data_pages, parity_pages); in r5l_write_stripe()
1052 list_add_tail(&sh->log_list, in r5l_write_stripe()
1063 sh->log_start == MaxSector) { in r5l_write_stripe()
1064 r5l_add_no_space_stripe(log, sh); in r5l_write_stripe()
1068 if (sh->log_start == log->last_checkpoint) in r5l_write_stripe()
1071 r5l_add_no_space_stripe(log, sh); in r5l_write_stripe()
1073 ret = r5l_log_stripe(log, sh, data_pages, parity_pages); in r5l_write_stripe()
1076 list_add_tail(&sh->log_list, in r5l_write_stripe()
1133 struct stripe_head *sh; in r5l_run_no_space_stripes() local
1137 sh = list_first_entry(&log->no_space_stripes, in r5l_run_no_space_stripes()
1139 list_del_init(&sh->log_list); in r5l_run_no_space_stripes()
1140 set_bit(STRIPE_HANDLE, &sh->state); in r5l_run_no_space_stripes()
1141 raid5_release_stripe(sh); in r5l_run_no_space_stripes()
1153 struct stripe_head *sh; in r5c_calculate_new_cp() local
1167 sh = list_first_entry(&conf->log->stripe_in_journal_list, in r5c_calculate_new_cp()
1169 new_cp = sh->log_start; in r5c_calculate_new_cp()
1184 struct stripe_head *sh; in r5l_run_no_mem_stripe() local
1189 sh = list_first_entry(&log->no_mem_stripes, in r5l_run_no_mem_stripe()
1191 list_del_init(&sh->log_list); in r5l_run_no_mem_stripe()
1192 set_bit(STRIPE_HANDLE, &sh->state); in r5l_run_no_mem_stripe()
1193 raid5_release_stripe(sh); in r5l_run_no_mem_stripe()
1243 void r5l_stripe_write_finished(struct stripe_head *sh) in r5l_stripe_write_finished() argument
1247 io = sh->log_io; in r5l_stripe_write_finished()
1248 sh->log_io = NULL; in r5l_stripe_write_finished()
1364 static void r5c_flush_stripe(struct r5conf *conf, struct stripe_head *sh) in r5c_flush_stripe() argument
1366 BUG_ON(list_empty(&sh->lru)); in r5c_flush_stripe()
1367 BUG_ON(!test_bit(STRIPE_R5C_CACHING, &sh->state)); in r5c_flush_stripe()
1368 BUG_ON(test_bit(STRIPE_HANDLE, &sh->state)); in r5c_flush_stripe()
1374 BUG_ON(test_bit(STRIPE_ON_RELEASE_LIST, &sh->state)); in r5c_flush_stripe()
1377 list_del_init(&sh->lru); in r5c_flush_stripe()
1378 atomic_inc(&sh->count); in r5c_flush_stripe()
1380 set_bit(STRIPE_HANDLE, &sh->state); in r5c_flush_stripe()
1382 r5c_make_stripe_write_out(sh); in r5c_flush_stripe()
1384 if (test_bit(STRIPE_R5C_PARTIAL_STRIPE, &sh->state)) in r5c_flush_stripe()
1388 raid5_release_stripe(sh); in r5c_flush_stripe()
1400 struct stripe_head *sh, *next; in r5c_flush_cache() local
1407 list_for_each_entry_safe(sh, next, &conf->r5c_full_stripe_list, lru) { in r5c_flush_cache()
1408 r5c_flush_stripe(conf, sh); in r5c_flush_cache()
1414 list_for_each_entry_safe(sh, next, in r5c_flush_cache()
1416 r5c_flush_stripe(conf, sh); in r5c_flush_cache()
1425 struct stripe_head *sh; in r5c_do_reclaim() local
1470 list_for_each_entry(sh, &log->stripe_in_journal_list, r5c) { in r5c_do_reclaim()
1479 if (!list_empty(&sh->lru) && in r5c_do_reclaim()
1480 !test_bit(STRIPE_HANDLE, &sh->state) && in r5c_do_reclaim()
1481 atomic_read(&sh->count) == 0) { in r5c_do_reclaim()
1482 r5c_flush_stripe(conf, sh); in r5c_do_reclaim()
1803 struct stripe_head *sh, in r5l_recovery_load_data() argument
1814 &dd_idx, sh); in r5l_recovery_load_data()
1815 r5l_recovery_read_page(log, ctx, sh->dev[dd_idx].page, log_offset); in r5l_recovery_load_data()
1816 sh->dev[dd_idx].log_checksum = in r5l_recovery_load_data()
1820 set_bit(R5_Wantwrite, &sh->dev[dd_idx].flags); in r5l_recovery_load_data()
1821 set_bit(STRIPE_R5C_CACHING, &sh->state); in r5l_recovery_load_data()
1825 struct stripe_head *sh, in r5l_recovery_load_parity() argument
1834 r5l_recovery_read_page(log, ctx, sh->dev[sh->pd_idx].page, log_offset); in r5l_recovery_load_parity()
1835 sh->dev[sh->pd_idx].log_checksum = in r5l_recovery_load_parity()
1837 set_bit(R5_Wantwrite, &sh->dev[sh->pd_idx].flags); in r5l_recovery_load_parity()
1839 if (sh->qd_idx >= 0) { in r5l_recovery_load_parity()
1841 log, ctx, sh->dev[sh->qd_idx].page, in r5l_recovery_load_parity()
1843 sh->dev[sh->qd_idx].log_checksum = in r5l_recovery_load_parity()
1845 set_bit(R5_Wantwrite, &sh->dev[sh->qd_idx].flags); in r5l_recovery_load_parity()
1847 clear_bit(STRIPE_R5C_CACHING, &sh->state); in r5l_recovery_load_parity()
1850 static void r5l_recovery_reset_stripe(struct stripe_head *sh) in r5l_recovery_reset_stripe() argument
1854 sh->state = 0; in r5l_recovery_reset_stripe()
1855 sh->log_start = MaxSector; in r5l_recovery_reset_stripe()
1856 for (i = sh->disks; i--; ) in r5l_recovery_reset_stripe()
1857 sh->dev[i].flags = 0; in r5l_recovery_reset_stripe()
1862 struct stripe_head *sh, in r5l_recovery_replay_one_stripe() argument
1869 for (disk_index = 0; disk_index < sh->disks; disk_index++) { in r5l_recovery_replay_one_stripe()
1870 if (!test_bit(R5_Wantwrite, &sh->dev[disk_index].flags)) in r5l_recovery_replay_one_stripe()
1872 if (disk_index == sh->qd_idx || disk_index == sh->pd_idx) in r5l_recovery_replay_one_stripe()
1885 for (disk_index = 0; disk_index < sh->disks; disk_index++) { in r5l_recovery_replay_one_stripe()
1886 if (!test_bit(R5_Wantwrite, &sh->dev[disk_index].flags)) in r5l_recovery_replay_one_stripe()
1895 sync_page_io(rdev, sh->sector, PAGE_SIZE, in r5l_recovery_replay_one_stripe()
1896 sh->dev[disk_index].page, REQ_OP_WRITE, in r5l_recovery_replay_one_stripe()
1905 sync_page_io(rrdev, sh->sector, PAGE_SIZE, in r5l_recovery_replay_one_stripe()
1906 sh->dev[disk_index].page, REQ_OP_WRITE, in r5l_recovery_replay_one_stripe()
1915 r5l_recovery_reset_stripe(sh); in r5l_recovery_replay_one_stripe()
1924 struct stripe_head *sh; in r5c_recovery_alloc_stripe() local
1926 sh = raid5_get_active_stripe(conf, NULL, stripe_sect, in r5c_recovery_alloc_stripe()
1928 if (!sh) in r5c_recovery_alloc_stripe()
1931 r5l_recovery_reset_stripe(sh); in r5c_recovery_alloc_stripe()
1933 return sh; in r5c_recovery_alloc_stripe()
1939 struct stripe_head *sh; in r5c_recovery_lookup_stripe() local
1941 list_for_each_entry(sh, list, lru) in r5c_recovery_lookup_stripe()
1942 if (sh->sector == sect) in r5c_recovery_lookup_stripe()
1943 return sh; in r5c_recovery_lookup_stripe()
1951 struct stripe_head *sh, *next; in r5c_recovery_drop_stripes() local
1953 list_for_each_entry_safe(sh, next, cached_stripe_list, lru) { in r5c_recovery_drop_stripes()
1954 r5l_recovery_reset_stripe(sh); in r5c_recovery_drop_stripes()
1955 list_del_init(&sh->lru); in r5c_recovery_drop_stripes()
1956 raid5_release_stripe(sh); in r5c_recovery_drop_stripes()
1964 struct stripe_head *sh, *next; in r5c_recovery_replay_stripes() local
1966 list_for_each_entry_safe(sh, next, cached_stripe_list, lru) in r5c_recovery_replay_stripes()
1967 if (!test_bit(STRIPE_R5C_CACHING, &sh->state)) { in r5c_recovery_replay_stripes()
1968 r5l_recovery_replay_one_stripe(sh->raid_conf, sh, ctx); in r5c_recovery_replay_stripes()
1969 list_del_init(&sh->lru); in r5c_recovery_replay_stripes()
1970 raid5_release_stripe(sh); in r5c_recovery_replay_stripes()
2081 struct stripe_head *sh; in r5c_recovery_analyze_meta_block() local
2111 sh = r5c_recovery_lookup_stripe(cached_stripe_list, in r5c_recovery_analyze_meta_block()
2113 if (sh) { in r5c_recovery_analyze_meta_block()
2114 WARN_ON(test_bit(STRIPE_R5C_CACHING, &sh->state)); in r5c_recovery_analyze_meta_block()
2115 r5l_recovery_reset_stripe(sh); in r5c_recovery_analyze_meta_block()
2116 list_del_init(&sh->lru); in r5c_recovery_analyze_meta_block()
2117 raid5_release_stripe(sh); in r5c_recovery_analyze_meta_block()
2133 sh = r5c_recovery_lookup_stripe(cached_stripe_list, in r5c_recovery_analyze_meta_block()
2136 if (!sh) { in r5c_recovery_analyze_meta_block()
2137 sh = r5c_recovery_alloc_stripe(conf, stripe_sect, 1); in r5c_recovery_analyze_meta_block()
2142 if (!sh) { in r5c_recovery_analyze_meta_block()
2145 sh = r5c_recovery_alloc_stripe( in r5c_recovery_analyze_meta_block()
2148 if (!sh) { in r5c_recovery_analyze_meta_block()
2163 sh = r5c_recovery_alloc_stripe( in r5c_recovery_analyze_meta_block()
2166 if (!sh) { in r5c_recovery_analyze_meta_block()
2171 list_add_tail(&sh->lru, cached_stripe_list); in r5c_recovery_analyze_meta_block()
2175 if (!test_bit(STRIPE_R5C_CACHING, &sh->state) && in r5c_recovery_analyze_meta_block()
2176 test_bit(R5_Wantwrite, &sh->dev[sh->pd_idx].flags)) { in r5c_recovery_analyze_meta_block()
2177 r5l_recovery_replay_one_stripe(conf, sh, ctx); in r5c_recovery_analyze_meta_block()
2178 list_move_tail(&sh->lru, cached_stripe_list); in r5c_recovery_analyze_meta_block()
2180 r5l_recovery_load_data(log, sh, ctx, payload, in r5c_recovery_analyze_meta_block()
2183 r5l_recovery_load_parity(log, sh, ctx, payload, in r5c_recovery_analyze_meta_block()
2204 struct stripe_head *sh) in r5c_recovery_load_one_stripe() argument
2209 for (i = sh->disks; i--; ) { in r5c_recovery_load_one_stripe()
2210 dev = sh->dev + i; in r5c_recovery_load_one_stripe()
2237 struct stripe_head *sh; in r5c_recovery_flush_log() local
2266 list_for_each_entry(sh, &ctx->cached_list, lru) { in r5c_recovery_flush_log()
2267 WARN_ON(!test_bit(STRIPE_R5C_CACHING, &sh->state)); in r5c_recovery_flush_log()
2268 r5c_recovery_load_one_stripe(log, sh); in r5c_recovery_flush_log()
2348 struct stripe_head *sh; in r5c_recovery_rewrite_data_only_stripes() local
2362 list_for_each_entry(sh, &ctx->cached_list, lru) { in r5c_recovery_rewrite_data_only_stripes()
2368 WARN_ON(!test_bit(STRIPE_R5C_CACHING, &sh->state)); in r5c_recovery_rewrite_data_only_stripes()
2375 for (i = sh->disks; i--; ) { in r5c_recovery_rewrite_data_only_stripes()
2376 struct r5dev *dev = &sh->dev[i]; in r5c_recovery_rewrite_data_only_stripes()
2386 raid5_compute_blocknr(sh, i, 0)); in r5c_recovery_rewrite_data_only_stripes()
2406 sh->log_start = ctx->pos; in r5c_recovery_rewrite_data_only_stripes()
2407 list_add_tail(&sh->r5c, &log->stripe_in_journal_list); in r5c_recovery_rewrite_data_only_stripes()
2411 next_checkpoint = sh->log_start; in r5c_recovery_rewrite_data_only_stripes()
2423 struct stripe_head *sh, *next; in r5c_recovery_flush_data_only_stripes() local
2435 list_for_each_entry_safe(sh, next, &ctx->cached_list, lru) { in r5c_recovery_flush_data_only_stripes()
2436 r5c_make_stripe_write_out(sh); in r5c_recovery_flush_data_only_stripes()
2437 set_bit(STRIPE_HANDLE, &sh->state); in r5c_recovery_flush_data_only_stripes()
2438 list_del_init(&sh->lru); in r5c_recovery_flush_data_only_stripes()
2439 raid5_release_stripe(sh); in r5c_recovery_flush_data_only_stripes()
2633 struct stripe_head *sh, in r5c_try_caching_write() argument
2648 if (!test_bit(STRIPE_R5C_CACHING, &sh->state)) { in r5c_try_caching_write()
2666 set_bit(STRIPE_R5C_CACHING, &sh->state); in r5c_try_caching_write()
2677 if (s->failed || test_bit(STRIPE_SYNCING, &sh->state)) { in r5c_try_caching_write()
2678 r5c_make_stripe_write_out(sh); in r5c_try_caching_write()
2683 dev = &sh->dev[i]; in r5c_try_caching_write()
2687 r5c_make_stripe_write_out(sh); in r5c_try_caching_write()
2693 if (!test_bit(STRIPE_R5C_PARTIAL_STRIPE, &sh->state) && in r5c_try_caching_write()
2694 !test_bit(STRIPE_R5C_FULL_STRIPE, &sh->state)) { in r5c_try_caching_write()
2695 tree_index = r5c_tree_index(conf, sh->sector); in r5c_try_caching_write()
2716 r5c_make_stripe_write_out(sh); in r5c_try_caching_write()
2726 set_bit(STRIPE_R5C_PARTIAL_STRIPE, &sh->state); in r5c_try_caching_write()
2731 dev = &sh->dev[i]; in r5c_try_caching_write()
2747 set_bit(STRIPE_LOG_TRAPPED, &sh->state); in r5c_try_caching_write()
2756 void r5c_release_extra_page(struct stripe_head *sh) in r5c_release_extra_page() argument
2758 struct r5conf *conf = sh->raid_conf; in r5c_release_extra_page()
2763 sh->dev[0].orig_page == conf->disks[0].extra_page; in r5c_release_extra_page()
2765 for (i = sh->disks; i--; ) in r5c_release_extra_page()
2766 if (sh->dev[i].page != sh->dev[i].orig_page) { in r5c_release_extra_page()
2767 struct page *p = sh->dev[i].orig_page; in r5c_release_extra_page()
2769 sh->dev[i].orig_page = sh->dev[i].page; in r5c_release_extra_page()
2770 clear_bit(R5_OrigPageUPTDODATE, &sh->dev[i].flags); in r5c_release_extra_page()
2782 void r5c_use_extra_page(struct stripe_head *sh) in r5c_use_extra_page() argument
2784 struct r5conf *conf = sh->raid_conf; in r5c_use_extra_page()
2788 for (i = sh->disks; i--; ) { in r5c_use_extra_page()
2789 dev = &sh->dev[i]; in r5c_use_extra_page()
2801 struct stripe_head *sh, in r5c_finish_stripe_write_out() argument
2811 if (!log || !test_bit(R5_InJournal, &sh->dev[sh->pd_idx].flags)) in r5c_finish_stripe_write_out()
2814 WARN_ON(test_bit(STRIPE_R5C_CACHING, &sh->state)); in r5c_finish_stripe_write_out()
2815 clear_bit(R5_InJournal, &sh->dev[sh->pd_idx].flags); in r5c_finish_stripe_write_out()
2820 for (i = sh->disks; i--; ) { in r5c_finish_stripe_write_out()
2821 clear_bit(R5_InJournal, &sh->dev[i].flags); in r5c_finish_stripe_write_out()
2822 if (test_and_clear_bit(R5_Overlap, &sh->dev[i].flags)) in r5c_finish_stripe_write_out()
2832 if (test_and_clear_bit(STRIPE_FULL_WRITE, &sh->state)) in r5c_finish_stripe_write_out()
2840 list_del_init(&sh->r5c); in r5c_finish_stripe_write_out()
2842 sh->log_start = MaxSector; in r5c_finish_stripe_write_out()
2848 if (test_bit(STRIPE_R5C_PARTIAL_STRIPE, &sh->state) || in r5c_finish_stripe_write_out()
2849 test_bit(STRIPE_R5C_FULL_STRIPE, &sh->state)) { in r5c_finish_stripe_write_out()
2850 tree_index = r5c_tree_index(conf, sh->sector); in r5c_finish_stripe_write_out()
2867 if (test_and_clear_bit(STRIPE_R5C_PARTIAL_STRIPE, &sh->state)) { in r5c_finish_stripe_write_out()
2873 if (test_and_clear_bit(STRIPE_R5C_FULL_STRIPE, &sh->state)) { in r5c_finish_stripe_write_out()
2879 r5l_append_flush_payload(log, sh->sector); in r5c_finish_stripe_write_out()
2881 if (test_bit(STRIPE_SYNC_REQUESTED, &sh->state)) in r5c_finish_stripe_write_out()
2882 set_bit(STRIPE_HANDLE, &sh->state); in r5c_finish_stripe_write_out()
2885 int r5c_cache_data(struct r5l_log *log, struct stripe_head *sh) in r5c_cache_data() argument
2887 struct r5conf *conf = sh->raid_conf; in r5c_cache_data()
2895 for (i = 0; i < sh->disks; i++) { in r5c_cache_data()
2898 if (!test_bit(R5_Wantwrite, &sh->dev[i].flags)) in r5c_cache_data()
2900 addr = kmap_atomic(sh->dev[i].page); in r5c_cache_data()
2901 sh->dev[i].log_checksum = crc32c_le(log->uuid_checksum, in r5c_cache_data()
2912 clear_bit(STRIPE_DELAYED, &sh->state); in r5c_cache_data()
2913 atomic_inc(&sh->count); in r5c_cache_data()
2920 sh->log_start == MaxSector) in r5c_cache_data()
2921 r5l_add_no_space_stripe(log, sh); in r5c_cache_data()
2923 if (sh->log_start == log->last_checkpoint) in r5c_cache_data()
2926 r5l_add_no_space_stripe(log, sh); in r5c_cache_data()
2928 ret = r5l_log_stripe(log, sh, pages, 0); in r5c_cache_data()
2931 list_add_tail(&sh->log_list, &log->no_mem_stripes); in r5c_cache_data()