2 * Module to make use of awesome Btrfs features
4 * Copyright (C) David Disseldorp 2011-2013
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
20 #include <linux/ioctl.h>
22 #include <sys/ioctl.h>
27 #include "system/filesys.h"
29 #include "smbd/smbd.h"
30 #include "smbd/globals.h"
31 #include "librpc/gen_ndr/smbXsrv.h"
32 #include "librpc/gen_ndr/ioctl.h"
33 #include "lib/util/tevent_ntstatus.h"
34 #include "offload_token.h"
36 static uint32_t btrfs_fs_capabilities(struct vfs_handle_struct
*handle
,
37 enum timestamp_set_resolution
*_ts_res
)
39 uint32_t fs_capabilities
;
40 enum timestamp_set_resolution ts_res
;
42 /* inherit default capabilities, expose compression support */
43 fs_capabilities
= SMB_VFS_NEXT_FS_CAPABILITIES(handle
, &ts_res
);
44 fs_capabilities
|= (FILE_FILE_COMPRESSION
45 | FILE_SUPPORTS_BLOCK_REFCOUNTING
);
48 return fs_capabilities
;
51 #define SHADOW_COPY_PREFIX "@GMT-" /* vfs_shadow_copy format */
52 #define SHADOW_COPY_PATH_FORMAT "@GMT-%Y.%m.%d-%H.%M.%S"
54 #define BTRFS_SUBVOL_RDONLY (1ULL << 1)
55 #define BTRFS_SUBVOL_NAME_MAX 4039
56 #define BTRFS_PATH_NAME_MAX 4087
57 struct btrfs_ioctl_vol_args_v2
{
62 char name
[BTRFS_SUBVOL_NAME_MAX
+ 1];
64 struct btrfs_ioctl_vol_args
{
66 char name
[BTRFS_PATH_NAME_MAX
+ 1];
69 struct btrfs_ioctl_clone_range_args
{
76 #define BTRFS_IOCTL_MAGIC 0x94
77 #define BTRFS_IOC_CLONE_RANGE _IOW(BTRFS_IOCTL_MAGIC, 13, \
78 struct btrfs_ioctl_clone_range_args)
79 #define BTRFS_IOC_SNAP_DESTROY _IOW(BTRFS_IOCTL_MAGIC, 15, \
80 struct btrfs_ioctl_vol_args)
81 #define BTRFS_IOC_SNAP_CREATE_V2 _IOW(BTRFS_IOCTL_MAGIC, 23, \
82 struct btrfs_ioctl_vol_args_v2)
84 static struct vfs_offload_ctx
*btrfs_offload_ctx
;
86 struct btrfs_offload_read_state
{
87 struct vfs_handle_struct
*handle
;
92 static void btrfs_offload_read_done(struct tevent_req
*subreq
);
94 static struct tevent_req
*btrfs_offload_read_send(
96 struct tevent_context
*ev
,
97 struct vfs_handle_struct
*handle
,
104 struct tevent_req
*req
= NULL
;
105 struct tevent_req
*subreq
= NULL
;
106 struct btrfs_offload_read_state
*state
= NULL
;
109 req
= tevent_req_create(mem_ctx
, &state
,
110 struct btrfs_offload_read_state
);
114 *state
= (struct btrfs_offload_read_state
) {
119 status
= vfs_offload_token_ctx_init(fsp
->conn
->sconn
->client
,
121 if (tevent_req_nterror(req
, status
)) {
122 return tevent_req_post(req
, ev
);
125 if (fsctl
== FSCTL_DUP_EXTENTS_TO_FILE
) {
126 status
= vfs_offload_token_create_blob(state
, fsp
, fsctl
,
128 if (tevent_req_nterror(req
, status
)) {
129 return tevent_req_post(req
, ev
);
132 status
= vfs_offload_token_db_store_fsp(btrfs_offload_ctx
, fsp
,
134 if (tevent_req_nterror(req
, status
)) {
135 return tevent_req_post(req
, ev
);
137 tevent_req_done(req
);
138 return tevent_req_post(req
, ev
);
141 subreq
= SMB_VFS_NEXT_OFFLOAD_READ_SEND(mem_ctx
, ev
, handle
, fsp
,
142 fsctl
, ttl
, offset
, to_copy
);
143 if (tevent_req_nomem(subreq
, req
)) {
144 return tevent_req_post(req
, ev
);
146 tevent_req_set_callback(subreq
, btrfs_offload_read_done
, req
);
150 static void btrfs_offload_read_done(struct tevent_req
*subreq
)
152 struct tevent_req
*req
= tevent_req_callback_data(
153 subreq
, struct tevent_req
);
154 struct btrfs_offload_read_state
*state
= tevent_req_data(
155 req
, struct btrfs_offload_read_state
);
158 status
= SMB_VFS_NEXT_OFFLOAD_READ_RECV(subreq
,
163 if (tevent_req_nterror(req
, status
)) {
167 status
= vfs_offload_token_db_store_fsp(btrfs_offload_ctx
,
170 if (tevent_req_nterror(req
, status
)) {
174 tevent_req_done(req
);
178 static NTSTATUS
btrfs_offload_read_recv(struct tevent_req
*req
,
179 struct vfs_handle_struct
*handle
,
183 struct btrfs_offload_read_state
*state
= tevent_req_data(
184 req
, struct btrfs_offload_read_state
);
187 if (tevent_req_is_nterror(req
, &status
)) {
188 tevent_req_received(req
);
192 token
->length
= state
->token
.length
;
193 token
->data
= talloc_move(mem_ctx
, &state
->token
.data
);
195 tevent_req_received(req
);
199 struct btrfs_offload_write_state
{
200 struct vfs_handle_struct
*handle
;
202 struct tevent_req
*subreq
; /* non-null if passed to next VFS fn */
204 static void btrfs_offload_write_done(struct tevent_req
*subreq
);
206 static struct tevent_req
*btrfs_offload_write_send(struct vfs_handle_struct
*handle
,
208 struct tevent_context
*ev
,
211 off_t transfer_offset
,
212 struct files_struct
*dest_fsp
,
216 struct tevent_req
*req
= NULL
;
217 struct btrfs_offload_write_state
*state
= NULL
;
218 struct btrfs_ioctl_clone_range_args cr_args
;
219 struct lock_struct src_lck
;
220 struct lock_struct dest_lck
;
221 off_t src_off
= transfer_offset
;
222 files_struct
*src_fsp
= NULL
;
224 bool handle_offload_write
= true;
225 bool do_locking
= false;
228 req
= tevent_req_create(mem_ctx
, &state
,
229 struct btrfs_offload_write_state
);
234 state
->handle
= handle
;
236 status
= vfs_offload_token_db_fetch_fsp(btrfs_offload_ctx
,
238 if (tevent_req_nterror(req
, status
)) {
239 return tevent_req_post(req
, ev
);
243 case FSCTL_SRV_COPYCHUNK
:
244 case FSCTL_SRV_COPYCHUNK_WRITE
:
248 case FSCTL_DUP_EXTENTS_TO_FILE
:
249 /* dup extents does not use locking */
253 handle_offload_write
= false;
259 * With a @src_length of zero, BTRFS_IOC_CLONE_RANGE clones
260 * all data from @src_offset->EOF! This is certainly not what
261 * the caller expects, and not what vfs_default does.
263 handle_offload_write
= false;
266 if (!handle_offload_write
) {
267 state
->subreq
= SMB_VFS_NEXT_OFFLOAD_WRITE_SEND(handle
,
276 if (tevent_req_nomem(state
->subreq
, req
)) {
277 return tevent_req_post(req
, ev
);
279 tevent_req_set_callback(state
->subreq
,
280 btrfs_offload_write_done
,
285 status
= vfs_offload_token_check_handles(
286 fsctl
, src_fsp
, dest_fsp
);
287 if (!NT_STATUS_IS_OK(status
)) {
288 tevent_req_nterror(req
, status
);
289 return tevent_req_post(req
, ev
);
292 status
= vfs_stat_fsp(src_fsp
);
293 if (tevent_req_nterror(req
, status
)) {
294 return tevent_req_post(req
, ev
);
297 if (src_fsp
->fsp_name
->st
.st_ex_size
< src_off
+ num
) {
298 /* [MS-SMB2] Handling a Server-Side Data Copy Request */
299 tevent_req_nterror(req
, NT_STATUS_INVALID_VIEW_SIZE
);
300 return tevent_req_post(req
, ev
);
304 init_strict_lock_struct(src_fsp
,
305 src_fsp
->op
->global
->open_persistent_id
,
310 init_strict_lock_struct(dest_fsp
,
311 dest_fsp
->op
->global
->open_persistent_id
,
317 if (!SMB_VFS_STRICT_LOCK_CHECK(src_fsp
->conn
, src_fsp
, &src_lck
)) {
318 tevent_req_nterror(req
, NT_STATUS_FILE_LOCK_CONFLICT
);
319 return tevent_req_post(req
, ev
);
321 if (!SMB_VFS_STRICT_LOCK_CHECK(dest_fsp
->conn
, dest_fsp
, &dest_lck
)) {
322 tevent_req_nterror(req
, NT_STATUS_FILE_LOCK_CONFLICT
);
323 return tevent_req_post(req
, ev
);
327 ZERO_STRUCT(cr_args
);
328 cr_args
.src_fd
= src_fsp
->fh
->fd
;
329 cr_args
.src_offset
= (uint64_t)src_off
;
330 cr_args
.dest_offset
= (uint64_t)dest_off
;
331 cr_args
.src_length
= (uint64_t)num
;
333 ret
= ioctl(dest_fsp
->fh
->fd
, BTRFS_IOC_CLONE_RANGE
, &cr_args
);
336 * BTRFS_IOC_CLONE_RANGE only supports 'sectorsize' aligned
337 * cloning. Which is 4096 by default, therefore fall back to
338 * manual read/write on failure.
340 DEBUG(5, ("BTRFS_IOC_CLONE_RANGE failed: %s, length %llu, "
341 "src fd: %lld off: %llu, dest fd: %d off: %llu\n",
343 (unsigned long long)cr_args
.src_length
,
344 (long long)cr_args
.src_fd
,
345 (unsigned long long)cr_args
.src_offset
,
347 (unsigned long long)cr_args
.dest_offset
));
348 state
->subreq
= SMB_VFS_NEXT_OFFLOAD_WRITE_SEND(handle
,
357 if (tevent_req_nomem(state
->subreq
, req
)) {
358 return tevent_req_post(req
, ev
);
360 /* wait for subreq completion */
361 tevent_req_set_callback(state
->subreq
,
362 btrfs_offload_write_done
,
367 DEBUG(5, ("BTRFS_IOC_CLONE_RANGE returned %d\n", ret
));
368 /* BTRFS_IOC_CLONE_RANGE is all or nothing */
370 tevent_req_done(req
);
371 return tevent_req_post(req
, ev
);
374 /* only used if the request is passed through to next VFS module */
375 static void btrfs_offload_write_done(struct tevent_req
*subreq
)
377 struct tevent_req
*req
=
378 tevent_req_callback_data(subreq
,
380 struct btrfs_offload_write_state
*state
=
382 struct btrfs_offload_write_state
);
385 status
= SMB_VFS_NEXT_OFFLOAD_WRITE_RECV(state
->handle
,
388 if (tevent_req_nterror(req
, status
)) {
391 tevent_req_done(req
);
394 static NTSTATUS
btrfs_offload_write_recv(struct vfs_handle_struct
*handle
,
395 struct tevent_req
*req
,
398 struct btrfs_offload_write_state
*state
=
400 struct btrfs_offload_write_state
);
403 if (tevent_req_is_nterror(req
, &status
)) {
404 DEBUG(4, ("server side copy chunk failed: %s\n",
406 tevent_req_received(req
);
410 DEBUG(10, ("server side copy chunk copied %llu\n",
411 (unsigned long long)state
->copied
));
412 *copied
= state
->copied
;
413 tevent_req_received(req
);
418 * caller must pass a non-null fsp or smb_fname. If fsp is null, then
419 * fall back to opening the corresponding file to issue the ioctl.
421 static NTSTATUS
btrfs_get_compression(struct vfs_handle_struct
*handle
,
423 struct files_struct
*fsp
,
424 struct smb_filename
*smb_fname
,
425 uint16_t *_compression_fmt
)
434 if ((fsp
!= NULL
) && (fsp
->fh
->fd
!= -1)) {
436 } else if (smb_fname
!= NULL
) {
437 if (S_ISDIR(smb_fname
->st
.st_ex_mode
)) {
438 dir
= opendir(smb_fname
->base_name
);
440 return NT_STATUS_UNSUCCESSFUL
;
445 status
= NT_STATUS_UNSUCCESSFUL
;
449 fd
= open(smb_fname
->base_name
, O_RDONLY
);
451 return NT_STATUS_UNSUCCESSFUL
;
456 return NT_STATUS_INVALID_PARAMETER
;
459 ret
= ioctl(fd
, FS_IOC_GETFLAGS
, &flags
);
461 DEBUG(1, ("FS_IOC_GETFLAGS failed: %s, fd %lld\n",
462 strerror(errno
), (long long)fd
));
463 status
= map_nt_error_from_unix(errno
);
466 if (flags
& FS_COMPR_FL
) {
467 *_compression_fmt
= COMPRESSION_FORMAT_LZNT1
;
469 *_compression_fmt
= COMPRESSION_FORMAT_NONE
;
471 status
= NT_STATUS_OK
;
484 static NTSTATUS
btrfs_set_compression(struct vfs_handle_struct
*handle
,
486 struct files_struct
*fsp
,
487 uint16_t compression_fmt
)
494 if ((fsp
== NULL
) || (fsp
->fh
->fd
== -1)) {
495 status
= NT_STATUS_INVALID_PARAMETER
;
500 ret
= ioctl(fd
, FS_IOC_GETFLAGS
, &flags
);
502 DEBUG(1, ("FS_IOC_GETFLAGS failed: %s, fd %d\n",
503 strerror(errno
), fd
));
504 status
= map_nt_error_from_unix(errno
);
508 if (compression_fmt
== COMPRESSION_FORMAT_NONE
) {
509 DEBUG(5, ("setting compression\n"));
510 flags
&= (~FS_COMPR_FL
);
511 } else if ((compression_fmt
== COMPRESSION_FORMAT_DEFAULT
)
512 || (compression_fmt
== COMPRESSION_FORMAT_LZNT1
)) {
513 DEBUG(5, ("clearing compression\n"));
514 flags
|= FS_COMPR_FL
;
516 DEBUG(1, ("invalid compression format 0x%x\n",
517 (int)compression_fmt
));
518 status
= NT_STATUS_INVALID_PARAMETER
;
522 ret
= ioctl(fd
, FS_IOC_SETFLAGS
, &flags
);
524 DEBUG(1, ("FS_IOC_SETFLAGS failed: %s, fd %d\n",
525 strerror(errno
), fd
));
526 status
= map_nt_error_from_unix(errno
);
529 status
= NT_STATUS_OK
;
535 * Check whether a path can be shadow copied. Return the base volume, allowing
536 * the caller to determine if multiple paths lie on the same base volume.
538 #define BTRFS_INODE_SUBVOL 256
539 static NTSTATUS
btrfs_snap_check_path(struct vfs_handle_struct
*handle
,
541 const char *service_path
,
547 if (!lp_parm_bool(SNUM(handle
->conn
),
548 "btrfs", "manipulate snapshots", false)) {
549 DEBUG(2, ("Btrfs snapshot manipulation disabled, passing\n"));
550 return SMB_VFS_NEXT_SNAP_CHECK_PATH(handle
, mem_ctx
,
551 service_path
, base_volume
);
554 /* btrfs userspace uses this logic to confirm subvolume */
555 if (stat(service_path
, &st
) < 0) {
556 return NT_STATUS_NOT_SUPPORTED
;
558 if ((st
.st_ino
!= BTRFS_INODE_SUBVOL
) || !S_ISDIR(st
.st_mode
)) {
559 DEBUG(0, ("%s not a btrfs subvolume, snapshots not available\n",
561 return NT_STATUS_NOT_SUPPORTED
;
564 /* we "snapshot" the service path itself */
565 base
= talloc_strdup(mem_ctx
, service_path
);
567 return NT_STATUS_NO_MEMORY
;
574 static NTSTATUS
btrfs_gen_snap_dest_path(TALLOC_CTX
*mem_ctx
,
575 const char *src_path
,
577 char **dest_path
, char **subvolume
)
583 gmtime_r(tstamp
, &t_gmt
);
585 tlen
= strftime(time_str
, ARRAY_SIZE(time_str
),
586 SHADOW_COPY_PATH_FORMAT
, &t_gmt
);
588 return NT_STATUS_UNSUCCESSFUL
;
591 *dest_path
= talloc_strdup(mem_ctx
, src_path
);
592 *subvolume
= talloc_strdup(mem_ctx
, time_str
);
593 if ((*dest_path
== NULL
) || (*subvolume
== NULL
)) {
594 return NT_STATUS_NO_MEMORY
;
600 static NTSTATUS
btrfs_snap_create(struct vfs_handle_struct
*handle
,
602 const char *base_volume
,
608 struct btrfs_ioctl_vol_args_v2 ioctl_arg
;
613 char *dest_path
= NULL
;
614 char *dest_subvolume
= NULL
;
623 if (!lp_parm_bool(SNUM(handle
->conn
),
624 "btrfs", "manipulate snapshots", false)) {
625 DEBUG(2, ("Btrfs snapshot manipulation disabled, passing\n"));
626 return SMB_VFS_NEXT_SNAP_CREATE(handle
, mem_ctx
, base_volume
,
627 tstamp
, rw
, _base_path
,
631 tmp_ctx
= talloc_new(mem_ctx
);
632 if (tmp_ctx
== NULL
) {
633 return NT_STATUS_NO_MEMORY
;
636 base_path
= talloc_strdup(tmp_ctx
, base_volume
);
637 if (base_path
== NULL
) {
638 talloc_free(tmp_ctx
);
639 return NT_STATUS_NO_MEMORY
;
642 status
= btrfs_gen_snap_dest_path(tmp_ctx
, base_volume
, tstamp
,
643 &dest_path
, &dest_subvolume
);
644 if (!NT_STATUS_IS_OK(status
)) {
645 talloc_free(tmp_ctx
);
649 snap_path
= talloc_asprintf(tmp_ctx
, "%s/%s", dest_path
,
651 if (snap_path
== NULL
) {
652 talloc_free(tmp_ctx
);
653 return NT_STATUS_NO_MEMORY
;
656 src_dir
= opendir(base_volume
);
657 if (src_dir
== NULL
) {
658 DEBUG(0, ("snap src %s open failed: %s\n",
659 base_volume
, strerror(errno
)));
660 status
= map_nt_error_from_unix(errno
);
661 talloc_free(tmp_ctx
);
664 src_fd
= dirfd(src_dir
);
666 status
= map_nt_error_from_unix(errno
);
668 talloc_free(tmp_ctx
);
672 dest_dir
= opendir(dest_path
);
673 if (dest_dir
== NULL
) {
674 DEBUG(0, ("snap dest %s open failed: %s\n",
675 dest_path
, strerror(errno
)));
676 status
= map_nt_error_from_unix(errno
);
678 talloc_free(tmp_ctx
);
681 dest_fd
= dirfd(dest_dir
);
683 status
= map_nt_error_from_unix(errno
);
686 talloc_free(tmp_ctx
);
690 /* avoid zeroing the entire struct here, name is 4k */
691 ioctl_arg
.fd
= src_fd
;
692 ioctl_arg
.transid
= 0;
693 ioctl_arg
.flags
= (rw
== false) ? BTRFS_SUBVOL_RDONLY
: 0;
694 memset(ioctl_arg
.unused
, 0, sizeof(ioctl_arg
.unused
));
695 len
= strlcpy(ioctl_arg
.name
, dest_subvolume
,
696 ARRAY_SIZE(ioctl_arg
.name
));
697 if (len
>= ARRAY_SIZE(ioctl_arg
.name
)) {
698 DEBUG(1, ("subvolume name too long for SNAP_CREATE ioctl\n"));
701 talloc_free(tmp_ctx
);
702 return NT_STATUS_INVALID_PARAMETER
;
706 ret
= ioctl(dest_fd
, BTRFS_IOC_SNAP_CREATE_V2
, &ioctl_arg
);
710 DEBUG(0, ("%s -> %s(%s) BTRFS_IOC_SNAP_CREATE_V2 failed: %s\n",
711 base_volume
, dest_path
, dest_subvolume
,
712 strerror(saved_errno
)));
713 status
= map_nt_error_from_unix(saved_errno
);
716 talloc_free(tmp_ctx
);
719 DEBUG(5, ("%s -> %s(%s) BTRFS_IOC_SNAP_CREATE_V2 done\n",
720 base_volume
, dest_path
, dest_subvolume
));
722 *_base_path
= talloc_steal(mem_ctx
, base_path
);
723 *_snap_path
= talloc_steal(mem_ctx
, snap_path
);
726 talloc_free(tmp_ctx
);
731 static NTSTATUS
btrfs_snap_delete(struct vfs_handle_struct
*handle
,
740 struct btrfs_ioctl_vol_args ioctl_arg
;
749 if (!lp_parm_bool(SNUM(handle
->conn
),
750 "btrfs", "manipulate snapshots", false)) {
751 DEBUG(2, ("Btrfs snapshot manipulation disabled, passing\n"));
752 return SMB_VFS_NEXT_SNAP_DELETE(handle
, mem_ctx
,
753 base_path
, snap_path
);
756 tmp_ctx
= talloc_new(mem_ctx
);
757 if (tmp_ctx
== NULL
) {
758 return NT_STATUS_NO_MEMORY
;
761 dest_path
= talloc_strdup(tmp_ctx
, snap_path
);
762 if (dest_path
== NULL
) {
763 talloc_free(tmp_ctx
);
764 return NT_STATUS_NO_MEMORY
;
766 subvolume
= talloc_strdup(tmp_ctx
, snap_path
);
767 if (subvolume
== NULL
) {
768 talloc_free(tmp_ctx
);
769 return NT_STATUS_NO_MEMORY
;
771 dest_path
= dirname(dest_path
);
772 subvolume
= basename(subvolume
);
774 /* confirm snap_path matches creation format */
775 tstr
= strptime(subvolume
, SHADOW_COPY_PATH_FORMAT
, &t_gmt
);
776 if ((tstr
== NULL
) || (*tstr
!= '\0')) {
777 DEBUG(0, ("snapshot path %s does not match creation format\n",
779 talloc_free(tmp_ctx
);
780 return NT_STATUS_UNSUCCESSFUL
;
783 dest_dir
= opendir(dest_path
);
784 if (dest_dir
== NULL
) {
785 DEBUG(0, ("snap destroy dest %s open failed: %s\n",
786 dest_path
, strerror(errno
)));
787 status
= map_nt_error_from_unix(errno
);
788 talloc_free(tmp_ctx
);
791 dest_fd
= dirfd(dest_dir
);
793 status
= map_nt_error_from_unix(errno
);
795 talloc_free(tmp_ctx
);
799 ioctl_arg
.fd
= -1; /* not needed */
800 len
= strlcpy(ioctl_arg
.name
, subvolume
, ARRAY_SIZE(ioctl_arg
.name
));
801 if (len
>= ARRAY_SIZE(ioctl_arg
.name
)) {
802 DEBUG(1, ("subvolume name too long for SNAP_DESTROY ioctl\n"));
804 talloc_free(tmp_ctx
);
805 return NT_STATUS_INVALID_PARAMETER
;
809 ret
= ioctl(dest_fd
, BTRFS_IOC_SNAP_DESTROY
, &ioctl_arg
);
813 DEBUG(0, ("%s(%s) BTRFS_IOC_SNAP_DESTROY failed: %s\n",
814 dest_path
, subvolume
, strerror(saved_errno
)));
815 status
= map_nt_error_from_unix(saved_errno
);
817 talloc_free(tmp_ctx
);
820 DEBUG(5, ("%s(%s) BTRFS_IOC_SNAP_DESTROY done\n",
821 dest_path
, subvolume
));
824 talloc_free(tmp_ctx
);
828 static struct vfs_fn_pointers btrfs_fns
= {
829 .fs_capabilities_fn
= btrfs_fs_capabilities
,
830 .offload_read_send_fn
= btrfs_offload_read_send
,
831 .offload_read_recv_fn
= btrfs_offload_read_recv
,
832 .offload_write_send_fn
= btrfs_offload_write_send
,
833 .offload_write_recv_fn
= btrfs_offload_write_recv
,
834 .get_compression_fn
= btrfs_get_compression
,
835 .set_compression_fn
= btrfs_set_compression
,
836 .snap_check_path_fn
= btrfs_snap_check_path
,
837 .snap_create_fn
= btrfs_snap_create
,
838 .snap_delete_fn
= btrfs_snap_delete
,
842 NTSTATUS
vfs_btrfs_init(TALLOC_CTX
*ctx
)
844 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION
,
845 "btrfs", &btrfs_fns
);