~ubuntu-branches/ubuntu/maverick/mysql-5.1/maverick-proposed

« back to all changes in this revision

Viewing changes to storage/innodb_plugin/os/os0file.c

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-02-22 14:16:05 UTC
  • mto: This revision was merged to the branch mainline in revision 20.
  • Revision ID: package-import@ubuntu.com-20120222141605-nxlu9yzc6attylc2
Tags: upstream-5.1.61
ImportĀ upstreamĀ versionĀ 5.1.61

Show diffs side-by-side

added added

removed removed

Lines of Context:
1182
1182
void
1183
1183
os_file_set_nocache(
1184
1184
/*================*/
1185
 
        int             fd,             /*!< in: file descriptor to alter */
1186
 
        const char*     file_name,      /*!< in: file name, used in the
1187
 
                                        diagnostic message */
1188
 
        const char*     operation_name) /*!< in: "open" or "create"; used in the
 
1185
        int             fd              /*!< in: file descriptor to alter */
 
1186
        __attribute__((unused)),
 
1187
        const char*     file_name       /*!< in: used in the diagnostic message */
 
1188
        __attribute__((unused)),
 
1189
        const char*     operation_name __attribute__((unused)))
 
1190
                                        /*!< in: "open" or "create"; used in the
1189
1191
                                        diagnostic message */
1190
1192
{
1191
1193
        /* some versions of Solaris may not have DIRECTIO_ON */
1367
1369
        int             create_flag;
1368
1370
        ibool           retry;
1369
1371
        const char*     mode_str        = NULL;
1370
 
        const char*     type_str        = NULL;
1371
 
        const char*     purpose_str     = NULL;
1372
1372
 
1373
1373
try_again:
1374
1374
        ut_a(name);
1388
1388
                ut_error;
1389
1389
        }
1390
1390
 
1391
 
        if (type == OS_LOG_FILE) {
1392
 
                type_str = "LOG";
1393
 
        } else if (type == OS_DATA_FILE) {
1394
 
                type_str = "DATA";
1395
 
        } else {
1396
 
                ut_error;
1397
 
        }
1398
 
 
1399
 
        if (purpose == OS_FILE_AIO) {
1400
 
                purpose_str = "AIO";
1401
 
        } else if (purpose == OS_FILE_NORMAL) {
1402
 
                purpose_str = "NORMAL";
1403
 
        } else {
1404
 
                ut_error;
1405
 
        }
1406
 
 
1407
 
#if 0
1408
 
        fprintf(stderr, "Opening file %s, mode %s, type %s, purpose %s\n",
1409
 
                name, mode_str, type_str, purpose_str);
1410
 
#endif
 
1391
        ut_a(type == OS_LOG_FILE || type == OS_DATA_FILE);
 
1392
        ut_a(purpose == OS_FILE_AIO || purpose == OS_FILE_NORMAL);
 
1393
 
1411
1394
#ifdef O_SYNC
1412
1395
        /* We let O_SYNC only affect log files; note that we map O_DSYNC to
1413
1396
        O_SYNC because the datasync options seemed to corrupt files in 2001
2297
2280
        ulint           i;
2298
2281
#endif /* !UNIV_HOTBACKUP */
2299
2282
 
 
2283
        /* On 64-bit Windows, ulint is 64 bits. But offset and n should be
 
2284
        no more than 32 bits. */
2300
2285
        ut_a((offset & 0xFFFFFFFFUL) == offset);
 
2286
        ut_a((n & 0xFFFFFFFFUL) == n);
2301
2287
 
2302
2288
        os_n_file_reads++;
2303
2289
        os_bytes_read_since_printout += n;
2421
2407
        ulint           i;
2422
2408
#endif /* !UNIV_HOTBACKUP */
2423
2409
 
 
2410
        /* On 64-bit Windows, ulint is 64 bits. But offset and n should be
 
2411
        no more than 32 bits. */
2424
2412
        ut_a((offset & 0xFFFFFFFFUL) == offset);
 
2413
        ut_a((n & 0xFFFFFFFFUL) == n);
2425
2414
 
2426
2415
        os_n_file_reads++;
2427
2416
        os_bytes_read_since_printout += n;
2551
2540
        ulint           i;
2552
2541
#endif /* !UNIV_HOTBACKUP */
2553
2542
 
2554
 
        ut_a((offset & 0xFFFFFFFF) == offset);
 
2543
        /* On 64-bit Windows, ulint is 64 bits. But offset and n should be
 
2544
        no more than 32 bits. */
 
2545
        ut_a((offset & 0xFFFFFFFFUL) == offset);
 
2546
        ut_a((n & 0xFFFFFFFFUL) == n);
2555
2547
 
2556
2548
        os_n_file_writes++;
2557
2549
 
3321
3313
        ulint           len)    /*!< in: length of the block to read or write */
3322
3314
{
3323
3315
        os_aio_slot_t*  slot;
3324
 
#ifdef WIN_ASYNC_IO
3325
 
        OVERLAPPED*     control;
3326
 
#endif
3327
3316
        ulint           i;
3328
3317
        ulint           slots_per_seg;
3329
3318
        ulint           local_seg;
 
3319
#ifdef WIN_ASYNC_IO
 
3320
        OVERLAPPED*     control;
 
3321
 
 
3322
        ut_a((len & 0xFFFFFFFFUL) == len);
 
3323
#endif
3330
3324
 
3331
3325
        /* No need of a mutex. Only reading constant fields */
3332
3326
        slots_per_seg = array->n_slots / array->n_segments;
3606
3600
        ut_ad(n % OS_FILE_LOG_BLOCK_SIZE == 0);
3607
3601
        ut_ad(offset % OS_FILE_LOG_BLOCK_SIZE == 0);
3608
3602
        ut_ad(os_aio_validate());
 
3603
#ifdef WIN_ASYNC_IO
 
3604
        ut_ad((n & 0xFFFFFFFFUL) == n);
 
3605
#endif
3609
3606
 
3610
3607
        wake_later = mode & OS_AIO_SIMULATED_WAKE_LATER;
3611
3608
        mode = mode & (~OS_AIO_SIMULATED_WAKE_LATER);
3846
3843
                /* retry failed read/write operation synchronously.
3847
3844
                No need to hold array->mutex. */
3848
3845
 
 
3846
                ut_a((slot->len & 0xFFFFFFFFUL) == slot->len);
 
3847
 
3849
3848
                switch (slot->type) {
3850
3849
                case OS_FILE_WRITE:
3851
3850
                        ret = WriteFile(slot->file, slot->buf,
3852
 
                                        slot->len, &len,
 
3851
                                        (DWORD) slot->len, &len,
3853
3852
                                        &(slot->control));
3854
3853
 
3855
3854
                        break;
3856
3855
                case OS_FILE_READ:
3857
3856
                        ret = ReadFile(slot->file, slot->buf,
3858
 
                                       slot->len, &len,
 
3857
                                       (DWORD) slot->len, &len,
3859
3858
                                       &(slot->control));
3860
3859
 
3861
3860
                        break;