trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From iga...@apache.org
Subject [1/2] git commit: Fix TS-1784: Calculate blocks correctly on FreeBSD
Date Wed, 22 May 2013 11:05:56 GMT
Updated Branches:
  refs/heads/3.2.x 3f4a889bf -> 9b43fd49e


Fix TS-1784: Calculate blocks correctly on FreeBSD

FreeBSD calculation of

    blocks = size / hw_block_size;

is wrong, because *our* *store* block size defaults to 8k.

I'm further adding comments for future reference in other code paths.

TS-1784 further reminds us that these triple (or more) code paths
are confusing at best, and should be unified.

test/review:   +1: igalic, zwoop, jpeach
backport: igalic


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/9ad03b3e
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/9ad03b3e
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/9ad03b3e

Branch: refs/heads/3.2.x
Commit: 9ad03b3ed395b4c2c02359da64ee6590d713afc6
Parents: 3f4a889
Author: Igor Galić <i.galic@brainsware.org>
Authored: Tue Feb 12 19:09:50 2013 +0100
Committer: Igor Galić <i.galic@brainsware.org>
Committed: Wed May 22 12:40:44 2013 +0200

----------------------------------------------------------------------
 iocore/cache/Store.cc |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9ad03b3e/iocore/cache/Store.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/Store.cc b/iocore/cache/Store.cc
index 2935f53..7df885b 100644
--- a/iocore/cache/Store.cc
+++ b/iocore/cache/Store.cc
@@ -483,7 +483,9 @@ Span::init(char *an, int64_t size)
   disk_id = devnum;
 
   pathname = ats_strdup(an);
-  blocks = size / hw_sector_size;
+  // igalic: blocks = size / hw_sector_size; was wrong TS-1707
+  // This code needs refactoring to unify the code-paths which are equal across platforms.
+  blocks = size / STORE_BLOCK_SIZE;
   file_pathname = !((s.st_mode & S_IFMT) == S_IFDIR);
 
   // This is so FreeBSD admins don't worry about our malicious code creating boot sector
viruses:
@@ -583,6 +585,7 @@ Span::init(char *filename, int64_t size)
 
   pathname = ats_strdup(filename);
   // is this right Seems like this should be size / hw_sector_size
+  // igalic: No. See TS-1707
   blocks = size / STORE_BLOCK_SIZE;
   file_pathname = !((s.st_mode & S_IFMT) == S_IFDIR);
 
@@ -715,6 +718,7 @@ Span::init(char *filename, int64_t size)
     /* I don't know why I'm redefining blocks to be something that is quite
      * possibly something other than the actual number of blocks, but the
      * code for other arches seems to.  Revisit this, perhaps. */
+    // igalic: No. See TS-1707
     blocks = size / STORE_BLOCK_SIZE;
     
     Debug("cache_init", "Span::init physical sectors %" PRId64 " total size %" PRId64 " geometry
size %" PRId64 " store blocks %" PRId64 "",


Mime
View raw message