From 03e9f7a477ee340a86195af43549dd4b8d7f98b2 Mon Sep 17 00:00:00 2001 From: szaka Date: Sat, 17 Mar 2007 02:03:09 +0000 Subject: [PATCH] set mft zone to be the minimum of 12.5% of the disk size and 200 MB --- libntfs-3g/volume.c | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/libntfs-3g/volume.c b/libntfs-3g/volume.c index 84db665f..893e2686 100644 --- a/libntfs-3g/volume.c +++ b/libntfs-3g/volume.c @@ -457,32 +457,11 @@ ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev, unsigned long flags) "sector size. This may affect performance " "but should be harmless otherwise. Error: " "%s\n", strerror(errno)); - /* - * We now initialize the cluster allocator. - * - * FIXME: Move this to its own function? (AIA) - */ + + /* We now initialize the cluster allocator. */ - // TODO: Make this tunable at mount time. (AIA) - vol->mft_zone_multiplier = 1; - - /* Determine the size of the MFT zone. */ - mft_zone_size = vol->nr_clusters; - switch (vol->mft_zone_multiplier) { /* % of volume size in clusters */ - case 4: - mft_zone_size >>= 1; /* 50% */ - break; - case 3: - mft_zone_size = mft_zone_size * 3 >> 3; /* 37.5% */ - break; - case 2: - mft_zone_size >>= 2; /* 25% */ - break; - /* case 1: */ - default: - mft_zone_size >>= 3; /* 12.5% */ - break; - } + mft_zone_size = min(vol->nr_clusters >> 3, /* 12.5% */ + 200 * 1000 * 1024 >> vol->cluster_size_bits); /* Setup the mft zone. */ vol->mft_zone_start = vol->mft_zone_pos = vol->mft_lcn;