You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ig...@apache.org on 2013/02/13 07:48:36 UTC
git commit: Fix TS-1707: Calculate blocks correctly on FreeBSD
Updated Branches:
refs/heads/master ee3d25f12 -> 5566ac76d
Fix TS-1707: 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-1707 further reminds us that these triple (or more) code paths
are confusing at best, and should be unified.
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/5566ac76
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/5566ac76
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/5566ac76
Branch: refs/heads/master
Commit: 5566ac76d6c4e4f5154421f1ac1077487b02d332
Parents: ee3d25f
Author: Igor Galić <i....@brainsware.org>
Authored: Tue Feb 12 19:09:50 2013 +0100
Committer: Igor Galić <i....@brainsware.org>
Committed: Tue Feb 12 19:09:50 2013 +0100
----------------------------------------------------------------------
iocore/cache/Store.cc | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5566ac76/iocore/cache/Store.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/Store.cc b/iocore/cache/Store.cc
index e5b9044..eb75feb 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 "",