trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wei...@apache.org
Subject [1/2] trafficserver git commit: TS-3628 fix the bug that unable to use disk larger than 16T. thanks liubin <liubin5@letv.com>
Date Thu, 21 May 2015 06:32:51 GMT
Repository: trafficserver
Updated Branches:
  refs/heads/master 1781a6815 -> 9725e10f8


TS-3628 fix the bug that unable to use disk larger than 16T. thanks
liubin <liubin5@letv.com>


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

Branch: refs/heads/master
Commit: d75aa66601ecefd2235c36f5d8fa007188d104c7
Parents: 1781a68
Author: weijin <weijin@letv.com>
Authored: Thu May 21 14:18:44 2015 +0800
Committer: 魏晋 <weijin@letv.com>
Committed: Thu May 21 14:25:25 2015 +0800

----------------------------------------------------------------------
 iocore/cache/Cache.cc | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d75aa666/iocore/cache/Cache.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc
index 56fc808..becf713 100644
--- a/iocore/cache/Cache.cc
+++ b/iocore/cache/Cache.cc
@@ -681,12 +681,12 @@ CacheProcessor::start_internal(int flags)
     }
 
     int fd = open(path, opts, 0644);
-    int blocks = sd->blocks;
+    int64_t blocks = sd->blocks;
     if (fd > 0) {
       if (!sd->file_pathname) {
         if (!check) {
-          if (ftruncate(fd, ((uint64_t)blocks) * STORE_BLOCK_SIZE) < 0) {
-            Warning("unable to truncate cache file '%s' to %d blocks", path, blocks);
+          if (ftruncate(fd, blocks * STORE_BLOCK_SIZE) < 0) {
+            Warning("unable to truncate cache file '%s' to %" PRId64 " blocks", path, blocks);
             diskok = 0;
           }
         } else { // read-only mode
@@ -706,7 +706,7 @@ CacheProcessor::start_internal(int flags)
         CacheDisk *disk = new CacheDisk();
         if (check)
           disk->read_only_p = true;
-        Debug("cache_hosting", "interim Disk: %d, blocks: %d", gn_interim_disks, blocks);
+        Debug("cache_hosting", "interim Disk: %d, blocks: %" PRId64 "", gn_interim_disks,
blocks);
         int sector_size = sd->hw_sector_size;
         if (sector_size < cache_config_force_sector_size)
           sector_size = cache_config_force_sector_size;
@@ -780,7 +780,7 @@ CacheProcessor::start_internal(int flags)
     }
 
     int fd = open(path, opts, 0644);
-    int blocks = sd->blocks;
+    int64_t blocks = sd->blocks;
 
     if (fd < 0 && (opts & O_CREAT)) // Try without O_DIRECT if this is a file
on filesystem, e.g. tmpfs.
       fd = open(path, DEFAULT_CACHE_OPTIONS | O_CREAT, 0644);
@@ -788,8 +788,8 @@ CacheProcessor::start_internal(int flags)
     if (fd >= 0) {
       if (!sd->file_pathname) {
         if (!check) {
-          if (ftruncate(fd, ((uint64_t)blocks) * STORE_BLOCK_SIZE) < 0) {
-            Warning("unable to truncate cache file '%s' to %d blocks", path, blocks);
+          if (ftruncate(fd, blocks * STORE_BLOCK_SIZE) < 0) {
+            Warning("unable to truncate cache file '%s' to %" PRId64 " blocks", path, blocks);
             diskok = 0;
           }
         } else { // read-only mode checks
@@ -815,7 +815,7 @@ CacheProcessor::start_internal(int flags)
         if (sd->hash_base_string)
           gdisks[gndisks]->hash_base_string = ats_strdup(sd->hash_base_string);
 
-        Debug("cache_hosting", "Disk: %d, blocks: %d", gndisks, blocks);
+        Debug("cache_hosting", "Disk: %d, blocks: %" PRId64 "", gndisks, blocks);
 
         if (sector_size < cache_config_force_sector_size) {
           sector_size = cache_config_force_sector_size;


Mime
View raw message