[PATCH 2/2] Move set_block_size() to before 1st use of _fat_block_read()

Ric Claus claus at slac.stanford.edu
Thu Oct 17 02:15:19 UTC 2013


---
 cpukit/libfs/src/dosfs/fat.c |   34 +++++++++++++++++-----------------
 1 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/cpukit/libfs/src/dosfs/fat.c b/cpukit/libfs/src/dosfs/fat.c
index f81bc7b..ec3a757 100644
--- a/cpukit/libfs/src/dosfs/fat.c
+++ b/cpukit/libfs/src/dosfs/fat.c
@@ -633,6 +633,23 @@ fat_init_volume_info(fat_fs_info_t *fs_info, const char *device)
         }
     }
 
+    /*
+     * If possible we will use the cluster size as bdbuf block size for faster
+     * file access. This requires that certain sectors are aligned to cluster
+     * borders.
+     */
+    if (is_cluster_aligned(vol, vol->data_fsec)
+        && (FAT_FAT32 == vol->type || is_cluster_aligned(vol, vol->rdir_loc)))
+    {
+        sc = rtems_bdbuf_set_block_size (vol->dd, vol->bpc, true);
+        if (sc == RTEMS_SUCCESSFUL)
+        {
+            vol->bytes_per_block = vol->bpc;
+            vol->bytes_per_block_log2 = vol->bpc_log2;
+            vol->sectors_per_block = vol->spc;
+        }
+    }
+
     if (vol->type == FAT_FAT32)
     {
         vol->rdir_cl = FAT_GET_BR_FAT32_ROOT_CLUSTER(boot_rec);
@@ -741,23 +758,6 @@ fat_init_volume_info(fat_fs_info_t *fs_info, const char *device)
         rtems_set_errno_and_return_minus_one( ENOMEM );
     }
 
-    /*
-     * If possible we will use the cluster size as bdbuf block size for faster
-     * file access. This requires that certain sectors are aligned to cluster
-     * borders.
-     */
-    if (is_cluster_aligned(vol, vol->data_fsec)
-        && (FAT_FAT32 == vol->type || is_cluster_aligned(vol, vol->rdir_loc)))
-    {
-        sc = rtems_bdbuf_set_block_size (vol->dd, vol->bpc, true);
-        if (sc == RTEMS_SUCCESSFUL)
-        {
-            vol->bytes_per_block = vol->bpc;
-            vol->bytes_per_block_log2 = vol->bpc_log2;
-            vol->sectors_per_block = vol->spc;
-        }
-    }
-
     return RC_OK;
 }
 
-- 
1.7.1




More information about the devel mailing list