~n-muench/ubuntu/quantal/open-vm-tools/open-vm-tools.may2.sid-sync

« back to all changes in this revision

Viewing changes to lib/file/fileIOPosix.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2009-05-30 09:48:43 UTC
  • mfrom: (1.1.5 upstream) (2.4.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090530094843-gdpza57r5iqsf124
Tags: 2009.05.22-167859-1
MergingĀ upstreamĀ versionĀ 2009.05.22-167859.

Show diffs side-by-side

added added

removed removed

Lines of Context:
89
89
#include "stats_file.h"
90
90
 
91
91
#include "unicodeOperations.h"
 
92
#include "memaligned.h"
92
93
 
93
94
#if defined(__APPLE__)
94
95
#include "hostinfo.h"
114
115
 */
115
116
typedef struct FilePosixOptions {
116
117
   Bool initialized;
 
118
   Bool aligned;
117
119
   Bool enabled;
118
120
   int countThreshold;
119
121
   int sizeThreshold;
204
206
   if (!filePosixOptions.initialized) {
205
207
      filePosixOptions.enabled =
206
208
         Config_GetBool(TRUE, "filePosix.coalesce.enable");
 
209
      /*
 
210
       * Aligned malloc starts failing to allocate memory during
 
211
       * heavy I/O on Linux.  We're not sure why -- maybe we
 
212
       * are running out of mmaps?  Turn it off by default
 
213
       * for now.
 
214
       */
 
215
      filePosixOptions.aligned =
 
216
         Config_GetBool(FALSE, "filePosix.coalesce.aligned");
207
217
      filePosixOptions.countThreshold =
208
218
         Config_GetLong(5, "filePosix.coalesce.count");
209
219
      filePosixOptions.sizeThreshold =
326
336
 *      Get sector size of underlying volume.
327
337
 *
328
338
 * Results:
329
 
 *      Always FALSE, there does not seem to be a way to query sectorSize
330
 
 *      from filename. XXX.
 
339
 *      Always 512, there does not seem to be a way to query sectorSize
 
340
 *      from filename.  But O_DIRECT boundary alignment constraint is
 
341
 *      always 512, so use that.
331
342
 *
332
343
 * Side effects:
333
344
 *      None
341
352
{
342
353
   ASSERT(sectorSize);
343
354
 
344
 
   *sectorSize = 0;
 
355
   *sectorSize = 512;
345
356
 
346
 
   return FALSE;
 
357
   return TRUE;
347
358
}
348
359
 
349
360
 
1313
1324
   // XXX: Wouldn't it be nice if we could log from here!
1314
1325
   //LOG(5, ("FILE: Coalescing %s of %d elements and %d size\n",
1315
1326
   //        isWrite ? "write" : "read", inCount, inTotalSize));
1316
 
   cBuf = Util_SafeMalloc(sizeof(uint8) * inTotalSize);
 
1327
   if (filePosixOptions.aligned) {
 
1328
      cBuf = Aligned_Malloc(sizeof(uint8) * inTotalSize);
 
1329
   } else {
 
1330
      cBuf = Util_SafeMalloc(sizeof(uint8) * inTotalSize);
 
1331
   }
 
1332
   if (!cBuf) {
 
1333
      return FALSE;
 
1334
   }
1317
1335
 
1318
1336
  if (isWrite) {
1319
1337
      IOV_WriteIovToBuf(inVec, inCount, cBuf, inTotalSize);
1360
1378
      IOV_WriteBufToIov(coVec->iov_base, actualSize, origVec, origVecCount);
1361
1379
   }
1362
1380
 
1363
 
   free(coVec->iov_base);
 
1381
   if (filePosixOptions.aligned) {
 
1382
      Aligned_Free(coVec->iov_base);
 
1383
   } else {
 
1384
      free(coVec->iov_base);
 
1385
   }
1364
1386
}
1365
1387
 
1366
1388