Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Handle non-DEV_BSIZE sectors.



details:   https://anonhg.NetBSD.org/src/rev/9b8f5c5afe3f
branches:  trunk
changeset: 809526:9b8f5c5afe3f
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sun Jul 19 08:05:24 2015 +0000

description:
Handle non-DEV_BSIZE sectors.

diffstat:

 sys/dev/dksubr.c |  14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diffs (35 lines):

diff -r f6f531c88b93 -r 9b8f5c5afe3f sys/dev/dksubr.c
--- a/sys/dev/dksubr.c  Sun Jul 19 07:55:07 2015 +0000
+++ b/sys/dev/dksubr.c  Sun Jul 19 08:05:24 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dksubr.c,v 1.65 2015/07/12 05:57:06 mlelstv Exp $ */
+/* $NetBSD: dksubr.c,v 1.66 2015/07/19 08:05:24 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 1999, 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.65 2015/07/12 05:57:06 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.66 2015/07/19 08:05:24 mlelstv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -259,7 +259,15 @@
                }
        }
 
-       blkno = bp->b_blkno;
+       /*      
+        * Convert the block number to absolute and put it in terms
+        * of the device's logical block size.
+        */
+       if (secsize >= DEV_BSIZE)
+               blkno = bp->b_blkno / (secsize / DEV_BSIZE);
+       else
+               blkno = bp->b_blkno * (DEV_BSIZE / secsize);
+
        if (part != RAW_PART)
                blkno += lp->d_partitions[DISKPART(bp->b_dev)].p_offset;
        bp->b_rawblkno = blkno;



Home | Main Index | Thread Index | Old Index