Re: [PATCH] fuse: enable larger read buffers for readdir [v2].

From: Jaco Kroon
Date: Fri Jul 28 2023 - 01:05:45 EST


Hi,
         plus = fuse_use_readdirplus(inode, ctx);
         ap->args.out_pages = true;
-       ap->num_pages = 1;
+       ap->num_pages = READDIR_PAGES;

No.  This is the array lenght, which is 1.  This is the hack I guess,
which makes the above trick work.

Hmm, ap->num_pages / ap->pages[] is used in fuse_copy_pages, but so is ap->descs[] - shouldn't the patch caused an out-of-bound access?
Out of interest, would you mind to explain how the hack worked?

Apparently it shouldn't ... my understanding of how pages* worked was all wrong.

I'm guessing since all the data fits in the first page (ap->pages[0] in other words, of length/size desc.length) that the other pages are never accessed.  Looking at fuse_copy_pages this does indeed seem to be the case.  So I ended up just being really, really lucky here.

Kind regards,
Jaco