From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (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 B3BD43FF89F for ; Wed, 13 May 2026 08:55:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778662539; cv=none; b=SyoqvAIxttsSPxmDDeJEx5oXMThaz/mkfQIFH1wZ7SrDO4r53prDlcwaKvSsRFDhyQ9LDSErK5l6ev5Ifokwa7nYbXWBgcCCYLT6QenJ2Jm5yuy8XPrK1Rb52TmAWPbpnwrGAp89yNhAr2dfxi+qyhiYA9BFrYLnXo+C95ryKZk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778662539; c=relaxed/simple; bh=1FtFIlBqoaNm3ZAKcTS+4f2w++MAxzjyZ45rZdfqcPs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hLjZIYpo45tsySTeR7GJnhDbZuUn+W66JoQ9F/053BzF43kPXuYkUz8jqIG76Aa/ngRmdy2udTygKXCF3ZiYsGjKs6LX3Uy9A8543+zvB/Yw1B4eeyWF/ASGs3HaXLZL4x3zpTUBxfk11Ykaub2BGFRy10GynwsdxjNx/cHFm0w= 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; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=mSGV9IhT; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=Y4Fj1VSG; arc=none smtp.client-ip=195.135.223.131 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="mSGV9IhT"; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="Y4Fj1VSG" Received: from imap1.dmz-prg2.suse.org (unknown [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-out2.suse.de (Postfix) with ESMTPS id E512976672; Wed, 13 May 2026 08:54:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1778662472; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iQGWM7+w0kbQEF0MyiAgEUfgjut+7zEyKpvCh2x/3gg=; b=mSGV9IhTZmdlHIuD3KbVDFm4MnFZkeeCODeZ/jxJBLWySsSNnlRi513btXvWHb/XNe/ATi QgNl9v3vXz0ZlVDa7Z/ksJn4B0gwtiDu6mVDZVoN0a2iBc7kW8ku+zaO4XXFRnDk8e5kfz ZBf5l1LcmSlwfYVKL102AStC8NL28og= Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1778662471; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iQGWM7+w0kbQEF0MyiAgEUfgjut+7zEyKpvCh2x/3gg=; b=Y4Fj1VSGtMQWFT3+Bha8CZ0PN6BY6O6JPGcAJ6erCHt8zmn5HrqbY/9UIZY/a0uys4u1UQ zMKbyyw5m26IP2jPtgWSAG2pIK5pB+JIjtAEg5O6jqVA8H5qKa1a+y+FWsaB1m/IQe4/4n UqXqX1QG/ZtYnAgMOWIeJGkg/V+YIaA= 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 C3698593A9; Wed, 13 May 2026 08:54:31 +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 EPk6L0c8BGpERwAAD6G6ig (envelope-from ); Wed, 13 May 2026 08:54:31 +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 v7 20/43] btrfs: add fscrypt_info and encryption_type to ordered_extent Date: Wed, 13 May 2026 10:52:54 +0200 Message-ID: <20260513085340.3673127-21-neelx@suse.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260513085340.3673127-1-neelx@suse.com> References: <20260513085340.3673127-1-neelx@suse.com> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Level: X-Spamd-Result: default: False [-6.80 / 50.00]; REPLY(-4.00)[]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_COUNT_TWO(0.00)[2]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCPT_COUNT_TWELVE(0.00)[12]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; URIBL_BLOCKED(0.00)[imap1.dmz-prg2.suse.org:helo,suse.com:mid,suse.com:email]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.com:mid,suse.com:email]; R_RATELIMIT(0.00)[to_ip_from(RLdafymbgddseoxkryad1wgu8n)]; RCVD_TLS_ALL(0.00)[] X-Spam-Flag: NO X-Spam-Score: -6.80 From: Josef Bacik We're going to need these to update the file extent items once the writes are complete. Add them and add the pieces necessary to assign them and free everything. Signed-off-by: Josef Bacik Signed-off-by: Daniel Vacek --- No changes in v7. v6 changes: * Changed encryption_type member to u8 as suggested by Dave. v5: https://lore.kernel.org/linux-btrfs/de9ff13d1dc042b764c224d039fbb2a08946e004.1706116485.git.josef@toxicpanda.com/ --- fs/btrfs/ordered-data.c | 2 ++ fs/btrfs/ordered-data.h | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c index e5a24b3ff95e..ac302fb7484b 100644 --- a/fs/btrfs/ordered-data.c +++ b/fs/btrfs/ordered-data.c @@ -205,6 +205,7 @@ static struct btrfs_ordered_extent *alloc_ordered_extent( } entry->inode = inode; entry->compress_type = compress_type; + entry->encryption_type = BTRFS_ENCRYPTION_NONE; entry->truncated_len = (u64)-1; entry->qgroup_rsv = qgroup_rsv; entry->flags = flags; @@ -629,6 +630,7 @@ void btrfs_put_ordered_extent(struct btrfs_ordered_extent *entry) btrfs_add_delayed_iput(entry->inode); list_for_each_entry_safe(sum, tmp, &entry->csum_list, list) kvfree(sum); + fscrypt_put_extent_info(entry->fscrypt_info); kmem_cache_free(btrfs_ordered_extent_cache, entry); } } diff --git a/fs/btrfs/ordered-data.h b/fs/btrfs/ordered-data.h index 03e12380a2fd..9b288c3908f9 100644 --- a/fs/btrfs/ordered-data.h +++ b/fs/btrfs/ordered-data.h @@ -131,6 +131,9 @@ struct btrfs_ordered_extent { /* compression algorithm */ int compress_type; + /* encryption mode */ + u8 encryption_type; + /* Qgroup reserved space */ int qgroup_rsv; @@ -140,6 +143,9 @@ struct btrfs_ordered_extent { /* the inode we belong to */ struct btrfs_inode *inode; + /* the fscrypt_info for this extent, if necessary */ + struct fscrypt_extent_info *fscrypt_info; + /* list of checksums for insertion when the extent io is done */ struct list_head csum_list; -- 2.53.0