Lines Matching full:sh

141 	/* all stripes in r5cache, in the order of seq at sh->log_start */
193 * sect: align_bi->bi_iter.bi_sector or sh->sector
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()
317 sh->sector, RAID5_STRIPE_SECTORS(conf), in r5c_handle_cached_data_endio()
318 !test_bit(STRIPE_DEGRADED, &sh->state), in r5c_handle_cached_data_endio()
452 void r5c_make_stripe_write_out(struct stripe_head *sh) in r5c_make_stripe_write_out() argument
454 struct r5conf *conf = sh->raid_conf; in r5c_make_stripe_write_out()
459 WARN_ON(!test_bit(STRIPE_R5C_CACHING, &sh->state)); in r5c_make_stripe_write_out()
460 clear_bit(STRIPE_R5C_CACHING, &sh->state); in r5c_make_stripe_write_out()
462 if (!test_and_set_bit(STRIPE_PREREAD_ACTIVE, &sh->state)) in r5c_make_stripe_write_out()
466 static void r5c_handle_data_cached(struct stripe_head *sh) in r5c_handle_data_cached() argument
470 for (i = sh->disks; i--; ) in r5c_handle_data_cached()
471 if (test_and_clear_bit(R5_Wantwrite, &sh->dev[i].flags)) { in r5c_handle_data_cached()
472 set_bit(R5_InJournal, &sh->dev[i].flags); in r5c_handle_data_cached()
473 clear_bit(R5_LOCKED, &sh->dev[i].flags); in r5c_handle_data_cached()
475 clear_bit(STRIPE_LOG_TRAPPED, &sh->state); in r5c_handle_data_cached()
482 static void r5c_handle_parity_cached(struct stripe_head *sh) in r5c_handle_parity_cached() argument
486 for (i = sh->disks; i--; ) in r5c_handle_parity_cached()
487 if (test_bit(R5_InJournal, &sh->dev[i].flags)) in r5c_handle_parity_cached()
488 set_bit(R5_Wantwrite, &sh->dev[i].flags); in r5c_handle_parity_cached()
495 static void r5c_finish_cache_stripe(struct stripe_head *sh) in r5c_finish_cache_stripe() argument
497 struct r5l_log *log = READ_ONCE(sh->raid_conf->log); in r5c_finish_cache_stripe()
500 BUG_ON(test_bit(STRIPE_R5C_CACHING, &sh->state)); in r5c_finish_cache_stripe()
507 set_bit(R5_InJournal, &sh->dev[sh->pd_idx].flags); in r5c_finish_cache_stripe()
508 } else if (test_bit(STRIPE_R5C_CACHING, &sh->state)) { in r5c_finish_cache_stripe()
509 r5c_handle_data_cached(sh); in r5c_finish_cache_stripe()
511 r5c_handle_parity_cached(sh); in r5c_finish_cache_stripe()
512 set_bit(R5_InJournal, &sh->dev[sh->pd_idx].flags); in r5c_finish_cache_stripe()
518 struct stripe_head *sh, *next; in r5l_io_run_stripes() local
520 list_for_each_entry_safe(sh, next, &io->stripe_list, log_list) { in r5l_io_run_stripes()
521 list_del_init(&sh->log_list); in r5l_io_run_stripes()
523 r5c_finish_cache_stripe(sh); in r5l_io_run_stripes()
525 set_bit(STRIPE_HANDLE, &sh->state); in r5l_io_run_stripes()
526 raid5_release_stripe(sh); in r5l_io_run_stripes()
903 static int r5l_log_stripe(struct r5l_log *log, struct stripe_head *sh, in r5l_log_stripe() argument
923 if (test_and_clear_bit(STRIPE_R5C_PREFLUSH, &sh->state)) in r5l_log_stripe()
926 for (i = 0; i < sh->disks; i++) { in r5l_log_stripe()
927 if (!test_bit(R5_Wantwrite, &sh->dev[i].flags) || in r5l_log_stripe()
928 test_bit(R5_InJournal, &sh->dev[i].flags)) in r5l_log_stripe()
930 if (i == sh->pd_idx || i == sh->qd_idx) in r5l_log_stripe()
932 if (test_bit(R5_WantFUA, &sh->dev[i].flags) && in r5l_log_stripe()
942 raid5_compute_blocknr(sh, i, 0), in r5l_log_stripe()
943 sh->dev[i].log_checksum, 0, false); in r5l_log_stripe()
944 r5l_append_payload_page(log, sh->dev[i].page); in r5l_log_stripe()
949 sh->sector, sh->dev[sh->pd_idx].log_checksum, in r5l_log_stripe()
950 sh->dev[sh->qd_idx].log_checksum, true); in r5l_log_stripe()
951 r5l_append_payload_page(log, sh->dev[sh->pd_idx].page); in r5l_log_stripe()
952 r5l_append_payload_page(log, sh->dev[sh->qd_idx].page); in r5l_log_stripe()
955 sh->sector, sh->dev[sh->pd_idx].log_checksum, in r5l_log_stripe()
957 r5l_append_payload_page(log, sh->dev[sh->pd_idx].page); in r5l_log_stripe()
961 list_add_tail(&sh->log_list, &io->stripe_list); in r5l_log_stripe()
963 sh->log_io = io; in r5l_log_stripe()
968 if (sh->log_start == MaxSector) { in r5l_log_stripe()
969 BUG_ON(!list_empty(&sh->r5c)); in r5l_log_stripe()
970 sh->log_start = io->log_start; in r5l_log_stripe()
972 list_add_tail(&sh->r5c, in r5l_log_stripe()
982 struct stripe_head *sh) in r5l_add_no_space_stripe() argument
985 list_add_tail(&sh->log_list, &log->no_space_stripes); in r5l_add_no_space_stripe()
993 int r5l_write_stripe(struct r5l_log *log, struct stripe_head *sh) in r5l_write_stripe() argument
995 struct r5conf *conf = sh->raid_conf; in r5l_write_stripe()
1006 if (sh->log_io || !test_bit(R5_Wantwrite, &sh->dev[sh->pd_idx].flags) || in r5l_write_stripe()
1007 test_bit(STRIPE_SYNCING, &sh->state)) { in r5l_write_stripe()
1009 clear_bit(STRIPE_LOG_TRAPPED, &sh->state); in r5l_write_stripe()
1013 WARN_ON(test_bit(STRIPE_R5C_CACHING, &sh->state)); in r5l_write_stripe()
1015 for (i = 0; i < sh->disks; i++) { in r5l_write_stripe()
1018 if (!test_bit(R5_Wantwrite, &sh->dev[i].flags) || in r5l_write_stripe()
1019 test_bit(R5_InJournal, &sh->dev[i].flags)) in r5l_write_stripe()
1024 if (test_bit(STRIPE_LOG_TRAPPED, &sh->state)) in r5l_write_stripe()
1026 addr = kmap_atomic(sh->dev[i].page); in r5l_write_stripe()
1027 sh->dev[i].log_checksum = crc32c_le(log->uuid_checksum, in r5l_write_stripe()
1031 parity_pages = 1 + !!(sh->qd_idx >= 0); in r5l_write_stripe()
1034 set_bit(STRIPE_LOG_TRAPPED, &sh->state); in r5l_write_stripe()
1039 clear_bit(STRIPE_DELAYED, &sh->state); in r5l_write_stripe()
1040 atomic_inc(&sh->count); in r5l_write_stripe()
1048 r5l_add_no_space_stripe(log, sh); in r5l_write_stripe()
1051 ret = r5l_log_stripe(log, sh, data_pages, parity_pages); in r5l_write_stripe()
1054 list_add_tail(&sh->log_list, in r5l_write_stripe()
1062 * not in cache yet (sh->log_start == MaxSector). in r5l_write_stripe()
1065 sh->log_start == MaxSector) { in r5l_write_stripe()
1066 r5l_add_no_space_stripe(log, sh); in r5l_write_stripe()
1070 if (sh->log_start == log->last_checkpoint) in r5l_write_stripe()
1073 r5l_add_no_space_stripe(log, sh); in r5l_write_stripe()
1075 ret = r5l_log_stripe(log, sh, data_pages, parity_pages); in r5l_write_stripe()
1078 list_add_tail(&sh->log_list, in r5l_write_stripe()
1135 struct stripe_head *sh; in r5l_run_no_space_stripes() local
1139 sh = list_first_entry(&log->no_space_stripes, in r5l_run_no_space_stripes()
1141 list_del_init(&sh->log_list); in r5l_run_no_space_stripes()
1142 set_bit(STRIPE_HANDLE, &sh->state); in r5l_run_no_space_stripes()
1143 raid5_release_stripe(sh); in r5l_run_no_space_stripes()
1151 * for write back, returns log_start of first sh in stripe_in_journal_list
1155 struct stripe_head *sh; in r5c_calculate_new_cp() local
1169 sh = list_first_entry(&log->stripe_in_journal_list, in r5c_calculate_new_cp()
1171 new_cp = sh->log_start; in r5c_calculate_new_cp()
1186 struct stripe_head *sh; in r5l_run_no_mem_stripe() local
1191 sh = list_first_entry(&log->no_mem_stripes, in r5l_run_no_mem_stripe()
1193 list_del_init(&sh->log_list); in r5l_run_no_mem_stripe()
1194 set_bit(STRIPE_HANDLE, &sh->state); in r5l_run_no_mem_stripe()
1195 raid5_release_stripe(sh); in r5l_run_no_mem_stripe()
1245 void r5l_stripe_write_finished(struct stripe_head *sh) in r5l_stripe_write_finished() argument
1249 io = sh->log_io; in r5l_stripe_write_finished()
1250 sh->log_io = NULL; in r5l_stripe_write_finished()
1365 static void r5c_flush_stripe(struct r5conf *conf, struct stripe_head *sh) in r5c_flush_stripe() argument
1367 BUG_ON(list_empty(&sh->lru)); in r5c_flush_stripe()
1368 BUG_ON(!test_bit(STRIPE_R5C_CACHING, &sh->state)); in r5c_flush_stripe()
1369 BUG_ON(test_bit(STRIPE_HANDLE, &sh->state)); in r5c_flush_stripe()
1375 BUG_ON(test_bit(STRIPE_ON_RELEASE_LIST, &sh->state)); in r5c_flush_stripe()
1378 list_del_init(&sh->lru); in r5c_flush_stripe()
1379 atomic_inc(&sh->count); in r5c_flush_stripe()
1381 set_bit(STRIPE_HANDLE, &sh->state); in r5c_flush_stripe()
1383 r5c_make_stripe_write_out(sh); in r5c_flush_stripe()
1385 if (test_bit(STRIPE_R5C_PARTIAL_STRIPE, &sh->state)) in r5c_flush_stripe()
1389 raid5_release_stripe(sh); in r5c_flush_stripe()
1401 struct stripe_head *sh, *next; in r5c_flush_cache() local
1408 list_for_each_entry_safe(sh, next, &conf->r5c_full_stripe_list, lru) { in r5c_flush_cache()
1409 r5c_flush_stripe(conf, sh); in r5c_flush_cache()
1415 list_for_each_entry_safe(sh, next, in r5c_flush_cache()
1417 r5c_flush_stripe(conf, sh); in r5c_flush_cache()
1426 struct stripe_head *sh; in r5c_do_reclaim() local
1471 list_for_each_entry(sh, &log->stripe_in_journal_list, r5c) { in r5c_do_reclaim()
1480 if (!list_empty(&sh->lru) && in r5c_do_reclaim()
1481 !test_bit(STRIPE_HANDLE, &sh->state) && in r5c_do_reclaim()
1482 atomic_read(&sh->count) == 0) { in r5c_do_reclaim()
1483 r5c_flush_stripe(conf, sh); in r5c_do_reclaim()
1806 struct stripe_head *sh, in r5l_recovery_load_data() argument
1817 &dd_idx, sh); in r5l_recovery_load_data()
1818 r5l_recovery_read_page(log, ctx, sh->dev[dd_idx].page, log_offset); in r5l_recovery_load_data()
1819 sh->dev[dd_idx].log_checksum = in r5l_recovery_load_data()
1823 set_bit(R5_Wantwrite, &sh->dev[dd_idx].flags); in r5l_recovery_load_data()
1824 set_bit(STRIPE_R5C_CACHING, &sh->state); in r5l_recovery_load_data()
1828 struct stripe_head *sh, in r5l_recovery_load_parity() argument
1837 r5l_recovery_read_page(log, ctx, sh->dev[sh->pd_idx].page, log_offset); in r5l_recovery_load_parity()
1838 sh->dev[sh->pd_idx].log_checksum = in r5l_recovery_load_parity()
1840 set_bit(R5_Wantwrite, &sh->dev[sh->pd_idx].flags); in r5l_recovery_load_parity()
1842 if (sh->qd_idx >= 0) { in r5l_recovery_load_parity()
1844 log, ctx, sh->dev[sh->qd_idx].page, in r5l_recovery_load_parity()
1846 sh->dev[sh->qd_idx].log_checksum = in r5l_recovery_load_parity()
1848 set_bit(R5_Wantwrite, &sh->dev[sh->qd_idx].flags); in r5l_recovery_load_parity()
1850 clear_bit(STRIPE_R5C_CACHING, &sh->state); in r5l_recovery_load_parity()
1853 static void r5l_recovery_reset_stripe(struct stripe_head *sh) in r5l_recovery_reset_stripe() argument
1857 sh->state = 0; in r5l_recovery_reset_stripe()
1858 sh->log_start = MaxSector; in r5l_recovery_reset_stripe()
1859 for (i = sh->disks; i--; ) in r5l_recovery_reset_stripe()
1860 sh->dev[i].flags = 0; in r5l_recovery_reset_stripe()
1865 struct stripe_head *sh, in r5l_recovery_replay_one_stripe() argument
1872 for (disk_index = 0; disk_index < sh->disks; disk_index++) { in r5l_recovery_replay_one_stripe()
1873 if (!test_bit(R5_Wantwrite, &sh->dev[disk_index].flags)) in r5l_recovery_replay_one_stripe()
1875 if (disk_index == sh->qd_idx || disk_index == sh->pd_idx) in r5l_recovery_replay_one_stripe()
1888 for (disk_index = 0; disk_index < sh->disks; disk_index++) { in r5l_recovery_replay_one_stripe()
1889 if (!test_bit(R5_Wantwrite, &sh->dev[disk_index].flags)) in r5l_recovery_replay_one_stripe()
1896 sync_page_io(rdev, sh->sector, PAGE_SIZE, in r5l_recovery_replay_one_stripe()
1897 sh->dev[disk_index].page, REQ_OP_WRITE, in r5l_recovery_replay_one_stripe()
1904 sync_page_io(rrdev, sh->sector, PAGE_SIZE, in r5l_recovery_replay_one_stripe()
1905 sh->dev[disk_index].page, REQ_OP_WRITE, in r5l_recovery_replay_one_stripe()
1912 r5l_recovery_reset_stripe(sh); in r5l_recovery_replay_one_stripe()
1921 struct stripe_head *sh; in r5c_recovery_alloc_stripe() local
1923 sh = raid5_get_active_stripe(conf, NULL, stripe_sect, in r5c_recovery_alloc_stripe()
1925 if (!sh) in r5c_recovery_alloc_stripe()
1928 r5l_recovery_reset_stripe(sh); in r5c_recovery_alloc_stripe()
1930 return sh; in r5c_recovery_alloc_stripe()
1936 struct stripe_head *sh; in r5c_recovery_lookup_stripe() local
1938 list_for_each_entry(sh, list, lru) in r5c_recovery_lookup_stripe()
1939 if (sh->sector == sect) in r5c_recovery_lookup_stripe()
1940 return sh; in r5c_recovery_lookup_stripe()
1948 struct stripe_head *sh, *next; in r5c_recovery_drop_stripes() local
1950 list_for_each_entry_safe(sh, next, cached_stripe_list, lru) { in r5c_recovery_drop_stripes()
1951 r5l_recovery_reset_stripe(sh); in r5c_recovery_drop_stripes()
1952 list_del_init(&sh->lru); in r5c_recovery_drop_stripes()
1953 raid5_release_stripe(sh); in r5c_recovery_drop_stripes()
1961 struct stripe_head *sh, *next; in r5c_recovery_replay_stripes() local
1963 list_for_each_entry_safe(sh, next, cached_stripe_list, lru) in r5c_recovery_replay_stripes()
1964 if (!test_bit(STRIPE_R5C_CACHING, &sh->state)) { in r5c_recovery_replay_stripes()
1965 r5l_recovery_replay_one_stripe(sh->raid_conf, sh, ctx); in r5c_recovery_replay_stripes()
1966 list_del_init(&sh->lru); in r5c_recovery_replay_stripes()
1967 raid5_release_stripe(sh); in r5c_recovery_replay_stripes()
2078 struct stripe_head *sh; in r5c_recovery_analyze_meta_block() local
2108 sh = r5c_recovery_lookup_stripe(cached_stripe_list, in r5c_recovery_analyze_meta_block()
2110 if (sh) { in r5c_recovery_analyze_meta_block()
2111 WARN_ON(test_bit(STRIPE_R5C_CACHING, &sh->state)); in r5c_recovery_analyze_meta_block()
2112 r5l_recovery_reset_stripe(sh); in r5c_recovery_analyze_meta_block()
2113 list_del_init(&sh->lru); in r5c_recovery_analyze_meta_block()
2114 raid5_release_stripe(sh); in r5c_recovery_analyze_meta_block()
2130 sh = r5c_recovery_lookup_stripe(cached_stripe_list, in r5c_recovery_analyze_meta_block()
2133 if (!sh) { in r5c_recovery_analyze_meta_block()
2134 sh = r5c_recovery_alloc_stripe(conf, stripe_sect, 1); in r5c_recovery_analyze_meta_block()
2139 if (!sh) { in r5c_recovery_analyze_meta_block()
2142 sh = r5c_recovery_alloc_stripe( in r5c_recovery_analyze_meta_block()
2145 if (!sh) { in r5c_recovery_analyze_meta_block()
2160 sh = r5c_recovery_alloc_stripe( in r5c_recovery_analyze_meta_block()
2163 if (!sh) { in r5c_recovery_analyze_meta_block()
2168 list_add_tail(&sh->lru, cached_stripe_list); in r5c_recovery_analyze_meta_block()
2172 if (!test_bit(STRIPE_R5C_CACHING, &sh->state) && in r5c_recovery_analyze_meta_block()
2173 test_bit(R5_Wantwrite, &sh->dev[sh->pd_idx].flags)) { in r5c_recovery_analyze_meta_block()
2174 r5l_recovery_replay_one_stripe(conf, sh, ctx); in r5c_recovery_analyze_meta_block()
2175 list_move_tail(&sh->lru, cached_stripe_list); in r5c_recovery_analyze_meta_block()
2177 r5l_recovery_load_data(log, sh, ctx, payload, in r5c_recovery_analyze_meta_block()
2180 r5l_recovery_load_parity(log, sh, ctx, payload, in r5c_recovery_analyze_meta_block()
2201 struct stripe_head *sh) in r5c_recovery_load_one_stripe() argument
2206 for (i = sh->disks; i--; ) { in r5c_recovery_load_one_stripe()
2207 dev = sh->dev + i; in r5c_recovery_load_one_stripe()
2234 struct stripe_head *sh; in r5c_recovery_flush_log() local
2263 list_for_each_entry(sh, &ctx->cached_list, lru) { in r5c_recovery_flush_log()
2264 WARN_ON(!test_bit(STRIPE_R5C_CACHING, &sh->state)); in r5c_recovery_flush_log()
2265 r5c_recovery_load_one_stripe(log, sh); in r5c_recovery_flush_log()
2345 struct stripe_head *sh; in r5c_recovery_rewrite_data_only_stripes() local
2359 list_for_each_entry(sh, &ctx->cached_list, lru) { in r5c_recovery_rewrite_data_only_stripes()
2365 WARN_ON(!test_bit(STRIPE_R5C_CACHING, &sh->state)); in r5c_recovery_rewrite_data_only_stripes()
2372 for (i = sh->disks; i--; ) { in r5c_recovery_rewrite_data_only_stripes()
2373 struct r5dev *dev = &sh->dev[i]; in r5c_recovery_rewrite_data_only_stripes()
2383 raid5_compute_blocknr(sh, i, 0)); in r5c_recovery_rewrite_data_only_stripes()
2403 sh->log_start = ctx->pos; in r5c_recovery_rewrite_data_only_stripes()
2404 list_add_tail(&sh->r5c, &log->stripe_in_journal_list); in r5c_recovery_rewrite_data_only_stripes()
2408 next_checkpoint = sh->log_start; in r5c_recovery_rewrite_data_only_stripes()
2420 struct stripe_head *sh, *next; in r5c_recovery_flush_data_only_stripes() local
2432 list_for_each_entry_safe(sh, next, &ctx->cached_list, lru) { in r5c_recovery_flush_data_only_stripes()
2433 r5c_make_stripe_write_out(sh); in r5c_recovery_flush_data_only_stripes()
2434 set_bit(STRIPE_HANDLE, &sh->state); in r5c_recovery_flush_data_only_stripes()
2435 list_del_init(&sh->lru); in r5c_recovery_flush_data_only_stripes()
2436 raid5_release_stripe(sh); in r5c_recovery_flush_data_only_stripes()
2628 struct stripe_head *sh, in r5c_try_caching_write() argument
2643 if (!test_bit(STRIPE_R5C_CACHING, &sh->state)) { in r5c_try_caching_write()
2661 set_bit(STRIPE_R5C_CACHING, &sh->state); in r5c_try_caching_write()
2672 if (s->failed || test_bit(STRIPE_SYNCING, &sh->state)) { in r5c_try_caching_write()
2673 r5c_make_stripe_write_out(sh); in r5c_try_caching_write()
2678 dev = &sh->dev[i]; in r5c_try_caching_write()
2682 r5c_make_stripe_write_out(sh); in r5c_try_caching_write()
2688 if (!test_bit(STRIPE_R5C_PARTIAL_STRIPE, &sh->state) && in r5c_try_caching_write()
2689 !test_bit(STRIPE_R5C_FULL_STRIPE, &sh->state)) { in r5c_try_caching_write()
2690 tree_index = r5c_tree_index(conf, sh->sector); in r5c_try_caching_write()
2711 r5c_make_stripe_write_out(sh); in r5c_try_caching_write()
2721 set_bit(STRIPE_R5C_PARTIAL_STRIPE, &sh->state); in r5c_try_caching_write()
2726 dev = &sh->dev[i]; in r5c_try_caching_write()
2742 set_bit(STRIPE_LOG_TRAPPED, &sh->state); in r5c_try_caching_write()
2751 void r5c_release_extra_page(struct stripe_head *sh) in r5c_release_extra_page() argument
2753 struct r5conf *conf = sh->raid_conf; in r5c_release_extra_page()
2758 sh->dev[0].orig_page == conf->disks[0].extra_page; in r5c_release_extra_page()
2760 for (i = sh->disks; i--; ) in r5c_release_extra_page()
2761 if (sh->dev[i].page != sh->dev[i].orig_page) { in r5c_release_extra_page()
2762 struct page *p = sh->dev[i].orig_page; in r5c_release_extra_page()
2764 sh->dev[i].orig_page = sh->dev[i].page; in r5c_release_extra_page()
2765 clear_bit(R5_OrigPageUPTDODATE, &sh->dev[i].flags); in r5c_release_extra_page()
2777 void r5c_use_extra_page(struct stripe_head *sh) in r5c_use_extra_page() argument
2779 struct r5conf *conf = sh->raid_conf; in r5c_use_extra_page()
2783 for (i = sh->disks; i--; ) { in r5c_use_extra_page()
2784 dev = &sh->dev[i]; in r5c_use_extra_page()
2796 struct stripe_head *sh, in r5c_finish_stripe_write_out() argument
2805 if (!log || !test_bit(R5_InJournal, &sh->dev[sh->pd_idx].flags)) in r5c_finish_stripe_write_out()
2808 WARN_ON(test_bit(STRIPE_R5C_CACHING, &sh->state)); in r5c_finish_stripe_write_out()
2809 clear_bit(R5_InJournal, &sh->dev[sh->pd_idx].flags); in r5c_finish_stripe_write_out()
2814 for (i = sh->disks; i--; ) { in r5c_finish_stripe_write_out()
2815 clear_bit(R5_InJournal, &sh->dev[i].flags); in r5c_finish_stripe_write_out()
2816 if (test_and_clear_bit(R5_Overlap, &sh->dev[i].flags)) in r5c_finish_stripe_write_out()
2817 wake_up_bit(&sh->dev[i].flags, R5_Overlap); in r5c_finish_stripe_write_out()
2826 if (test_and_clear_bit(STRIPE_FULL_WRITE, &sh->state)) in r5c_finish_stripe_write_out()
2831 list_del_init(&sh->r5c); in r5c_finish_stripe_write_out()
2833 sh->log_start = MaxSector; in r5c_finish_stripe_write_out()
2839 if (test_bit(STRIPE_R5C_PARTIAL_STRIPE, &sh->state) || in r5c_finish_stripe_write_out()
2840 test_bit(STRIPE_R5C_FULL_STRIPE, &sh->state)) { in r5c_finish_stripe_write_out()
2841 tree_index = r5c_tree_index(conf, sh->sector); in r5c_finish_stripe_write_out()
2858 if (test_and_clear_bit(STRIPE_R5C_PARTIAL_STRIPE, &sh->state)) { in r5c_finish_stripe_write_out()
2864 if (test_and_clear_bit(STRIPE_R5C_FULL_STRIPE, &sh->state)) { in r5c_finish_stripe_write_out()
2870 r5l_append_flush_payload(log, sh->sector); in r5c_finish_stripe_write_out()
2872 if (test_bit(STRIPE_SYNC_REQUESTED, &sh->state)) in r5c_finish_stripe_write_out()
2873 set_bit(STRIPE_HANDLE, &sh->state); in r5c_finish_stripe_write_out()
2876 int r5c_cache_data(struct r5l_log *log, struct stripe_head *sh) in r5c_cache_data() argument
2878 struct r5conf *conf = sh->raid_conf; in r5c_cache_data()
2886 for (i = 0; i < sh->disks; i++) { in r5c_cache_data()
2889 if (!test_bit(R5_Wantwrite, &sh->dev[i].flags)) in r5c_cache_data()
2891 addr = kmap_atomic(sh->dev[i].page); in r5c_cache_data()
2892 sh->dev[i].log_checksum = crc32c_le(log->uuid_checksum, in r5c_cache_data()
2903 clear_bit(STRIPE_DELAYED, &sh->state); in r5c_cache_data()
2904 atomic_inc(&sh->count); in r5c_cache_data()
2911 sh->log_start == MaxSector) in r5c_cache_data()
2912 r5l_add_no_space_stripe(log, sh); in r5c_cache_data()
2914 if (sh->log_start == log->last_checkpoint) in r5c_cache_data()
2917 r5l_add_no_space_stripe(log, sh); in r5c_cache_data()
2919 ret = r5l_log_stripe(log, sh, pages, 0); in r5c_cache_data()
2922 list_add_tail(&sh->log_list, &log->no_mem_stripes); in r5c_cache_data()