From nobody Mon Feb 9 13:57:14 2026 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A3559429819 for ; Fri, 6 Feb 2026 18:24:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770402292; cv=none; b=MtT9A4t4JOpnKWzxD3QRfo9xPO8ZmTUX8Rd1xYEshNd73+sYuaElwn8oN+NJoeyzE5tX1CKOiKLs5aj1lIaddqUxfISjDO5Tcj/5yEqSNxTdvyq1HuO98NDytZYyd/LnGDuhMkNtCAOgsjNDJDAT7JG2vx27oYOLsWCxpqyVTvU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770402292; c=relaxed/simple; bh=rypYO6gORnw4ieKxJ3St2Aeyn2HaW7fwz1NPjO8+wSY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TsTOWqOy626DvLdJa9YLKBwlmcOBn8zZ+e2POd2soit/jkvAUOcdbESGSWJ8tp5eXZKCSPOToAxRaFbqEUV3CRa+b3/EXTi9+Mx2GzJRfPHKpKZqteI8CdbYsDpK3L72GmFQ67nmKdGIofoCVnLlLIpZT1YEGIJIM1PDreP78pc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id E0F083E754; Fri, 6 Feb 2026 18:24:09 +0000 (UTC) Authentication-Results: smtp-out1.suse.de; none Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id B51883EA63; Fri, 6 Feb 2026 18:24:09 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 4AG7K8kxhmkTCQAAD6G6ig (envelope-from ); Fri, 06 Feb 2026 18:24:09 +0000 From: Daniel Vacek To: Chris Mason , Josef Bacik , Eric Biggers , "Theodore Y. Ts'o" , Jaegeuk Kim , Jens Axboe , David Sterba Cc: linux-block@vger.kernel.org, Daniel Vacek , linux-fscrypt@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 25/43] btrfs: pass through fscrypt_extent_info to the file extent helpers Date: Fri, 6 Feb 2026 19:22:57 +0100 Message-ID: <20260206182336.1397715-26-neelx@suse.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260206182336.1397715-1-neelx@suse.com> References: <20260206182336.1397715-1-neelx@suse.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 50.00]; REPLY(-4.00)[] X-Spam-Flag: NO X-Spam-Score: -4.00 X-Rspamd-Queue-Id: E0F083E754 X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spam-Level: Content-Type: text/plain; charset="utf-8" From: Josef Bacik Now that we have the fscrypt_extnet_info in all of the supporting structures, pass this through and set the file extent encryption bit accordingly from the supporting structures. In subsequent patches code will be added to populate these appropriately. Signed-off-by: Josef Bacik Signed-off-by: Daniel Vacek --- v5: https://lore.kernel.org/linux-btrfs/a8b9dd312a4504f209e861cca5289a528b3= 0ff95.1706116485.git.josef@toxicpanda.com/ * No changes since. --- fs/btrfs/inode.c | 16 ++++++++++------ fs/btrfs/tree-log.c | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index f81bdb97b212..f449839d6d84 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -3018,7 +3018,9 @@ int btrfs_writepage_cow_fixup(struct folio *folio) } =20 static int insert_reserved_file_extent(struct btrfs_trans_handle *trans, - struct btrfs_inode *inode, u64 file_pos, + struct btrfs_inode *inode, + struct fscrypt_extent_info *fscrypt_info, + u64 file_pos, struct btrfs_file_extent_item *stack_fi, const bool update_inode_bytes, u64 qgroup_reserved) @@ -3142,7 +3144,7 @@ static int insert_ordered_extent_file_extent(struct b= trfs_trans_handle *trans, btrfs_set_stack_file_extent_num_bytes(&stack_fi, num_bytes); btrfs_set_stack_file_extent_ram_bytes(&stack_fi, ram_bytes); btrfs_set_stack_file_extent_compression(&stack_fi, oe->compress_type); - btrfs_set_stack_file_extent_encryption(&stack_fi, BTRFS_ENCRYPTION_NONE); + btrfs_set_stack_file_extent_encryption(&stack_fi, oe->encryption_type); /* Other encoding is reserved and always 0 */ =20 /* @@ -3155,7 +3157,7 @@ static int insert_ordered_extent_file_extent(struct b= trfs_trans_handle *trans, test_bit(BTRFS_ORDERED_ENCODED, &oe->flags) || test_bit(BTRFS_ORDERED_TRUNCATED, &oe->flags); =20 - return insert_reserved_file_extent(trans, oe->inode, + return insert_reserved_file_extent(trans, oe->inode, oe->fscrypt_info, oe->file_offset, &stack_fi, update_inode_bytes, oe->qgroup_rsv); } @@ -9213,6 +9215,7 @@ static struct btrfs_trans_handle *insert_prealloc_fil= e_extent( struct btrfs_trans_handle *trans_in, struct btrfs_inode *inode, struct btrfs_key *ins, + struct fscrypt_extent_info *fscrypt_info, u64 file_offset) { struct btrfs_file_extent_item stack_fi; @@ -9232,7 +9235,8 @@ static struct btrfs_trans_handle *insert_prealloc_fil= e_extent( btrfs_set_stack_file_extent_num_bytes(&stack_fi, len); btrfs_set_stack_file_extent_ram_bytes(&stack_fi, len); btrfs_set_stack_file_extent_compression(&stack_fi, BTRFS_COMPRESS_NONE); - btrfs_set_stack_file_extent_encryption(&stack_fi, BTRFS_ENCRYPTION_NONE); + btrfs_set_stack_file_extent_encryption(&stack_fi, fscrypt_info? BTRFS_ENC= RYPTION_FSCRYPT: + BTRFS_ENCRYPTION_NONE); /* Other encoding is reserved and always 0 */ =20 ret =3D btrfs_qgroup_release_data(inode, file_offset, len, &qgroup_releas= ed); @@ -9240,7 +9244,7 @@ static struct btrfs_trans_handle *insert_prealloc_fil= e_extent( return ERR_PTR(ret); =20 if (trans) { - ret =3D insert_reserved_file_extent(trans, inode, + ret =3D insert_reserved_file_extent(trans, inode, fscrypt_info, file_offset, &stack_fi, true, qgroup_released); if (ret) @@ -9333,7 +9337,7 @@ static int __btrfs_prealloc_file_range(struct inode *= inode, int mode, =20 last_alloc =3D ins.offset; trans =3D insert_prealloc_file_extent(trans, BTRFS_I(inode), - &ins, cur_offset); + &ins, NULL, cur_offset); /* * Now that we inserted the prealloc extent we can finally * decrement the number of reservations in the block group. diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index 118dd1888996..43b1470ebf71 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -5123,7 +5123,7 @@ static int log_one_extent(struct btrfs_trans_handle *= trans, u64 block_start =3D btrfs_extent_map_block_start(em); u64 block_len; int ret; - u8 encryption =3D BTRFS_ENCRYPTION_NONE; + u8 encryption =3D btrfs_extent_map_encryption(em); =20 btrfs_set_stack_file_extent_generation(&fi, trans->transid); if (em->flags & EXTENT_FLAG_PREALLOC) --=20 2.51.0