On 29/05/17(Mon) 14:30, Stefan Fritsch wrote:
> On Mon, 29 May 2017, Martin Pieuchot wrote:
> 
> > A complete diff would be easier to review.
> 
> ok, here it comes.
> 
> The original commit message was this:
> 
>       Implement VFS read clustering for MSDOSFS.
>     
>       The logic used in msdosfs_bmap() to loop calling pcbmap() comes from
>       FreeBSD and is not really efficient but it is good enough since it is
>       only called when generating I/O.
>     
>       With this diff I get a 100% improvement when reading big files from a
>       crappy USB stick.
>     
>       With this and bread_cluster(9) modified to not re-fetch B_CACHED 
> buffers,
>       reading large contiguous files with chunk sizes of MAXPHYS is almost as
>       fast as physio(9) on the same device.
>     
>       For a 'real world' example, when copying music files from a USB stick I
>       see a speed jump from 15MB/s on -current to 24Mb/s with this diff.
>     
>       While here rename some 'lbn' variables into 'cn' to better reflect what
>       we're dealing with.
>     
>       Tested by Mathieu, with support from deraadt@

ok mpi@

Now I understood why I got confused between block & cluster, the current
msdosfs_bmap() function has a bug.  ``ap->a_bn'' is representing a
cluster, not a block.  Diff below fixes that, for the archives.

Index: msdosfs/msdosfs_vnops.c
===================================================================
RCS file: /cvs/src/sys/msdosfs/msdosfs_vnops.c,v
retrieving revision 1.113
diff -u -p -r1.113 msdosfs_vnops.c
--- msdosfs/msdosfs_vnops.c     30 Aug 2016 19:47:23 -0000      1.113
+++ msdosfs/msdosfs_vnops.c     29 May 2017 13:24:11 -0000
@@ -1765,7 +1765,6 @@ msdosfs_bmap(void *v)
 {
        struct vop_bmap_args *ap = v;
        struct denode *dep = VTODE(ap->a_vp);
-       struct msdosfsmount *pmp = dep->de_pmp;
 
        if (ap->a_vpp != NULL)
                *ap->a_vpp = dep->de_devvp;
@@ -1777,7 +1776,7 @@ msdosfs_bmap(void *v)
                 */
                *ap->a_runp = 0;
        }
-       return (pcbmap(dep, de_bn2cn(pmp, ap->a_bn), ap->a_bnp, 0, 0));
+       return (pcbmap(dep, ap->a_bn, ap->a_bnp, 0, 0));
 }
 
 int

Reply via email to