Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-9]: src/sys/fs/udf Pull up following revision(s) (requested by re...



details:   https://anonhg.NetBSD.org/src/rev/b24c3e56b5ca
branches:  netbsd-9
changeset: 363455:b24c3e56b5ca
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Mar 13 09:44:33 2022 +0000

description:
Pull up following revision(s) (requested by reinoud in ticket #1431):

        sys/fs/udf/udf_strat_sequential.c: revision 1.16
        sys/fs/udf/udf_subr.c: revision 1.167

On switching from writing to reading explicitly synchronize the caches. It
isn't strictly needed but some devices in the wild will otherwise bluntly
ignore all reading commands resulting in a kernel and device lockup.

For bug-compatibility with Windows, the last VAT sector must be a multiple of
16/32 from the start of the track.  To allow for scratches, write out at least
a 32 pieces.

diffstat:

 sys/fs/udf/udf_strat_sequential.c |   6 ++++--
 sys/fs/udf/udf_subr.c             |  20 +++++++++++++++-----
 2 files changed, 19 insertions(+), 7 deletions(-)

diffs (78 lines):

diff -r 6c4baa884879 -r b24c3e56b5ca sys/fs/udf/udf_strat_sequential.c
--- a/sys/fs/udf/udf_strat_sequential.c Mon Feb 28 16:39:22 2022 +0000
+++ b/sys/fs/udf/udf_strat_sequential.c Sun Mar 13 09:44:33 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_strat_sequential.c,v 1.15 2016/05/24 09:55:57 reinoud Exp $ */
+/* $NetBSD: udf_strat_sequential.c,v 1.15.22.1 2022/03/13 09:44:33 martin Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: udf_strat_sequential.c,v 1.15 2016/05/24 09:55:57 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_strat_sequential.c,v 1.15.22.1 2022/03/13 09:44:33 martin Exp $");
 #endif /* not lint */
 
 
@@ -549,6 +549,8 @@
        if (new_queue != priv->cur_queue) {
                DPRINTF(SHEDULE, ("switching from %d to %d\n",
                        priv->cur_queue, new_queue));
+               if (new_queue == UDF_SHED_READING)
+                       udf_mmc_synchronise_caches(ump);
        }
 
        priv->cur_queue = new_queue;
diff -r 6c4baa884879 -r b24c3e56b5ca sys/fs/udf/udf_subr.c
--- a/sys/fs/udf/udf_subr.c     Mon Feb 28 16:39:22 2022 +0000
+++ b/sys/fs/udf/udf_subr.c     Sun Mar 13 09:44:33 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_subr.c,v 1.146 2019/06/03 06:04:20 msaitoh Exp $ */
+/* $NetBSD: udf_subr.c,v 1.146.2.1 2022/03/13 09:44:33 martin Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -29,7 +29,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: udf_subr.c,v 1.146 2019/06/03 06:04:20 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_subr.c,v 1.146.2.1 2022/03/13 09:44:33 martin Exp $");
 #endif /* not lint */
 
 
@@ -3770,10 +3770,11 @@
 {
        struct vnode *devvp = ump->devvp;
        struct mmc_op mmc_op;
+       uint32_t phys;
        int logvol_integrity;
        int error = 0, error1 = 0, error2 = 0;
        int tracknr;
-       int nvats, n, nok;
+       int nvats, n, relblk, wrtrack_skew, nok;
 
        /* already/still closed? */
        logvol_integrity = udf_rw32(ump->logvol_integrity->integrity_type);
@@ -3794,8 +3795,17 @@
                DPRINTF(VOLUMES, ("writeout vat_node\n"));
                udf_writeout_vat(ump);
 
-               /* at least two DVD packets and 3 CD-R packets */
-               nvats = 32;
+               /*
+                * For bug-compatibility with Windows, the last VAT sector
+                * must be a multiple of 16/32 from the start of the track.
+                * To allow for scratches, write out at least a 32 pieces.
+                */
+               phys = ump->data_track.track_start;
+               wrtrack_skew = phys % 32;
+
+               phys = ump->data_track.next_writable;
+               relblk = phys % 32;
+               nvats = 32 + 32 - (relblk - wrtrack_skew);
 
 #if notyet
                /*



Home | Main Index | Thread Index | Old Index