~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/fs/btrfs/inode-item.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 
  3 #ifndef BTRFS_INODE_ITEM_H
  4 #define BTRFS_INODE_ITEM_H
  5 
  6 #include <linux/types.h>
  7 #include <linux/crc32c.h>
  8 
  9 struct fscrypt_str;
 10 struct extent_buffer;
 11 struct btrfs_trans_handle;
 12 struct btrfs_root;
 13 struct btrfs_path;
 14 struct btrfs_key;
 15 struct btrfs_inode_extref;
 16 struct btrfs_inode;
 17 struct btrfs_truncate_control;
 18 
 19 /*
 20  * Return this if we need to call truncate_block for the last bit of the
 21  * truncate.
 22  */
 23 #define BTRFS_NEED_TRUNCATE_BLOCK               1
 24 
 25 struct btrfs_truncate_control {
 26         /*
 27          * IN: the inode we're operating on, this can be NULL if
 28          * ->clear_extent_range is false.
 29          */
 30         struct btrfs_inode *inode;
 31 
 32         /* IN: the size we're truncating to. */
 33         u64 new_size;
 34 
 35         /* OUT: the number of extents truncated. */
 36         u64 extents_found;
 37 
 38         /* OUT: the last size we truncated this inode to. */
 39         u64 last_size;
 40 
 41         /* OUT: the number of bytes to sub from this inode. */
 42         u64 sub_bytes;
 43 
 44         /* IN: the ino we are truncating. */
 45         u64 ino;
 46 
 47         /*
 48          * IN: minimum key type to remove.  All key types with this type are
 49          * removed only if their offset >= new_size.
 50          */
 51         u32 min_type;
 52 
 53         /*
 54          * IN: true if we don't want to do extent reference updates for any file
 55          * extents we drop.
 56          */
 57         bool skip_ref_updates;
 58 
 59         /*
 60          * IN: true if we need to clear the file extent range for the inode as
 61          * we drop the file extent items.
 62          */
 63         bool clear_extent_range;
 64 };
 65 
 66 /*
 67  * btrfs_inode_item stores flags in a u64, btrfs_inode stores them in two
 68  * separate u32s. These two functions convert between the two representations.
 69  */
 70 static inline u64 btrfs_inode_combine_flags(u32 flags, u32 ro_flags)
 71 {
 72         return (flags | ((u64)ro_flags << 32));
 73 }
 74 
 75 static inline void btrfs_inode_split_flags(u64 inode_item_flags,
 76                                            u32 *flags, u32 *ro_flags)
 77 {
 78         *flags = (u32)inode_item_flags;
 79         *ro_flags = (u32)(inode_item_flags >> 32);
 80 }
 81 
 82 /* Figure the key offset of an extended inode ref. */
 83 static inline u64 btrfs_extref_hash(u64 parent_objectid, const char *name, int len)
 84 {
 85        return (u64)crc32c(parent_objectid, name, len);
 86 }
 87 
 88 int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
 89                                struct btrfs_root *root,
 90                                struct btrfs_truncate_control *control);
 91 int btrfs_insert_inode_ref(struct btrfs_trans_handle *trans,
 92                            struct btrfs_root *root, const struct fscrypt_str *name,
 93                            u64 inode_objectid, u64 ref_objectid, u64 index);
 94 int btrfs_del_inode_ref(struct btrfs_trans_handle *trans,
 95                         struct btrfs_root *root, const struct fscrypt_str *name,
 96                         u64 inode_objectid, u64 ref_objectid, u64 *index);
 97 int btrfs_insert_empty_inode(struct btrfs_trans_handle *trans,
 98                              struct btrfs_root *root,
 99                              struct btrfs_path *path, u64 objectid);
100 int btrfs_lookup_inode(struct btrfs_trans_handle *trans,
101                        struct btrfs_root *root, struct btrfs_path *path,
102                        struct btrfs_key *location, int mod);
103 
104 struct btrfs_inode_extref *btrfs_lookup_inode_extref(
105                           struct btrfs_trans_handle *trans,
106                           struct btrfs_root *root,
107                           struct btrfs_path *path,
108                           const struct fscrypt_str *name,
109                           u64 inode_objectid, u64 ref_objectid, int ins_len,
110                           int cow);
111 
112 struct btrfs_inode_ref *btrfs_find_name_in_backref(struct extent_buffer *leaf,
113                                                    int slot,
114                                                    const struct fscrypt_str *name);
115 struct btrfs_inode_extref *btrfs_find_name_in_ext_backref(
116                 struct extent_buffer *leaf, int slot, u64 ref_objectid,
117                 const struct fscrypt_str *name);
118 
119 #endif
120 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php