return NT_STATUS_OK;
}
-struct btrfs_cc_state {
+struct btrfs_offload_write_state {
struct vfs_handle_struct *handle;
off_t copied;
struct tevent_req *subreq; /* non-null if passed to next VFS fn */
off_t dest_off,
off_t num)
{
- struct tevent_req *req;
- struct btrfs_cc_state *cc_state;
+ struct tevent_req *req = NULL;
+ struct btrfs_offload_write_state *state = NULL;
struct btrfs_ioctl_clone_range_args cr_args;
struct lock_struct src_lck;
struct lock_struct dest_lck;
bool do_locking = false;
NTSTATUS status;
- req = tevent_req_create(mem_ctx, &cc_state, struct btrfs_cc_state);
+ req = tevent_req_create(mem_ctx, &state,
+ struct btrfs_offload_write_state);
if (req == NULL) {
return NULL;
}
- cc_state->handle = handle;
+ state->handle = handle;
status = vfs_offload_token_db_fetch_fsp(btrfs_offload_ctx,
token, &src_fsp);
}
if (!handle_offload_write) {
- cc_state->subreq = SMB_VFS_NEXT_OFFLOAD_WRITE_SEND(handle,
- cc_state, ev,
+ state->subreq = SMB_VFS_NEXT_OFFLOAD_WRITE_SEND(handle,
+ state,
+ ev,
fsctl,
token,
transfer_offset,
dest_fsp,
dest_off,
num);
- if (tevent_req_nomem(cc_state->subreq, req)) {
+ if (tevent_req_nomem(state->subreq, req)) {
return tevent_req_post(req, ev);
}
- tevent_req_set_callback(cc_state->subreq,
+ tevent_req_set_callback(state->subreq,
btrfs_offload_write_done,
req);
return req;
(unsigned long long)cr_args.src_offset,
dest_fsp->fh->fd,
(unsigned long long)cr_args.dest_offset));
- cc_state->subreq = SMB_VFS_NEXT_OFFLOAD_WRITE_SEND(handle,
- cc_state, ev,
+ state->subreq = SMB_VFS_NEXT_OFFLOAD_WRITE_SEND(handle,
+ state,
+ ev,
fsctl,
token,
transfer_offset,
dest_fsp,
dest_off,
num);
- if (tevent_req_nomem(cc_state->subreq, req)) {
+ if (tevent_req_nomem(state->subreq, req)) {
return tevent_req_post(req, ev);
}
/* wait for subreq completion */
- tevent_req_set_callback(cc_state->subreq,
+ tevent_req_set_callback(state->subreq,
btrfs_offload_write_done,
req);
return req;
DEBUG(5, ("BTRFS_IOC_CLONE_RANGE returned %d\n", ret));
/* BTRFS_IOC_CLONE_RANGE is all or nothing */
- cc_state->copied = num;
+ state->copied = num;
tevent_req_done(req);
return tevent_req_post(req, ev);
}
/* only used if the request is passed through to next VFS module */
static void btrfs_offload_write_done(struct tevent_req *subreq)
{
- struct tevent_req *req = tevent_req_callback_data(
- subreq, struct tevent_req);
- struct btrfs_cc_state *cc_state = tevent_req_data(req,
- struct btrfs_cc_state);
+ struct tevent_req *req =
+ tevent_req_callback_data(subreq,
+ struct tevent_req);
+ struct btrfs_offload_write_state *state =
+ tevent_req_data(req,
+ struct btrfs_offload_write_state);
NTSTATUS status;
- status = SMB_VFS_NEXT_OFFLOAD_WRITE_RECV(cc_state->handle,
- cc_state->subreq,
- &cc_state->copied);
+ status = SMB_VFS_NEXT_OFFLOAD_WRITE_RECV(state->handle,
+ state->subreq,
+ &state->copied);
if (tevent_req_nterror(req, status)) {
return;
}
}
static NTSTATUS btrfs_offload_write_recv(struct vfs_handle_struct *handle,
- struct tevent_req *req,
- off_t *copied)
+ struct tevent_req *req,
+ off_t *copied)
{
+ struct btrfs_offload_write_state *state =
+ tevent_req_data(req,
+ struct btrfs_offload_write_state);
NTSTATUS status;
- struct btrfs_cc_state *cc_state = tevent_req_data(req,
- struct btrfs_cc_state);
if (tevent_req_is_nterror(req, &status)) {
DEBUG(4, ("server side copy chunk failed: %s\n",
}
DEBUG(10, ("server side copy chunk copied %llu\n",
- (unsigned long long)cc_state->copied));
- *copied = cc_state->copied;
+ (unsigned long long)state->copied));
+ *copied = state->copied;
tevent_req_received(req);
return NT_STATUS_OK;
}