Updated Branches: refs/heads/master 521fe2891 -> 129da882d
TS-1163 : Made use of a 64bit capable ioctl in linux to avoid truncating the number of physical sectors for 2TB+ disks in linux. Previously, disks would fail to recognize their full size, though they would work Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/129da882 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/129da882 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/129da882 Branch: refs/heads/master Commit: 129da882d45490367525fbbbfb6fb8f726172f80 Parents: 521fe28 Author: Bart Wyatt <[email protected]> Authored: Tue May 1 11:26:44 2012 -0500 Committer: Bart Wyatt <[email protected]> Committed: Tue May 1 11:26:44 2012 -0500 ---------------------------------------------------------------------- CHANGES | 2 ++ iocore/cache/Store.cc | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/129da882/CHANGES ---------------------------------------------------------------------- diff --git a/CHANGES b/CHANGES index ce98586..e0ebcc8 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,7 @@ -*- coding: utf-8 -*- Changes with Apache Traffic Server 3.1.4 + *) [TS-1163] Support for raw disks larger than 2TB on Linux + *) [TS-1230] added a paramter to the configure script to allow overriding the calculated ARG_MAX value http://git-wip-us.apache.org/repos/asf/trafficserver/blob/129da882/iocore/cache/Store.cc ---------------------------------------------------------------------- diff --git a/iocore/cache/Store.cc b/iocore/cache/Store.cc index f630de3..7e5ea36 100644 --- a/iocore/cache/Store.cc +++ b/iocore/cache/Store.cc @@ -653,7 +653,7 @@ Span::init(char *filename, int64_t size) { int devnum = 0, fd, arg = 0; int ret = 0, is_disk = 0; - unsigned int heads, sectors, cylinders, adjusted_sec; + u_int64_t heads, sectors, cylinders, adjusted_sec; /* Fetch file type */ struct stat stat_buf; @@ -713,14 +713,22 @@ Span::init(char *filename, int64_t size) #endif if (is_disk) { - uint32_t physsectors = 0; + u_int32_t ioctl_sectors = 0; + u_int64_t ioctl_bytes = 0; + u_int64_t physsectors = 0; /* Disks cannot be mmapped */ is_mmapable_internal = false; - if (!ioctl(fd, BLKGETSIZE, &physsectors)) { + if (!ioctl(fd, BLKGETSIZE64, &ioctl_bytes)) { heads = 1; cylinders = 1; + physsectors = ioctl_bytes / hw_sector_size; + sectors = physsectors; + } else if (!ioctl(fd, BLKGETSIZE, &ioctl_sectors)) { + heads = 1; + cylinders = 1; + physsectors = ioctl_sectors; sectors = physsectors / adjusted_sec; } else { struct hd_geometry geometry; @@ -753,7 +761,7 @@ Span::init(char *filename, int64_t size) blocks = size / STORE_BLOCK_SIZE; Debug("cache_init", "Span::init physical sectors %u total size %" PRId64 " geometry size %" PRId64 " store blocks %" PRId64 "", - physsectors, hw_sector_size * (int64_t)physsectors, size, blocks); + physsectors, hw_sector_size * physsectors, size, blocks); pathname = ats_strdup(filename); file_pathname = 1;
