[Btrfs-devel][PATCH]Fix for btrfs_drop_extents

Chris Mason chris.mason at oracle.com
Wed Jan 30 10:59:32 PST 2008


On Wednesday 30 January 2008, Yan Zheng wrote:
> Hello,
>
> The test case in previous mail doesn't work due to changes recently
> pushed out. Here is the new test case.

Thanks, this patch looks right to me, I'll test it out and apply it.

-chris

>
> Regards
> YZ
> ---
> #include <sys/types.h>
> #include <sys/stat.h>
> #include <fcntl.h>
> #include <unistd.h>
> #include <stdio.h>
> #include <stdlib.h>
>
> int main(int argc, char *argv[])
> {
> 	int fd;
> 	int ret;
> 	char buf[8192];
>
> 	fd = open(argv[1], O_RDWR | O_CREAT | O_EXCL, 0644);
> 	if (fd < 0) {
> 		perror("open");
> 		exit(1);
> 	}
> 	/* create inline extent */
> 	ret = pwrite(fd, buf, 1024 * 6 - 1, 4096);
> 	if (ret < 0) {
> 		perror("write");
> 		exit(1);
> 	}
> 	/* disable packing of data */
> 	ret = pwrite(fd, buf, 4096, 32768);
> 	if (ret < 0) {
> 		perror("write");
> 		exit(1);
> 	}
> 	/* drop file extents in range 0 ~ 8192 */
> 	ret = pwrite(fd, buf, 8192, 0);
> 	if (ret < 0) {
> 		perror("write");
> 		exit(1);
> 	}
> 	close(fd);
> 	return 0;
> }
>
> _______________________________________________
> Btrfs-devel mailing list
> Btrfs-devel at oss.oracle.com
> http://oss.oracle.com/mailman/listinfo/btrfs-devel





More information about the Btrfs-devel mailing list