From: Josef Bacik <[email protected]>

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 <[email protected]>
Signed-off-by: Daniel Vacek <[email protected]>
---

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.jo...@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


Reply via email to