On Wed, May 04, 2022 at 09:23:42AM -0700, Christoph Hellwig wrote: > - if (!write) { > + if (!write && !(BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM)) { > /* > * Load the csums up front to reduce csum tree searches and > * contention when submitting bios. > - * > - * If we have csums disabled this will do nothing. > */ > + status = BLK_STS_RESOURCE; > + dip->csums = kzalloc(fs_info->csum_size * > + (dio_bio->bi_iter.bi_size >> fs_info->sectorsize_bits), > + GFP_NOFS); This should be either kmalloc_array or kcalloc, otherwise OK.