TS-1821 to make the AIO test pass when build with native AIO
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/805c1fea Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/805c1fea Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/805c1fea Branch: refs/heads/5.0.x Commit: 805c1feab432f8cd0948aeddc7d9778fd357ce73 Parents: 69d0489 Author: weijin <[email protected]> Authored: Tue Jan 14 13:54:45 2014 +0800 Committer: weijin <[email protected]> Committed: Tue Jan 14 13:56:30 2014 +0800 ---------------------------------------------------------------------- CHANGES | 2 ++ iocore/aio/AIO.cc | 7 +++---- iocore/aio/test_AIO.cc | 12 +++++++++++- 3 files changed, 16 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/805c1fea/CHANGES ---------------------------------------------------------------------- diff --git a/CHANGES b/CHANGES index d880ede..7480847 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,8 @@ -*- coding: utf-8 -*- Changes with Apache Traffic Server 4.2.0 + *) [TS-1821] make the AIO test pass when build with native aio. + *) [TS-2412] fix the bug of restarting ATS causes complete cache data loss when use linux-native-aio. http://git-wip-us.apache.org/repos/asf/trafficserver/blob/805c1fea/iocore/aio/AIO.cc ---------------------------------------------------------------------- diff --git a/iocore/aio/AIO.cc b/iocore/aio/AIO.cc index d933130..f8c1b9d 100644 --- a/iocore/aio/AIO.cc +++ b/iocore/aio/AIO.cc @@ -45,10 +45,10 @@ volatile int num_filedes = 1; // Don't need to acquire this for searching the array static ink_mutex insert_mutex; -RecInt cache_config_threads_per_disk = 12; -RecInt api_config_threads_per_disk = 12; int thread_is_created = 0; #endif // AIO_MODE == AIO_MODE_NATIVE +RecInt cache_config_threads_per_disk = 12; +RecInt api_config_threads_per_disk = 12; RecRawStatBlock *aio_rsb = NULL; Continuation *aio_err_callbck = 0; @@ -162,9 +162,8 @@ ink_aio_init(ModuleVersion v) #if AIO_MODE != AIO_MODE_NATIVE memset(&aio_reqs, 0, MAX_DISKS_POSSIBLE * sizeof(AIO_Reqs *)); ink_mutex_init(&insert_mutex, NULL); - - REC_ReadConfigInteger(cache_config_threads_per_disk, "proxy.config.cache.threads_per_disk"); #endif + REC_ReadConfigInteger(cache_config_threads_per_disk, "proxy.config.cache.threads_per_disk"); } int http://git-wip-us.apache.org/repos/asf/trafficserver/blob/805c1fea/iocore/aio/test_AIO.cc ---------------------------------------------------------------------- diff --git a/iocore/aio/test_AIO.cc b/iocore/aio/test_AIO.cc index 3ff731a..bc1c6d4 100644 --- a/iocore/aio/test_AIO.cc +++ b/iocore/aio/test_AIO.cc @@ -486,10 +486,20 @@ main(int /* argc ATS_UNUSED */, char *argv[]) RecProcessInit(RECM_STAND_ALONE); ink_event_system_init(EVENT_SYSTEM_MODULE_VERSION); eventProcessor.start(ink_number_of_processors()); +#if AIO_MODE == AIO_MODE_NATIVE + int etype = ET_NET; + int n_netthreads = eventProcessor.n_threads_for_type[etype]; + EThread **netthreads = eventProcessor.eventthread[etype]; + for (int i = 0; i < n_netthreads; ++i) { + netthreads[i]->diskHandler = new DiskHandler(); + netthreads[i]->schedule_imm(netthreads[i]->diskHandler); + } +#endif + RecProcessStart(); ink_aio_init(AIO_MODULE_VERSION); srand48(time(NULL)); - + printf("input file %s\n", argv[1]); if (!read_config(argv[1])) exit(1);
