send_ctx
struct send_ctx *sctx;
struct send_ctx *sctx = bctx->sctx;
struct send_ctx *sctx = bctx->sctx;
const struct send_ctx *sctx = bctx->sctx;
static int find_extent_clone(struct send_ctx *sctx,
static int gen_unique_name(struct send_ctx *sctx,
static int get_cur_inode_state(struct send_ctx *sctx, u64 ino, u64 gen,
static int is_inode_existent(struct send_ctx *sctx, u64 ino, u64 gen,
static int will_overwrite_ref(struct send_ctx *sctx, u64 dir, u64 dir_gen,
static int did_overwrite_ref(struct send_ctx *sctx,
static int did_overwrite_first_ref(struct send_ctx *sctx, u64 ino, u64 gen)
static inline struct name_cache_entry *name_cache_search(struct send_ctx *sctx,
static int __get_cur_name_and_parent(struct send_ctx *sctx,
static int get_cur_path(struct send_ctx *sctx, u64 ino, u64 gen,
static int send_subvol_begin(struct send_ctx *sctx)
static struct fs_path *get_cur_inode_path(struct send_ctx *sctx)
static struct fs_path *get_path_for_command(struct send_ctx *sctx, u64 ino, u64 gen)
static void free_path_for_command(const struct send_ctx *sctx, struct fs_path *path)
static int send_truncate(struct send_ctx *sctx, u64 ino, u64 gen, u64 size)
static int send_chmod(struct send_ctx *sctx, u64 ino, u64 gen, u64 mode)
static int send_fileattr(struct send_ctx *sctx, u64 ino, u64 gen, u64 fileattr)
static int send_chown(struct send_ctx *sctx, u64 ino, u64 gen, u64 uid, u64 gid)
static int send_utimes(struct send_ctx *sctx, u64 ino, u64 gen)
static int cache_dir_utimes(struct send_ctx *sctx, u64 dir, u64 gen)
static int trim_dir_utimes_cache(struct send_ctx *sctx)
static int send_create_inode(struct send_ctx *sctx, u64 ino)
static void cache_dir_created(struct send_ctx *sctx, u64 dir)
static int did_create_dir(struct send_ctx *sctx, u64 dir)
static int send_create_inode_if_needed(struct send_ctx *sctx)
static void free_recorded_refs(struct send_ctx *sctx)
static int orphanize_inode(struct send_ctx *sctx, u64 ino, u64 gen,
static struct orphan_dir_info *add_orphan_dir_info(struct send_ctx *sctx,
static struct orphan_dir_info *get_orphan_dir_info(struct send_ctx *sctx,
static int is_waiting_for_rm(struct send_ctx *sctx, u64 dir_ino, u64 gen)
static void free_orphan_dir_info(struct send_ctx *sctx,
static int can_rmdir(struct send_ctx *sctx, u64 dir, u64 dir_gen)
static int is_waiting_for_move(struct send_ctx *sctx, u64 ino)
static int add_waiting_dir_move(struct send_ctx *sctx, u64 ino, bool orphanized)
get_waiting_dir_move(struct send_ctx *sctx, u64 ino)
static void free_waiting_dir_move(struct send_ctx *sctx,
static int add_pending_dir_move(struct send_ctx *sctx,
static struct pending_dir_move *get_pending_dir_moves(struct send_ctx *sctx,
static int path_loop(struct send_ctx *sctx, struct fs_path *name,
static int apply_dir_move(struct send_ctx *sctx, struct pending_dir_move *pm)
static void free_pending_move(struct send_ctx *sctx, struct pending_dir_move *m)
static void tail_append_pending_moves(struct send_ctx *sctx,
static int apply_children_dir_moves(struct send_ctx *sctx)
static int wait_for_dest_dir_move(struct send_ctx *sctx,
static void inconsistent_snapshot_error(struct send_ctx *sctx,
static int wait_for_parent_move(struct send_ctx *sctx,
static int update_ref_path(struct send_ctx *sctx, struct recorded_ref *ref)
static bool proto_cmd_ok(const struct send_ctx *sctx, int cmd)
static int refresh_ref_path(struct send_ctx *sctx, struct recorded_ref *ref)
static int rename_current_inode(struct send_ctx *sctx,
static int is_waiting_for_move(struct send_ctx *sctx, u64 ino);
static int process_recorded_refs(struct send_ctx *sctx, int *pending_move)
get_waiting_dir_move(struct send_ctx *sctx, u64 ino);
static int is_waiting_for_rm(struct send_ctx *sctx, u64 dir_ino, u64 gen);
static int need_send_hole(struct send_ctx *sctx)
struct send_ctx *sctx)
struct send_ctx *sctx = ctx;
struct send_ctx *sctx = ctx;
static int record_new_ref(struct send_ctx *sctx)
static int record_deleted_ref(struct send_ctx *sctx)
static int record_changed_ref(struct send_ctx *sctx)
static int process_all_refs(struct send_ctx *sctx,
static int send_set_xattr(struct send_ctx *sctx,
static int send_remove_xattr(struct send_ctx *sctx,
struct send_ctx *sctx = ctx;
struct send_ctx *sctx = ctx;
static int process_new_xattr(struct send_ctx *sctx)
static int process_deleted_xattr(struct send_ctx *sctx)
struct send_ctx *sctx = ctx;
struct send_ctx *sctx = ctx;
static int process_changed_xattr(struct send_ctx *sctx)
static int process_all_new_xattrs(struct send_ctx *sctx)
static int send_verity(struct send_ctx *sctx, struct fs_path *path,
static int process_verity(struct send_ctx *sctx)
static inline u64 max_send_read_size(const struct send_ctx *sctx)
static int put_data_header(struct send_ctx *sctx, u32 len)
static int put_file_data(struct send_ctx *sctx, u64 offset, u32 len)
static int send_write(struct send_ctx *sctx, u64 offset, u32 len)
static int send_clone(struct send_ctx *sctx,
static int send_update_extent(struct send_ctx *sctx,
static int send_fallocate(struct send_ctx *sctx, u32 mode, u64 offset, u64 len)
static int send_hole(struct send_ctx *sctx, u64 end)
static int send_encoded_inline_extent(struct send_ctx *sctx,
static int send_encoded_extent(struct send_ctx *sctx, struct btrfs_path *path,
static int send_extent_data(struct send_ctx *sctx, struct btrfs_path *path,
static int send_capabilities(struct send_ctx *sctx)
static int clone_range(struct send_ctx *sctx, struct btrfs_path *dst_path,
static int send_write_or_clone(struct send_ctx *sctx,
static int is_extent_unchanged(struct send_ctx *sctx,
static inline bool is_current_inode_path(const struct send_ctx *sctx,
static int get_last_extent(struct send_ctx *sctx, u64 offset)
static int range_is_hole_in_parent(struct send_ctx *sctx,
static int maybe_send_hole(struct send_ctx *sctx, struct btrfs_path *path,
static int process_extent(struct send_ctx *sctx,
static int process_all_extents(struct send_ctx *sctx)
static int process_recorded_refs_if_needed(struct send_ctx *sctx, bool at_end,
static int finish_inode_if_needed(struct send_ctx *sctx, bool at_end)
static int tlv_put(struct send_ctx *sctx, u16 attr, const void *data, int len)
static void close_current_inode(struct send_ctx *sctx)
static int changed_inode(struct send_ctx *sctx,
static int tlv_put_u##bits(struct send_ctx *sctx, \
static int tlv_put_string(struct send_ctx *sctx, u16 attr,
static int changed_ref(struct send_ctx *sctx,
static int changed_xattr(struct send_ctx *sctx,
static int tlv_put_uuid(struct send_ctx *sctx, u16 attr,
static int changed_extent(struct send_ctx *sctx,
static int changed_verity(struct send_ctx *sctx, enum btrfs_compare_tree_result result)
static int tlv_put_btrfs_timespec(struct send_ctx *sctx, u16 attr,
static int dir_changed(struct send_ctx *sctx, u64 dir)
static int compare_refs(struct send_ctx *sctx, struct btrfs_path *path,
struct send_ctx *sctx)
static int search_key_again(const struct send_ctx *sctx,
static int full_send_tree(struct send_ctx *sctx)
const struct send_ctx *sctx)
struct btrfs_root *right_root, struct send_ctx *sctx)
static int send_header(struct send_ctx *sctx)
static int begin_cmd(struct send_ctx *sctx, int cmd)
static int send_subvol(struct send_ctx *sctx)
static int ensure_commit_roots_uptodate(struct send_ctx *sctx)
static int flush_delalloc_roots(struct send_ctx *sctx)
static int send_cmd(struct send_ctx *sctx)
struct send_ctx *sctx = NULL;
sctx = kzalloc_obj(struct send_ctx);
static int send_rename(struct send_ctx *sctx,
static int send_link(struct send_ctx *sctx,
static int send_unlink(struct send_ctx *sctx, struct fs_path *path)
static int send_rmdir(struct send_ctx *sctx, struct fs_path *path)
static void smb_direct_send_ctx_init(struct smbdirect_send_batch *send_ctx,
INIT_LIST_HEAD(&send_ctx->msg_list);
send_ctx->wr_cnt = 0;
send_ctx->need_invalidate_rkey = need_invalidate_rkey;
send_ctx->remote_key = remote_key;
send_ctx->credit = 0;
struct smbdirect_send_batch *send_ctx,
if (list_empty(&send_ctx->msg_list))
first = list_first_entry(&send_ctx->msg_list,
last = list_last_entry(&send_ctx->msg_list,
if (send_ctx->need_invalidate_rkey) {
first->wr.ex.invalidate_rkey = send_ctx->remote_key;
send_ctx->need_invalidate_rkey = false;
send_ctx->remote_key = 0;
list_splice_tail_init(&send_ctx->msg_list, &last->sibling_list);
send_ctx->wr_cnt = 0;
if (is_last && !ret && send_ctx->credit) {
atomic_add(send_ctx->credit, &sc->send_io.bcredits.count);
send_ctx->credit = 0;
struct smbdirect_send_batch *send_ctx)
if (send_ctx->credit)
send_ctx->credit = 1;
struct smbdirect_send_batch *send_ctx)
if (send_ctx && (atomic_read(&sc->send_io.lcredits.count) <= 1)) {
ret = smb_direct_flush_send_list(sc, send_ctx, false);
struct smbdirect_send_batch *send_ctx)
if (send_ctx &&
(send_ctx->wr_cnt >= 16 || atomic_read(&sc->send_io.credits.count) <= 1)) {
ret = smb_direct_flush_send_list(sc, send_ctx, false);
struct smbdirect_send_batch *send_ctx,
if (send_ctx) {
if (!list_empty(&send_ctx->msg_list)) {
last = list_last_entry(&send_ctx->msg_list,
list_add_tail(&msg->sibling_list, &send_ctx->msg_list);
send_ctx->wr_cnt++;
struct smbdirect_send_batch *send_ctx,
if (!send_ctx) {
send_ctx = &_send_ctx;
ret = wait_for_send_bcredit(sc, send_ctx);
ret = wait_for_send_lcredit(sc, send_ctx);
ret = wait_for_send_credits(sc, send_ctx);
struct smbdirect_send_batch *send_ctx,
ret = post_sendmsg(sc, send_ctx, msg);
if (send_ctx == &_send_ctx) {
ret = smb_direct_flush_send_list(sc, send_ctx, true);
atomic_add(send_ctx->credit, &sc->send_io.bcredits.count);
send_ctx->credit = 0;
struct smbdirect_send_batch send_ctx;
smb_direct_send_ctx_init(&send_ctx, need_invalidate, remote_key);
ret = smb_direct_post_send_data(sc, &send_ctx,
ret = smb_direct_flush_send_list(sc, &send_ctx, true);