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_cc_state
{
200 struct vfs_handle_struct
*handle
;
202 struct tevent_req
*subreq
; /* non-null if passed to next VFS fn */
204 static void btrfs_copy_chunk_done(struct tevent_req
*subreq
);
206 static struct tevent_req
*btrfs_copy_chunk_send(struct vfs_handle_struct
*handle
,
208 struct tevent_context
*ev
,
209 struct files_struct
*src_fsp
,
211 struct files_struct
*dest_fsp
,
216 struct tevent_req
*req
;
217 struct btrfs_cc_state
*cc_state
;
218 struct btrfs_ioctl_clone_range_args cr_args
;
219 struct lock_struct src_lck
;
220 struct lock_struct dest_lck
;
224 req
= tevent_req_create(mem_ctx
, &cc_state
, struct btrfs_cc_state
);
229 if (flags
& ~VFS_COPY_CHUNK_FL_MASK_ALL
) {
230 tevent_req_nterror(req
, NT_STATUS_INVALID_PARAMETER
);
231 return tevent_req_post(req
, ev
);
234 cc_state
->handle
= handle
;
238 * With a @src_length of zero, BTRFS_IOC_CLONE_RANGE clones
239 * all data from @src_offset->EOF! This is certainly not what
240 * the caller expects, and not what vfs_default does.
242 cc_state
->subreq
= SMB_VFS_NEXT_COPY_CHUNK_SEND(handle
,
249 if (tevent_req_nomem(cc_state
->subreq
, req
)) {
250 return tevent_req_post(req
, ev
);
252 tevent_req_set_callback(cc_state
->subreq
,
253 btrfs_copy_chunk_done
,
258 status
= vfs_stat_fsp(src_fsp
);
259 if (tevent_req_nterror(req
, status
)) {
260 return tevent_req_post(req
, ev
);
263 if (src_fsp
->fsp_name
->st
.st_ex_size
< src_off
+ num
) {
264 /* [MS-SMB2] Handling a Server-Side Data Copy Request */
265 tevent_req_nterror(req
, NT_STATUS_INVALID_VIEW_SIZE
);
266 return tevent_req_post(req
, ev
);
269 if (src_fsp
->op
== NULL
|| dest_fsp
->op
== NULL
) {
270 tevent_req_nterror(req
, NT_STATUS_INTERNAL_ERROR
);
271 return tevent_req_post(req
, ev
);
274 if (!(flags
& VFS_COPY_CHUNK_FL_IGNORE_LOCKS
)) {
275 init_strict_lock_struct(src_fsp
,
276 src_fsp
->op
->global
->open_persistent_id
,
281 init_strict_lock_struct(dest_fsp
,
282 dest_fsp
->op
->global
->open_persistent_id
,
288 if (!SMB_VFS_STRICT_LOCK(src_fsp
->conn
, src_fsp
, &src_lck
)) {
289 tevent_req_nterror(req
, NT_STATUS_FILE_LOCK_CONFLICT
);
290 return tevent_req_post(req
, ev
);
292 if (!SMB_VFS_STRICT_LOCK(dest_fsp
->conn
, dest_fsp
, &dest_lck
)) {
293 SMB_VFS_STRICT_UNLOCK(src_fsp
->conn
, src_fsp
, &src_lck
);
294 tevent_req_nterror(req
, NT_STATUS_FILE_LOCK_CONFLICT
);
295 return tevent_req_post(req
, ev
);
299 ZERO_STRUCT(cr_args
);
300 cr_args
.src_fd
= src_fsp
->fh
->fd
;
301 cr_args
.src_offset
= (uint64_t)src_off
;
302 cr_args
.dest_offset
= (uint64_t)dest_off
;
303 cr_args
.src_length
= (uint64_t)num
;
305 ret
= ioctl(dest_fsp
->fh
->fd
, BTRFS_IOC_CLONE_RANGE
, &cr_args
);
306 if (!(flags
& VFS_COPY_CHUNK_FL_IGNORE_LOCKS
)) {
307 SMB_VFS_STRICT_UNLOCK(dest_fsp
->conn
, dest_fsp
, &dest_lck
);
308 SMB_VFS_STRICT_UNLOCK(src_fsp
->conn
, src_fsp
, &src_lck
);
312 * BTRFS_IOC_CLONE_RANGE only supports 'sectorsize' aligned
313 * cloning. Which is 4096 by default, therefore fall back to
314 * manual read/write on failure.
316 DEBUG(5, ("BTRFS_IOC_CLONE_RANGE failed: %s, length %llu, "
317 "src fd: %lld off: %llu, dest fd: %d off: %llu\n",
319 (unsigned long long)cr_args
.src_length
,
320 (long long)cr_args
.src_fd
,
321 (unsigned long long)cr_args
.src_offset
,
323 (unsigned long long)cr_args
.dest_offset
));
324 cc_state
->subreq
= SMB_VFS_NEXT_COPY_CHUNK_SEND(handle
,
331 if (tevent_req_nomem(cc_state
->subreq
, req
)) {
332 return tevent_req_post(req
, ev
);
334 /* wait for subreq completion */
335 tevent_req_set_callback(cc_state
->subreq
,
336 btrfs_copy_chunk_done
,
341 DEBUG(5, ("BTRFS_IOC_CLONE_RANGE returned %d\n", ret
));
342 /* BTRFS_IOC_CLONE_RANGE is all or nothing */
343 cc_state
->copied
= num
;
344 tevent_req_done(req
);
345 return tevent_req_post(req
, ev
);
348 /* only used if the request is passed through to next VFS module */
349 static void btrfs_copy_chunk_done(struct tevent_req
*subreq
)
351 struct tevent_req
*req
= tevent_req_callback_data(
352 subreq
, struct tevent_req
);
353 struct btrfs_cc_state
*cc_state
= tevent_req_data(req
,
354 struct btrfs_cc_state
);
357 status
= SMB_VFS_NEXT_COPY_CHUNK_RECV(cc_state
->handle
,
360 if (tevent_req_nterror(req
, status
)) {
363 tevent_req_done(req
);
366 static NTSTATUS
btrfs_copy_chunk_recv(struct vfs_handle_struct
*handle
,
367 struct tevent_req
*req
,
371 struct btrfs_cc_state
*cc_state
= tevent_req_data(req
,
372 struct btrfs_cc_state
);
374 if (tevent_req_is_nterror(req
, &status
)) {
375 DEBUG(4, ("server side copy chunk failed: %s\n",
377 tevent_req_received(req
);
381 DEBUG(10, ("server side copy chunk copied %llu\n",
382 (unsigned long long)cc_state
->copied
));
383 *copied
= cc_state
->copied
;
384 tevent_req_received(req
);
389 * caller must pass a non-null fsp or smb_fname. If fsp is null, then
390 * fall back to opening the corresponding file to issue the ioctl.
392 static NTSTATUS
btrfs_get_compression(struct vfs_handle_struct
*handle
,
394 struct files_struct
*fsp
,
395 struct smb_filename
*smb_fname
,
396 uint16_t *_compression_fmt
)
405 if ((fsp
!= NULL
) && (fsp
->fh
->fd
!= -1)) {
407 } else if (smb_fname
!= NULL
) {
408 if (S_ISDIR(smb_fname
->st
.st_ex_mode
)) {
409 dir
= opendir(smb_fname
->base_name
);
411 return NT_STATUS_UNSUCCESSFUL
;
416 status
= NT_STATUS_UNSUCCESSFUL
;
420 fd
= open(smb_fname
->base_name
, O_RDONLY
);
422 return NT_STATUS_UNSUCCESSFUL
;
427 return NT_STATUS_INVALID_PARAMETER
;
430 ret
= ioctl(fd
, FS_IOC_GETFLAGS
, &flags
);
432 DEBUG(1, ("FS_IOC_GETFLAGS failed: %s, fd %lld\n",
433 strerror(errno
), (long long)fd
));
434 status
= map_nt_error_from_unix(errno
);
437 if (flags
& FS_COMPR_FL
) {
438 *_compression_fmt
= COMPRESSION_FORMAT_LZNT1
;
440 *_compression_fmt
= COMPRESSION_FORMAT_NONE
;
442 status
= NT_STATUS_OK
;
455 static NTSTATUS
btrfs_set_compression(struct vfs_handle_struct
*handle
,
457 struct files_struct
*fsp
,
458 uint16_t compression_fmt
)
465 if ((fsp
== NULL
) || (fsp
->fh
->fd
== -1)) {
466 status
= NT_STATUS_INVALID_PARAMETER
;
471 ret
= ioctl(fd
, FS_IOC_GETFLAGS
, &flags
);
473 DEBUG(1, ("FS_IOC_GETFLAGS failed: %s, fd %d\n",
474 strerror(errno
), fd
));
475 status
= map_nt_error_from_unix(errno
);
479 if (compression_fmt
== COMPRESSION_FORMAT_NONE
) {
480 DEBUG(5, ("setting compression\n"));
481 flags
&= (~FS_COMPR_FL
);
482 } else if ((compression_fmt
== COMPRESSION_FORMAT_DEFAULT
)
483 || (compression_fmt
== COMPRESSION_FORMAT_LZNT1
)) {
484 DEBUG(5, ("clearing compression\n"));
485 flags
|= FS_COMPR_FL
;
487 DEBUG(1, ("invalid compression format 0x%x\n",
488 (int)compression_fmt
));
489 status
= NT_STATUS_INVALID_PARAMETER
;
493 ret
= ioctl(fd
, FS_IOC_SETFLAGS
, &flags
);
495 DEBUG(1, ("FS_IOC_SETFLAGS failed: %s, fd %d\n",
496 strerror(errno
), fd
));
497 status
= map_nt_error_from_unix(errno
);
500 status
= NT_STATUS_OK
;
506 * Check whether a path can be shadow copied. Return the base volume, allowing
507 * the caller to determine if multiple paths lie on the same base volume.
509 #define BTRFS_INODE_SUBVOL 256
510 static NTSTATUS
btrfs_snap_check_path(struct vfs_handle_struct
*handle
,
512 const char *service_path
,
518 if (!lp_parm_bool(SNUM(handle
->conn
),
519 "btrfs", "manipulate snapshots", false)) {
520 DEBUG(2, ("Btrfs snapshot manipulation disabled, passing\n"));
521 return SMB_VFS_NEXT_SNAP_CHECK_PATH(handle
, mem_ctx
,
522 service_path
, base_volume
);
525 /* btrfs userspace uses this logic to confirm subvolume */
526 if (stat(service_path
, &st
) < 0) {
527 return NT_STATUS_NOT_SUPPORTED
;
529 if ((st
.st_ino
!= BTRFS_INODE_SUBVOL
) || !S_ISDIR(st
.st_mode
)) {
530 DEBUG(0, ("%s not a btrfs subvolume, snapshots not available\n",
532 return NT_STATUS_NOT_SUPPORTED
;
535 /* we "snapshot" the service path itself */
536 base
= talloc_strdup(mem_ctx
, service_path
);
538 return NT_STATUS_NO_MEMORY
;
545 static NTSTATUS
btrfs_gen_snap_dest_path(TALLOC_CTX
*mem_ctx
,
546 const char *src_path
,
548 char **dest_path
, char **subvolume
)
554 gmtime_r(tstamp
, &t_gmt
);
556 tlen
= strftime(time_str
, ARRAY_SIZE(time_str
),
557 SHADOW_COPY_PATH_FORMAT
, &t_gmt
);
559 return NT_STATUS_UNSUCCESSFUL
;
562 *dest_path
= talloc_strdup(mem_ctx
, src_path
);
563 *subvolume
= talloc_strdup(mem_ctx
, time_str
);
564 if ((*dest_path
== NULL
) || (*subvolume
== NULL
)) {
565 return NT_STATUS_NO_MEMORY
;
571 static NTSTATUS
btrfs_snap_create(struct vfs_handle_struct
*handle
,
573 const char *base_volume
,
579 struct btrfs_ioctl_vol_args_v2 ioctl_arg
;
584 char *dest_path
= NULL
;
585 char *dest_subvolume
= NULL
;
594 if (!lp_parm_bool(SNUM(handle
->conn
),
595 "btrfs", "manipulate snapshots", false)) {
596 DEBUG(2, ("Btrfs snapshot manipulation disabled, passing\n"));
597 return SMB_VFS_NEXT_SNAP_CREATE(handle
, mem_ctx
, base_volume
,
598 tstamp
, rw
, _base_path
,
602 tmp_ctx
= talloc_new(mem_ctx
);
603 if (tmp_ctx
== NULL
) {
604 return NT_STATUS_NO_MEMORY
;
607 base_path
= talloc_strdup(tmp_ctx
, base_volume
);
608 if (base_path
== NULL
) {
609 talloc_free(tmp_ctx
);
610 return NT_STATUS_NO_MEMORY
;
613 status
= btrfs_gen_snap_dest_path(tmp_ctx
, base_volume
, tstamp
,
614 &dest_path
, &dest_subvolume
);
615 if (!NT_STATUS_IS_OK(status
)) {
616 talloc_free(tmp_ctx
);
620 snap_path
= talloc_asprintf(tmp_ctx
, "%s/%s", dest_path
,
622 if (snap_path
== NULL
) {
623 talloc_free(tmp_ctx
);
624 return NT_STATUS_NO_MEMORY
;
627 src_dir
= opendir(base_volume
);
628 if (src_dir
== NULL
) {
629 DEBUG(0, ("snap src %s open failed: %s\n",
630 base_volume
, strerror(errno
)));
631 status
= map_nt_error_from_unix(errno
);
632 talloc_free(tmp_ctx
);
635 src_fd
= dirfd(src_dir
);
637 status
= map_nt_error_from_unix(errno
);
639 talloc_free(tmp_ctx
);
643 dest_dir
= opendir(dest_path
);
644 if (dest_dir
== NULL
) {
645 DEBUG(0, ("snap dest %s open failed: %s\n",
646 dest_path
, strerror(errno
)));
647 status
= map_nt_error_from_unix(errno
);
649 talloc_free(tmp_ctx
);
652 dest_fd
= dirfd(dest_dir
);
654 status
= map_nt_error_from_unix(errno
);
657 talloc_free(tmp_ctx
);
661 /* avoid zeroing the entire struct here, name is 4k */
662 ioctl_arg
.fd
= src_fd
;
663 ioctl_arg
.transid
= 0;
664 ioctl_arg
.flags
= (rw
== false) ? BTRFS_SUBVOL_RDONLY
: 0;
665 memset(ioctl_arg
.unused
, 0, sizeof(ioctl_arg
.unused
));
666 len
= strlcpy(ioctl_arg
.name
, dest_subvolume
,
667 ARRAY_SIZE(ioctl_arg
.name
));
668 if (len
>= ARRAY_SIZE(ioctl_arg
.name
)) {
669 DEBUG(1, ("subvolume name too long for SNAP_CREATE ioctl\n"));
672 talloc_free(tmp_ctx
);
673 return NT_STATUS_INVALID_PARAMETER
;
677 ret
= ioctl(dest_fd
, BTRFS_IOC_SNAP_CREATE_V2
, &ioctl_arg
);
681 DEBUG(0, ("%s -> %s(%s) BTRFS_IOC_SNAP_CREATE_V2 failed: %s\n",
682 base_volume
, dest_path
, dest_subvolume
,
683 strerror(saved_errno
)));
684 status
= map_nt_error_from_unix(saved_errno
);
687 talloc_free(tmp_ctx
);
690 DEBUG(5, ("%s -> %s(%s) BTRFS_IOC_SNAP_CREATE_V2 done\n",
691 base_volume
, dest_path
, dest_subvolume
));
693 *_base_path
= talloc_steal(mem_ctx
, base_path
);
694 *_snap_path
= talloc_steal(mem_ctx
, snap_path
);
697 talloc_free(tmp_ctx
);
702 static NTSTATUS
btrfs_snap_delete(struct vfs_handle_struct
*handle
,
711 struct btrfs_ioctl_vol_args ioctl_arg
;
720 if (!lp_parm_bool(SNUM(handle
->conn
),
721 "btrfs", "manipulate snapshots", false)) {
722 DEBUG(2, ("Btrfs snapshot manipulation disabled, passing\n"));
723 return SMB_VFS_NEXT_SNAP_DELETE(handle
, mem_ctx
,
724 base_path
, snap_path
);
727 tmp_ctx
= talloc_new(mem_ctx
);
728 if (tmp_ctx
== NULL
) {
729 return NT_STATUS_NO_MEMORY
;
732 dest_path
= talloc_strdup(tmp_ctx
, snap_path
);
733 if (dest_path
== NULL
) {
734 talloc_free(tmp_ctx
);
735 return NT_STATUS_NO_MEMORY
;
737 subvolume
= talloc_strdup(tmp_ctx
, snap_path
);
738 if (subvolume
== NULL
) {
739 talloc_free(tmp_ctx
);
740 return NT_STATUS_NO_MEMORY
;
742 dest_path
= dirname(dest_path
);
743 subvolume
= basename(subvolume
);
745 /* confirm snap_path matches creation format */
746 tstr
= strptime(subvolume
, SHADOW_COPY_PATH_FORMAT
, &t_gmt
);
747 if ((tstr
== NULL
) || (*tstr
!= '\0')) {
748 DEBUG(0, ("snapshot path %s does not match creation format\n",
750 talloc_free(tmp_ctx
);
751 return NT_STATUS_UNSUCCESSFUL
;
754 dest_dir
= opendir(dest_path
);
755 if (dest_dir
== NULL
) {
756 DEBUG(0, ("snap destroy dest %s open failed: %s\n",
757 dest_path
, strerror(errno
)));
758 status
= map_nt_error_from_unix(errno
);
759 talloc_free(tmp_ctx
);
762 dest_fd
= dirfd(dest_dir
);
764 status
= map_nt_error_from_unix(errno
);
766 talloc_free(tmp_ctx
);
770 ioctl_arg
.fd
= -1; /* not needed */
771 len
= strlcpy(ioctl_arg
.name
, subvolume
, ARRAY_SIZE(ioctl_arg
.name
));
772 if (len
>= ARRAY_SIZE(ioctl_arg
.name
)) {
773 DEBUG(1, ("subvolume name too long for SNAP_DESTROY ioctl\n"));
775 talloc_free(tmp_ctx
);
776 return NT_STATUS_INVALID_PARAMETER
;
780 ret
= ioctl(dest_fd
, BTRFS_IOC_SNAP_DESTROY
, &ioctl_arg
);
784 DEBUG(0, ("%s(%s) BTRFS_IOC_SNAP_DESTROY failed: %s\n",
785 dest_path
, subvolume
, strerror(saved_errno
)));
786 status
= map_nt_error_from_unix(saved_errno
);
788 talloc_free(tmp_ctx
);
791 DEBUG(5, ("%s(%s) BTRFS_IOC_SNAP_DESTROY done\n",
792 dest_path
, subvolume
));
795 talloc_free(tmp_ctx
);
799 static struct vfs_fn_pointers btrfs_fns
= {
800 .fs_capabilities_fn
= btrfs_fs_capabilities
,
801 .offload_read_send_fn
= btrfs_offload_read_send
,
802 .offload_read_recv_fn
= btrfs_offload_read_recv
,
803 .copy_chunk_send_fn
= btrfs_copy_chunk_send
,
804 .copy_chunk_recv_fn
= btrfs_copy_chunk_recv
,
805 .get_compression_fn
= btrfs_get_compression
,
806 .set_compression_fn
= btrfs_set_compression
,
807 .snap_check_path_fn
= btrfs_snap_check_path
,
808 .snap_create_fn
= btrfs_snap_create
,
809 .snap_delete_fn
= btrfs_snap_delete
,
812 NTSTATUS
vfs_btrfs_init(TALLOC_CTX
*);
813 NTSTATUS
vfs_btrfs_init(TALLOC_CTX
*ctx
)
815 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION
,
816 "btrfs", &btrfs_fns
);