mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00

Many functions throughout btrfs take name buffer and name length arguments. Most of these functions at the highest level are usually called with these arguments extracted from a supplied dentry's name. But the entire name can be passed instead, making each function a little more elegant. Each function whose arguments are currently the name and length extracted from a dentry is herein converted to instead take a pointer to the name in the dentry. The couple of calls to these calls without a struct dentry are converted to create an appropriate qstr to pass in. Additionally, every function which is only called with a name/len extracted directly from a qstr is also converted. This change has positive effect on stack consumption, frame of many functions is reduced but this will be used in the future for fscrypt related structures. Signed-off-by: Sweet Tea Dorminy <sweettea-kernel@dorminy.me> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
94 lines
2.6 KiB
C
94 lines
2.6 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
#ifndef BTRFS_INODE_ITEM_H
|
|
#define BTRFS_INODE_ITEM_H
|
|
|
|
#include <linux/types.h>
|
|
|
|
struct btrfs_trans_handle;
|
|
struct btrfs_root;
|
|
struct btrfs_path;
|
|
struct btrfs_key;
|
|
struct btrfs_inode_extref;
|
|
struct btrfs_inode;
|
|
struct extent_buffer;
|
|
|
|
/*
|
|
* Return this if we need to call truncate_block for the last bit of the
|
|
* truncate.
|
|
*/
|
|
#define BTRFS_NEED_TRUNCATE_BLOCK 1
|
|
|
|
struct btrfs_truncate_control {
|
|
/*
|
|
* IN: the inode we're operating on, this can be NULL if
|
|
* ->clear_extent_range is false.
|
|
*/
|
|
struct btrfs_inode *inode;
|
|
|
|
/* IN: the size we're truncating to. */
|
|
u64 new_size;
|
|
|
|
/* OUT: the number of extents truncated. */
|
|
u64 extents_found;
|
|
|
|
/* OUT: the last size we truncated this inode to. */
|
|
u64 last_size;
|
|
|
|
/* OUT: the number of bytes to sub from this inode. */
|
|
u64 sub_bytes;
|
|
|
|
/* IN: the ino we are truncating. */
|
|
u64 ino;
|
|
|
|
/*
|
|
* IN: minimum key type to remove. All key types with this type are
|
|
* removed only if their offset >= new_size.
|
|
*/
|
|
u32 min_type;
|
|
|
|
/*
|
|
* IN: true if we don't want to do extent reference updates for any file
|
|
* extents we drop.
|
|
*/
|
|
bool skip_ref_updates;
|
|
|
|
/*
|
|
* IN: true if we need to clear the file extent range for the inode as
|
|
* we drop the file extent items.
|
|
*/
|
|
bool clear_extent_range;
|
|
};
|
|
|
|
int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
|
|
struct btrfs_root *root,
|
|
struct btrfs_truncate_control *control);
|
|
int btrfs_insert_inode_ref(struct btrfs_trans_handle *trans,
|
|
struct btrfs_root *root, const struct qstr *name,
|
|
u64 inode_objectid, u64 ref_objectid, u64 index);
|
|
int btrfs_del_inode_ref(struct btrfs_trans_handle *trans,
|
|
struct btrfs_root *root, const struct qstr *name,
|
|
u64 inode_objectid, u64 ref_objectid, u64 *index);
|
|
int btrfs_insert_empty_inode(struct btrfs_trans_handle *trans,
|
|
struct btrfs_root *root,
|
|
struct btrfs_path *path, u64 objectid);
|
|
int btrfs_lookup_inode(struct btrfs_trans_handle *trans,
|
|
struct btrfs_root *root, struct btrfs_path *path,
|
|
struct btrfs_key *location, int mod);
|
|
|
|
struct btrfs_inode_extref *btrfs_lookup_inode_extref(
|
|
struct btrfs_trans_handle *trans,
|
|
struct btrfs_root *root,
|
|
struct btrfs_path *path,
|
|
const struct qstr *name,
|
|
u64 inode_objectid, u64 ref_objectid, int ins_len,
|
|
int cow);
|
|
|
|
struct btrfs_inode_ref *btrfs_find_name_in_backref(struct extent_buffer *leaf,
|
|
int slot,
|
|
const struct qstr *name);
|
|
struct btrfs_inode_extref *btrfs_find_name_in_ext_backref(
|
|
struct extent_buffer *leaf, int slot, u64 ref_objectid,
|
|
const struct qstr *name);
|
|
|
|
#endif
|