linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [f2fs-dev] f2fs: How should I use the defragmentation tools?
@ 2019-12-09 22:18 Ju Hyung Park
  2019-12-09 22:46 ` Jaegeuk Kim
  0 siblings, 1 reply; 2+ messages in thread
From: Ju Hyung Park @ 2019-12-09 22:18 UTC (permalink / raw)
  To: linux-f2fs-devel, Jaegeuk Kim, Chao Yu

Hi everyone.

I've had interests in defragging f2fs for a long time now.

https://www.usenix.org/system/files/conference/atc17/atc17-hahn.pdf
This paper proves that defragmentation caused from the filesystem
takes a big portion of performance degradation.
(It'd be interesting to see whether f2fs would behave differently from
ext4 in terms of fragmentation.)

While doing defragmentation on a production device currently poses a
lot of practicality issues, I'd still like to try them out for
educational purposes.

However, I'm still not sure how to do defragmentation while f2fs
having 2 tools for that purpose.

1. Is either of `defrag.f2fs` or `f2fs_io defrag_file` meant to be
feature-parity with e4defrag?

2. What's the expected output from `defrag.f2fs` and `f2fs_io
defrag_file`? I'd like to get example outputs from you guys for me to
compare.

3. Is `defrag.f2fs` and `f2fs_io defrag_file` tested thoroughly?
Should I expect any potential corruptions from running these?

4. `defrag.f2fs` seems to only work on an unmounted block device.
What's the intended use-case scenario for this? I'm assuming running
`defrag.f2fs` and feeding the entire block length to -l is not how
it's meant to be used.

5. Why did you make it mandatory for the users to supply the lengths
to `f2fs_io defrag_file`? Is it any practical to defrag a part of a
file?

6. How exactly should I run `f2fs_io defrag_file`? My following
attempts failed with -EINVAL:
# ls -al session-02.pdf
-rw-rw-r--. 1 1023 1023 30517375 Nov  7 21:10 session-02.pdf
# f2fs_io defrag_file 0 30517375 session-02.pdf
F2FS_IOC_DEFRAGMENT failed: Invalid argument
# f2fs_io defrag_file 0 1048576 session-02.pdf
F2FS_IOC_DEFRAGMENT failed: Invalid argument

Thanks.


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [f2fs-dev] f2fs: How should I use the defragmentation tools?
  2019-12-09 22:18 [f2fs-dev] f2fs: How should I use the defragmentation tools? Ju Hyung Park
@ 2019-12-09 22:46 ` Jaegeuk Kim
  0 siblings, 0 replies; 2+ messages in thread
From: Jaegeuk Kim @ 2019-12-09 22:46 UTC (permalink / raw)
  To: Ju Hyung Park; +Cc: linux-f2fs-devel

Hi Ju Hyung,

On 12/10, Ju Hyung Park wrote:
> Hi everyone.
> 
> I've had interests in defragging f2fs for a long time now.
> 
> https://www.usenix.org/system/files/conference/atc17/atc17-hahn.pdf
> This paper proves that defragmentation caused from the filesystem
> takes a big portion of performance degradation.
> (It'd be interesting to see whether f2fs would behave differently from
> ext4 in terms of fragmentation.)
> 
> While doing defragmentation on a production device currently poses a
> lot of practicality issues, I'd still like to try them out for
> educational purposes.
> 
> However, I'm still not sure how to do defragmentation while f2fs
> having 2 tools for that purpose.
> 
> 1. Is either of `defrag.f2fs` or `f2fs_io defrag_file` meant to be
> feature-parity with e4defrag?

The defrag.f2fs is a tool to conduct runtime GC in user land,. IOWs, it'll
migrate source range of blocks to target range of blocks directionally.
OTOH, f2fs_io defrag_file is runtime ioctl to gather allocated blocks
given file descriptor, which is more like e4defrag, IIUC.

> 
> 2. What's the expected output from `defrag.f2fs` and `f2fs_io
> defrag_file`? I'd like to get example outputs from you guys for me to
> compare.

The defrag.f2fs will reduce # of dirty segments. The f2fs_io defrag_file will
arrange more consecutive blocks allocated to the file; it doesn't guarantee
whole blocks are sequential explicitly since it reads and writes back shortly
to get spatial locality.

> 
> 3. Is `defrag.f2fs` and `f2fs_io defrag_file` tested thoroughly?
> Should I expect any potential corruptions from running these?

The defrag.f2fs uses part of block migration flow which was used for sload.f2fs,
while f2fs_io defrag_file uses general writeback. So, the risk would be small.

> 
> 4. `defrag.f2fs` seems to only work on an unmounted block device.
> What's the intended use-case scenario for this? I'm assuming running
> `defrag.f2fs` and feeding the entire block length to -l is not how
> it's meant to be used.

It gives a way to decrease # of dirty segments.

> 
> 5. Why did you make it mandatory for the users to supply the lengths
> to `f2fs_io defrag_file`? Is it any practical to defrag a part of a
> file?

Yup.

> 
> 6. How exactly should I run `f2fs_io defrag_file`? My following
> attempts failed with -EINVAL:

Is this cold file by ".pdf"?

> # ls -al session-02.pdf
> -rw-rw-r--. 1 1023 1023 30517375 Nov  7 21:10 session-02.pdf
> # f2fs_io defrag_file 0 30517375 session-02.pdf
> F2FS_IOC_DEFRAGMENT failed: Invalid argument
> # f2fs_io defrag_file 0 1048576 session-02.pdf
> F2FS_IOC_DEFRAGMENT failed: Invalid argument
> 
> Thanks.


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-12-09 22:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-09 22:18 [f2fs-dev] f2fs: How should I use the defragmentation tools? Ju Hyung Park
2019-12-09 22:46 ` Jaegeuk Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).