@@ -953,15 +953,15 @@ target file and the timing. The user can do manual compression/decompression on
953953compression enabled files using F2FS_IOC_DECOMPRESS_FILE and F2FS_IOC_COMPRESS_FILE
954954ioctls like the below.
955955
956- To decompress a file,
956+ To decompress a file::
957957
958- fd = open(filename, O_WRONLY, 0);
959- ret = ioctl(fd, F2FS_IOC_DECOMPRESS_FILE);
958+ fd = open(filename, O_WRONLY, 0);
959+ ret = ioctl(fd, F2FS_IOC_DECOMPRESS_FILE);
960960
961- To compress a file,
961+ To compress a file::
962962
963- fd = open(filename, O_WRONLY, 0);
964- ret = ioctl(fd, F2FS_IOC_COMPRESS_FILE);
963+ fd = open(filename, O_WRONLY, 0);
964+ ret = ioctl(fd, F2FS_IOC_COMPRESS_FILE);
965965
966966NVMe Zoned Namespace devices
967967----------------------------
@@ -991,32 +991,32 @@ reserved and used by another filesystem or for different purposes. Once that
991991external usage is complete, the device aliasing file can be deleted, releasing
992992the reserved space back to F2FS for its own use.
993993
994- <use-case>
995-
996- # ls /dev/vd*
997- /dev/vdb (32GB) /dev/vdc (32GB)
998- # mkfs.ext4 /dev/vdc
999- # mkfs.f2fs -c /dev/vdc@vdc.file /dev/vdb
1000- # mount /dev/vdb /mnt/f2fs
1001- # ls -l /mnt/f2fs
1002- vdc.file
1003- # df -h
1004- /dev/vdb 64G 33G 32G 52% /mnt/f2fs
1005-
1006- # mount -o loop /dev/vdc /mnt/ext4
1007- # df -h
1008- /dev/vdb 64G 33G 32G 52% /mnt/f2fs
1009- /dev/loop7 32G 24K 30G 1% /mnt/ext4
1010- # umount /mnt/ext4
1011-
1012- # f2fs_io getflags /mnt/f2fs/vdc.file
1013- get a flag on /mnt/f2fs/vdc.file ret=0, flags=nocow(pinned),immutable
1014- # f2fs_io setflags noimmutable /mnt/f2fs/vdc.file
1015- get a flag on noimmutable ret=0, flags=800010
1016- set a flag on /mnt/f2fs/vdc.file ret=0, flags=noimmutable
1017- # rm /mnt/f2fs/vdc.file
1018- # df -h
1019- /dev/vdb 64G 753M 64G 2% /mnt/f2fs
994+ .. code-block ::
995+
996+ # ls /dev/vd*
997+ /dev/vdb (32GB) /dev/vdc (32GB)
998+ # mkfs.ext4 /dev/vdc
999+ # mkfs.f2fs -c /dev/vdc@vdc.file /dev/vdb
1000+ # mount /dev/vdb /mnt/f2fs
1001+ # ls -l /mnt/f2fs
1002+ vdc.file
1003+ # df -h
1004+ /dev/vdb 64G 33G 32G 52% /mnt/f2fs
1005+
1006+ # mount -o loop /dev/vdc /mnt/ext4
1007+ # df -h
1008+ /dev/vdb 64G 33G 32G 52% /mnt/f2fs
1009+ /dev/loop7 32G 24K 30G 1% /mnt/ext4
1010+ # umount /mnt/ext4
1011+
1012+ # f2fs_io getflags /mnt/f2fs/vdc.file
1013+ get a flag on /mnt/f2fs/vdc.file ret=0, flags=nocow(pinned),immutable
1014+ # f2fs_io setflags noimmutable /mnt/f2fs/vdc.file
1015+ get a flag on noimmutable ret=0, flags=800010
1016+ set a flag on /mnt/f2fs/vdc.file ret=0, flags=noimmutable
1017+ # rm /mnt/f2fs/vdc.file
1018+ # df -h
1019+ /dev/vdb 64G 753M 64G 2% /mnt/f2fs
10201020
10211021 So, the key idea is, user can do any file operations on /dev/vdc, and
10221022reclaim the space after the use, while the space is counted as /data.
0 commit comments