[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200612001334.GB18185@gmail.com>
Date: Thu, 11 Jun 2020 17:13:34 -0700
From: Eric Biggers <ebiggers@...nel.org>
To: Daeho Jeong <daeho43@...il.com>
Cc: linux-kernel@...r.kernel.org,
linux-f2fs-devel@...ts.sourceforge.net, kernel-team@...roid.com,
Daeho Jeong <daehojeong@...gle.com>
Subject: Re: [f2fs-dev] [PATCH v2] f2fs: add F2FS_IOC_SEC_TRIM_FILE ioctl
On Fri, Jun 12, 2020 at 09:00:58AM +0900, Daeho Jeong wrote:
> For the incremental way of erasing, we might as well support the
> (offset, length) option in a unit of 4KiB.
>
> So, you might use this ioctl like the below. Does it work for you?
> struct f2fs_sec_trim {
> u64 startblk;
> u64 blklen;
> u32 flags;
> };
>
> sectrim.startblk = 0;
> sectrim.blklen = 256; // 1MiB
> sectrim.flags = F2FS_TRIM_FILE_DISCARD | F2FS_TRIM_FILE_ZEROOUT;
> ret = ioctl(fd, F2FS_SEC_TRIM_FILE, §rim);
Most filesystem ioctls and syscalls take offsets and lengths in bytes,
especially newer ones. This way implementations of these APIs can support other
alignments later. The implementation can still require alignment for now, i.e.
return -EINVAL if !IS_ALIGNED(arg.pos | arg.len, sb->s_blocksize).
Also, flags should be a u64, especially since it wouldn't actually increase the
size of the struct (due to padding).
- Eric
Powered by blists - more mailing lists