raid5-ppl.c (f83d9396d1f63048c423efa00e4e244da10a35fd) raid5-ppl.c (4ce4c73f662bdb0ae5bfb058bc7ec6f6829ca078)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Partial Parity Log for closing the RAID5 write hole
4 * Copyright (c) 2017, Intel Corporation.
5 */
6
7#include <linux/kernel.h>
8#include <linux/blkdev.h>

--- 883 unchanged lines hidden (view full) ---

892 update_parity = false;
893 break;
894 }
895
896 pr_debug("%s:%*s reading data member disk %pg sector %llu\n",
897 __func__, indent, "", rdev->bdev,
898 (unsigned long long)sector);
899 if (!sync_page_io(rdev, sector, block_size, page2,
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Partial Parity Log for closing the RAID5 write hole
4 * Copyright (c) 2017, Intel Corporation.
5 */
6
7#include <linux/kernel.h>
8#include <linux/blkdev.h>

--- 883 unchanged lines hidden (view full) ---

892 update_parity = false;
893 break;
894 }
895
896 pr_debug("%s:%*s reading data member disk %pg sector %llu\n",
897 __func__, indent, "", rdev->bdev,
898 (unsigned long long)sector);
899 if (!sync_page_io(rdev, sector, block_size, page2,
900 REQ_OP_READ, 0, false)) {
900 REQ_OP_READ, false)) {
901 md_error(mddev, rdev);
902 pr_debug("%s:%*s read failed!\n", __func__,
903 indent, "");
904 ret = -EIO;
905 goto out;
906 }
907
908 ppl_xor(block_size, page1, page2);

--- 5 unchanged lines hidden (view full) ---

914 continue;
915
916 if (pp_size > 0) {
917 pr_debug("%s:%*s reading pp disk sector %llu\n",
918 __func__, indent, "",
919 (unsigned long long)(ppl_sector + i));
920 if (!sync_page_io(log->rdev,
921 ppl_sector - log->rdev->data_offset + i,
901 md_error(mddev, rdev);
902 pr_debug("%s:%*s read failed!\n", __func__,
903 indent, "");
904 ret = -EIO;
905 goto out;
906 }
907
908 ppl_xor(block_size, page1, page2);

--- 5 unchanged lines hidden (view full) ---

914 continue;
915
916 if (pp_size > 0) {
917 pr_debug("%s:%*s reading pp disk sector %llu\n",
918 __func__, indent, "",
919 (unsigned long long)(ppl_sector + i));
920 if (!sync_page_io(log->rdev,
921 ppl_sector - log->rdev->data_offset + i,
922 block_size, page2, REQ_OP_READ, 0,
922 block_size, page2, REQ_OP_READ,
923 false)) {
924 pr_debug("%s:%*s read failed!\n", __func__,
925 indent, "");
926 md_error(mddev, log->rdev);
927 ret = -EIO;
928 goto out;
929 }
930

--- 10 unchanged lines hidden (view full) ---

941 conf->disks[sh.pd_idx].rdev, 1);
942
943 BUG_ON(parity_rdev->bdev->bd_dev != log->rdev->bdev->bd_dev);
944 pr_debug("%s:%*s write parity at sector %llu, disk %pg\n",
945 __func__, indent, "",
946 (unsigned long long)parity_sector,
947 parity_rdev->bdev);
948 if (!sync_page_io(parity_rdev, parity_sector, block_size,
923 false)) {
924 pr_debug("%s:%*s read failed!\n", __func__,
925 indent, "");
926 md_error(mddev, log->rdev);
927 ret = -EIO;
928 goto out;
929 }
930

--- 10 unchanged lines hidden (view full) ---

941 conf->disks[sh.pd_idx].rdev, 1);
942
943 BUG_ON(parity_rdev->bdev->bd_dev != log->rdev->bdev->bd_dev);
944 pr_debug("%s:%*s write parity at sector %llu, disk %pg\n",
945 __func__, indent, "",
946 (unsigned long long)parity_sector,
947 parity_rdev->bdev);
948 if (!sync_page_io(parity_rdev, parity_sector, block_size,
949 page1, REQ_OP_WRITE, 0, false)) {
949 page1, REQ_OP_WRITE, false)) {
950 pr_debug("%s:%*s parity write error!\n", __func__,
951 indent, "");
952 md_error(mddev, parity_rdev);
953 ret = -EIO;
954 goto out;
955 }
956 }
957out:

--- 35 unchanged lines hidden (view full) ---

993 crc = ~0;
994 crc_stored = le32_to_cpu(e->checksum);
995
996 /* read parial parity for this entry and calculate its checksum */
997 while (pp_size) {
998 int s = pp_size > PAGE_SIZE ? PAGE_SIZE : pp_size;
999
1000 if (!sync_page_io(rdev, sector - rdev->data_offset,
950 pr_debug("%s:%*s parity write error!\n", __func__,
951 indent, "");
952 md_error(mddev, parity_rdev);
953 ret = -EIO;
954 goto out;
955 }
956 }
957out:

--- 35 unchanged lines hidden (view full) ---

993 crc = ~0;
994 crc_stored = le32_to_cpu(e->checksum);
995
996 /* read parial parity for this entry and calculate its checksum */
997 while (pp_size) {
998 int s = pp_size > PAGE_SIZE ? PAGE_SIZE : pp_size;
999
1000 if (!sync_page_io(rdev, sector - rdev->data_offset,
1001 s, page, REQ_OP_READ, 0, false)) {
1001 s, page, REQ_OP_READ, false)) {
1002 md_error(mddev, rdev);
1003 ret = -EIO;
1004 goto out;
1005 }
1006
1007 crc = crc32c_le(crc, page_address(page), s);
1008
1009 pp_size -= s;

--- 47 unchanged lines hidden (view full) ---

1057 blkdev_issue_zeroout(rdev->bdev, rdev->ppl.sector,
1058 log->rdev->ppl.size, GFP_NOIO, 0);
1059 memset(pplhdr->reserved, 0xff, PPL_HDR_RESERVED);
1060 pplhdr->signature = cpu_to_le32(log->ppl_conf->signature);
1061 pplhdr->checksum = cpu_to_le32(~crc32c_le(~0, pplhdr, PAGE_SIZE));
1062
1063 if (!sync_page_io(rdev, rdev->ppl.sector - rdev->data_offset,
1064 PPL_HEADER_SIZE, page, REQ_OP_WRITE | REQ_SYNC |
1002 md_error(mddev, rdev);
1003 ret = -EIO;
1004 goto out;
1005 }
1006
1007 crc = crc32c_le(crc, page_address(page), s);
1008
1009 pp_size -= s;

--- 47 unchanged lines hidden (view full) ---

1057 blkdev_issue_zeroout(rdev->bdev, rdev->ppl.sector,
1058 log->rdev->ppl.size, GFP_NOIO, 0);
1059 memset(pplhdr->reserved, 0xff, PPL_HDR_RESERVED);
1060 pplhdr->signature = cpu_to_le32(log->ppl_conf->signature);
1061 pplhdr->checksum = cpu_to_le32(~crc32c_le(~0, pplhdr, PAGE_SIZE));
1062
1063 if (!sync_page_io(rdev, rdev->ppl.sector - rdev->data_offset,
1064 PPL_HEADER_SIZE, page, REQ_OP_WRITE | REQ_SYNC |
1065 REQ_FUA, 0, false)) {
1065 REQ_FUA, false)) {
1066 md_error(rdev->mddev, rdev);
1067 ret = -EIO;
1068 }
1069
1070 __free_page(page);
1071 return ret;
1072}
1073

--- 21 unchanged lines hidden (view full) ---

1095 return -ENOMEM;
1096 }
1097
1098 /* searching ppl area for latest ppl */
1099 while (pplhdr_offset < rdev->ppl.size - (PPL_HEADER_SIZE >> 9)) {
1100 if (!sync_page_io(rdev,
1101 rdev->ppl.sector - rdev->data_offset +
1102 pplhdr_offset, PAGE_SIZE, page, REQ_OP_READ,
1066 md_error(rdev->mddev, rdev);
1067 ret = -EIO;
1068 }
1069
1070 __free_page(page);
1071 return ret;
1072}
1073

--- 21 unchanged lines hidden (view full) ---

1095 return -ENOMEM;
1096 }
1097
1098 /* searching ppl area for latest ppl */
1099 while (pplhdr_offset < rdev->ppl.size - (PPL_HEADER_SIZE >> 9)) {
1100 if (!sync_page_io(rdev,
1101 rdev->ppl.sector - rdev->data_offset +
1102 pplhdr_offset, PAGE_SIZE, page, REQ_OP_READ,
1103 0, false)) {
1103 false)) {
1104 md_error(mddev, rdev);
1105 ret = -EIO;
1106 /* if not able to read - don't recover any PPL */
1107 pplhdr = NULL;
1108 break;
1109 }
1110 pplhdr = page_address(page);
1111

--- 421 unchanged lines hidden ---
1104 md_error(mddev, rdev);
1105 ret = -EIO;
1106 /* if not able to read - don't recover any PPL */
1107 pplhdr = NULL;
1108 break;
1109 }
1110 pplhdr = page_address(page);
1111

--- 421 unchanged lines hidden ---