Skip to contentSkip to conversation

How to trigger writeback?

fuse Nikolaus Rath 2 participants 5 messages Sep 24, 2018 – Sep 27, 2018 VFS

lore
Share & tools
lore
#0 lore raw

Hi,

How do I trigger writeback from a (writeback-cache enabled) FUSE filesystem?

Background: I am emulating the reflink ioctl with a magic xattr, but for that to work the filesystem needs to have all the data that is supposed to be in the copied file.

Best,
Nikolaus

Signature · 3 lines
GPG Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F

             »Time flies like an arrow, fruit flies like a Banana.«
#1 lore raw
Quoted 4 lines · Nikolaus Rath

Hi,

How do I trigger writeback from a (writeback-cache enabled) FUSE filesystem?

No way, currently (well, triggering fsync(2)/fdatasync(2) on the filesystem would work, but such recursion is considered highly hackish).

I'm working on new interfaces that will allow, among other things, triggering sync from the server.

Quoted 3 lines

Background: I am emulating the reflink ioctl with a magic xattr, but for that to work the filesystem needs to have all the data that is supposed to be in the copied file.

Have a look at the copyfile patch on the for-next branch of

git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse.git

Adding reflink support based on that should be pretty simple (and it takes care of flushing dirty pages).

Thanks,
Miklos

#2 lore raw
Quoted 9 lines · Miklos Szeredi
Quoted 4 lines · Nikolaus Rath

Hi,

How do I trigger writeback from a (writeback-cache enabled) FUSE filesystem?

No way, currently (well, triggering fsync(2)/fdatasync(2) on the filesystem would work, but such recursion is considered highly hackish).

You mean sync(2)/syncfs(2), not fsync(), right? Unless my manpages are out of date, fsync() only works on a specific inode.

Best,
-Nikolaus

Signature · 3 lines
GPG Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F

             »Time flies like an arrow, fruit flies like a Banana.«
#3 lore raw
Quoted 7 lines · Nikolaus Rath
Quoted 6 lines · Miklos Szeredi
Quoted 4 lines · Nikolaus Rath

Hi,

How do I trigger writeback from a (writeback-cache enabled) FUSE filesystem?

Quoted 7 lines
Quoted 3 lines

No way, currently (well, triggering fsync(2)/fdatasync(2) on the filesystem would work, but such recursion is considered highly hackish).

You mean sync(2)/syncfs(2), not fsync(), right? Unless my manpages are out of date, fsync() only works on a specific inode.

I would've thought you only need writeback of a specific inode for reflink, no?

Thanks,
Miklos

#4 lore raw
Quoted 13 lines · Miklos Szeredi
Quoted 12 lines · Nikolaus Rath
Quoted 9 lines · Miklos Szeredi
Quoted 4 lines · Nikolaus Rath

Hi,

How do I trigger writeback from a (writeback-cache enabled) FUSE filesystem?

No way, currently (well, triggering fsync(2)/fdatasync(2) on the filesystem would work, but such recursion is considered highly hackish).

Quoted 4 lines
Quoted 2 lines

You mean sync(2)/syncfs(2), not fsync(), right? Unless my manpages are out of date, fsync() only works on a specific inode.

I would've thought you only need writeback of a specific inode for reflink, no?

Aeh, yeah, I did not mention that. Since I couldn't implement real reflink support but have to go through xattrs, my "reflink" also supports reflinking entire directory trees. I guess I could still issue a bunch of fsyncs(), but I think syncfs() is nicer (I can even move it into the client program that sets the magic xattr so that the filesystem does not call into itself).

Best,
-Nikolaus

Signature · 3 lines
GPG Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F

             »Time flies like an arrow, fruit flies like a Banana.«