From a1f7916969835d2898fa0f8142501ea964511aba Mon Sep 17 00:00:00 2001 From: reinoud Date: Sat, 19 Jul 2008 16:00:35 +0000 Subject: [PATCH] Choose which time of allocation descriptors to use on new nodes based on the number of partition mappings. --- sys/fs/udf/udf.h | 15 +++++++++++---- sys/fs/udf/udf_subr.c | 15 +++++++++++++-- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/sys/fs/udf/udf.h b/sys/fs/udf/udf.h index bce91861e1a5..28289a205802 100644 --- a/sys/fs/udf/udf.h +++ b/sys/fs/udf/udf.h @@ -1,4 +1,4 @@ -/* $NetBSD: udf.h,v 1.18 2008/07/17 19:10:22 reinoud Exp $ */ +/* $NetBSD: udf.h,v 1.19 2008/07/19 16:00:35 reinoud Exp $ */ /* * Copyright (c) 2006, 2008 Reinoud Zandijk @@ -179,6 +179,11 @@ extern int udf_verbose; #define UDF_ALLOC_RELAXEDSEQUENTIAL 6 /* only nodes not seq. */ +/* allocation descriptor styles */ +#define UDF_ALLOCDSCR_SHORT 1 /* use short_ad allocation dscr. */ +#define UDF_ALLOCDSCR_LONG 2 /* use long_ad allocation dscr. */ + + /* logical volume open/close actions */ #define UDF_OPEN_SESSION 0x01 /* if needed writeout VRS + VDS */ #define UDF_CLOSE_SESSION 0x02 /* close session after writing VAT */ @@ -283,9 +288,11 @@ struct udf_mount { int lvclose; /* logvol actions */ /* disc allocation / writing method */ - int lvreadwrite; /* bits */ - int data_alloc; /* all userdata */ - int meta_alloc; /* all metadata */ + int lvreadwrite; /* error handling */ + int data_alloc; /* all userdata */ + int data_allocdscr; + int meta_alloc; /* all metadata */ + int meta_allocdscr; int data_part; int metadata_part; kmutex_t allocate_mutex; diff --git a/sys/fs/udf/udf_subr.c b/sys/fs/udf/udf_subr.c index 539ab6ae5c1c..24efc804a5a6 100644 --- a/sys/fs/udf/udf_subr.c +++ b/sys/fs/udf/udf_subr.c @@ -1,4 +1,4 @@ -/* $NetBSD: udf_subr.c,v 1.63 2008/07/18 15:55:32 reinoud Exp $ */ +/* $NetBSD: udf_subr.c,v 1.64 2008/07/19 16:00:35 reinoud Exp $ */ /* * Copyright (c) 2006, 2008 Reinoud Zandijk @@ -29,7 +29,7 @@ #include #ifndef lint -__KERNEL_RCSID(0, "$NetBSD: udf_subr.c,v 1.63 2008/07/18 15:55:32 reinoud Exp $"); +__KERNEL_RCSID(0, "$NetBSD: udf_subr.c,v 1.64 2008/07/19 16:00:35 reinoud Exp $"); #endif /* not lint */ @@ -1815,6 +1815,17 @@ udf_process_vds(struct udf_mount *ump) { } } + /* determine default allocation descriptors to use */ + ump->data_allocdscr = UDF_ALLOCDSCR_SHORT; + ump->meta_allocdscr = UDF_ALLOCDSCR_SHORT; + if (n_pm > 1) { + ump->data_allocdscr = UDF_ALLOCDSCR_LONG; + ump->meta_allocdscr = UDF_ALLOCDSCR_LONG; + /* metadata partitions are forced to have short */ + if (n_meta) + ump->meta_allocdscr = UDF_ALLOCDSCR_SHORT; + } + /* determine logical volume open/closure actions */ if (n_virt) { ump->lvopen = 0;