trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject git commit: TS-1104 Change the hw_sector_size to consistently be an int
Date Tue, 07 Feb 2012 22:17:53 GMT
Updated Branches:
  refs/heads/master 69a7fa75e -> 9289d739a


TS-1104 Change the hw_sector_size to consistently be an int


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

Branch: refs/heads/master
Commit: 9289d739ab779a24aeb947289eef06330319178b
Parents: 69a7fa7
Author: Leif Hedstrom <zwoop@apache.org>
Authored: Tue Feb 7 15:17:39 2012 -0700
Committer: Leif Hedstrom <zwoop@apache.org>
Committed: Tue Feb 7 15:17:39 2012 -0700

----------------------------------------------------------------------
 iocore/cache/Cache.cc  |    1 +
 iocore/cache/I_Store.h |    9 +++++----
 iocore/cache/Store.cc  |   13 ++++++-------
 3 files changed, 12 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9289d739/iocore/cache/Cache.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc
index edf56b6..8f67673 100644
--- a/iocore/cache/Cache.cc
+++ b/iocore/cache/Cache.cc
@@ -575,6 +575,7 @@ CacheProcessor::start_internal(int flags)
         gdisks[gndisks] = NEW(new CacheDisk());
         Debug("cache_hosting", "Disk: %d, blocks: %d", gndisks, blocks);
         int sector_size = sd->hw_sector_size;
+
         if (sector_size < cache_config_force_sector_size)
           sector_size = cache_config_force_sector_size;
         if (sd->hw_sector_size <= 0 || sector_size > STORE_BLOCK_SIZE) {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9289d739/iocore/cache/I_Store.h
----------------------------------------------------------------------
diff --git a/iocore/cache/I_Store.h b/iocore/cache/I_Store.h
index 5d30fce..55ea839 100644
--- a/iocore/cache/I_Store.h
+++ b/iocore/cache/I_Store.h
@@ -45,7 +45,7 @@ struct Span
 {
   char *pathname;
   int64_t blocks;
-  int64_t hw_sector_size;
+  int hw_sector_size;
   bool file_pathname;           // the pathname is a file
   bool isRaw;
   int64_t offset;                 // used only if (file == true)
@@ -93,9 +93,10 @@ public:
            int64_t * offset,      // for file, start offset (unsupported)
            char *buf, int buflen);      // where to store the path
 
-Span():pathname(NULL), blocks(0), hw_sector_size(DEFAULT_HW_SECTOR_SIZE), file_pathname(false),
-       isRaw(true), offset(0), alignment(0), disk_id(0), is_mmapable_internal(false) {
-  }
+  Span()
+    : pathname(NULL), blocks(0), hw_sector_size(DEFAULT_HW_SECTOR_SIZE), file_pathname(false),
+      isRaw(true), offset(0), alignment(0), disk_id(0), is_mmapable_internal(false)
+  { }
   ~Span();
 };
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9289d739/iocore/cache/Store.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/Store.cc b/iocore/cache/Store.cc
index 0900ad5..d865291 100644
--- a/iocore/cache/Store.cc
+++ b/iocore/cache/Store.cc
@@ -700,9 +700,8 @@ Span::init(char *filename, int64_t size)
     hw_sector_size = arg;
     is_disk = 1;
     adjusted_sec = hw_sector_size / 512;
-    Debug("cache_init",
-      "Span::init - %s hw_sector_size=%"PRId64" is_disk=%d adjusted_sec=%d",
-      filename, hw_sector_size, is_disk,adjusted_sec);
+    Debug("cache_init", "Span::init - %s hw_sector_size=%d is_disk=%d adjusted_sec=%d",
+          filename, hw_sector_size, is_disk,adjusted_sec);
   }
 
   alignment = 0;
@@ -741,11 +740,11 @@ Span::init(char *filename, int64_t size)
 
     if (size > 0 && blocks * hw_sector_size != size) {
       Warning("Warning: you specified a size of %" PRId64 " for %s,\n", size, filename);
-      Warning("but the device size is %" PRId64 ". Using minimum of the two.\n", blocks *
hw_sector_size);
-      if (blocks * hw_sector_size < size)
-        size = blocks * hw_sector_size;
+      Warning("but the device size is %" PRId64 ". Using minimum of the two.\n", (int64_t)blocks
* (int64_t)hw_sector_size);
+      if ((int64_t)blocks * (int64_t)hw_sector_size < size)
+        size = (int64_t)blocks * (int64_t)hw_sector_size;
     } else {
-      size = blocks * hw_sector_size;
+      size = (int64_t)blocks * (int64_t)hw_sector_size;
     }
 
     /* I don't know why I'm redefining blocks to be something that is quite


Mime
View raw message