A data compression method for supporting data integrity field, DIF, in processes of storage and/or transmission, wherein the method comprises: obtaining N to-be-compressed data blocks and N pieces of protection information, PI, for ensuring integrity of the N to-be-compressed data blocks, wherein the N to-be-compressed data blocks are in a one-to-one correspondence with the N pieces of PI, and N is a positive integer greater than or equal to 2; compressing the N to-be-compressed data blocks to obtain a compressed data block; and compressing the N pieces of PI to obtain compressed PI, wherein the N to-be-compressed data blocks and the N pieces of PI are separately compressed to separately obtain the compressed data block and the compressed PI, wherein the compressing the N to-be-compressed data blocks to obtain the compressed data block and the compressing the N pieces of PI to obtain the compressed PI comprise: obtaining M to-be-compressed data blocks and M pieces of PI, wherein the M to-be-compressed data blocks are in a one-to-one correspondence with the M pieces of PI, the M to-be-compressed data blocks comprise the N to-be-compressed data blocks, the M pieces of PI comprise the N pieces of PI, and M is a positive integer greater than or equal to N; determining whether the M to-be-compressed data blocks comprise a redundant to-be-compressed data block; and when the M to-be-compressed data blocks comprise the redundant to-be-compressed data block, deleting the redundant to-be-compressed data block from the M to-be-compressed data blocks to obtain the N to-be-compressed data blocks, and deleting, from the M pieces of PI, a piece of PI corresponding to the redundant to-be-compressed data block, to obtain the N pieces of PI, wherein when the M to-be-compressed data blocks do not comprise the redundant to-be-compressed data block, the M to-be-compressed data blocks are the N to-be-compressed data blocks, and the M pieces of PI are the N pieces of PI. obtaining N to-be-compressed data blocks and N pieces of protection information, PI, for ensuring integrity of the N to-be-compressed data blocks, wherein the N to-be-compressed data blocks are in a one-to-one correspondence with the N pieces of PI, and N is a positive integer greater than or equal to 2; compressing the N to-be-compressed data blocks to obtain a compressed data block; and compressing the N pieces of PI to obtain compressed PI, wherein the N to-be-compressed data blocks and the N pieces of PI are separately compressed to separately obtain the compressed data block and the compressed PI, wherein the compressing the N to-be-compressed data blocks to obtain the compressed data block and the compressing the N pieces of PI to obtain the compressed PI comprise: obtaining M to-be-compressed data blocks and M pieces of PI, wherein the M to-be-compressed data blocks are in a one-to-one correspondence with the M pieces of PI, the M to-be-compressed data blocks comprise the N to-be-compressed data blocks, the M pieces of PI comprise the N pieces of PI, and M is a positive integer greater than or equal to N; determining whether the M to-be-compressed data blocks comprise a redundant to-be-compressed data block; and when the M to-be-compressed data blocks comprise the redundant to-be-compressed data block, deleting the redundant to-be-compressed data block from the M to-be-compressed data blocks to obtain the N to-be-compressed data blocks, and deleting, from the M pieces of PI, a piece of PI corresponding to the redundant to-be-compressed data block, to obtain the N pieces of PI, wherein when the M to-be-compressed data blocks do not comprise the redundant to-be-compressed data block, the M to-be-compressed data blocks are the N to-be-compressed data blocks, and the M pieces of PI are the N pieces of PI. obtaining M to-be-compressed data blocks and M pieces of PI, wherein the M to-be-compressed data blocks are in a one-to-one correspondence with the M pieces of PI, the M to-be-compressed data blocks comprise the N to-be-compressed data blocks, the M pieces of PI comprise the N pieces of PI, and M is a positive integer greater than or equal to N; determining whether the M to-be-compressed data blocks comprise a redundant to-be-compressed data block; and when the M to-be-compressed data blocks comprise the redundant to-be-compressed data block, deleting the redundant to-be-compressed data block from the M to-be-compressed data blocks to obtain the N to-be-compressed data blocks, and deleting, from the M pieces of PI, a piece of PI corresponding to the redundant to-be-compressed data block, to obtain the N pieces of PI, wherein when the M to-be-compressed data blocks do not comprise the redundant to-be-compressed data block, the M to-be-compressed data blocks are the N to-be-compressed data blocks, and the M pieces of PI are the N pieces of PI.