Changeset 9336
- Timestamp:
- 06/15/12 12:02:56 (11 months ago)
- Location:
- branches/stable
- Files:
-
- 11 modified
-
ChangeLog (modified) (1 diff)
-
Makefile.in (modified) (2 diffs)
-
configure.in (modified) (2 diffs)
-
src/client/sysint/client-state-machine.c (modified) (1 diff)
-
src/client/usrint/posix.c (modified) (3 diffs)
-
src/client/usrint/stdio.c (modified) (4 diffs)
-
src/common/misc/realpath.c (modified) (1 diff)
-
src/io/trove/trove-dbpf/dbpf-bstream-direct.c (modified) (1 diff)
-
src/kernel/linux-2.6/Makefile.in (modified) (1 diff)
-
src/kernel/linux-2.6/file.c (modified) (21 diffs)
-
src/kernel/linux-2.6/pvfs2-kernel.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/ChangeLog
r9309 r9336 6 6 7 7 Stable 8 9 * New Feature: users can now specify at configure time how they want the 10 * kernel module to handle the file pointer when an error occurs. The 11 * default behavior is to leave the file pointer alone, i.e., the file 12 * pointer will always represent the position of the last byte written, 13 * even though the user's entire request is not totally satisfied. In 14 * this case, a the actual number of bytes written is returned to the user. 15 * The new feature will change this default behavior such that the file pointer 16 * is repositioned to the byte just prior to the user's write request, a 17 * -1 is returned to the user's call, and errno is appropriately set. To 18 * enable this feature, add --enable-reset-file-pos on the configure 19 * command line when your OrangeFS system is configured. 8 20 9 21 * Bug fix: modified pvfs2_readdir, which is executed by the kernel module -
branches/stable/Makefile.in
r9323 r9336 204 204 ULIBDEPLIBS := -lpvfs2 205 205 MMAP_RA_CACHE = @MMAP_RA_CACHE@ 206 RESET_FILE_POS = @RESET_FILE_POS@ 206 207 TRUSTED_CONNECTIONS = @TRUSTED_CONNECTIONS@ 207 208 REDHAT_RELEASE = @REDHAT_RELEASE@ … … 433 434 ifdef MMAP_RA_CACHE 434 435 CFLAGS += @MMAP_RA_CACHE@ 436 endif 437 438 # reset the file position pointer when a write call encounters errors (kernel only) 439 # by default, this feature is disabled. Default behavior is to increment the file 440 # position pointer as bytes are written. 441 ifdef RESET_FILE_POS 442 CFLAGS += @RESET_FILE_POS@ 435 443 endif 436 444 -
branches/stable/configure.in
r9249 r9336 298 298 ,) 299 299 AC_SUBST(MMAP_RA_CACHE) 300 301 dnl a mechanism that resets the file position pointer when an error occurs whether 302 dnl or not any bytes were written (kernel interface only). 303 RESET_FILE_POS="" 304 AC_ARG_ENABLE(reset-file-pos, 305 [ --enable-reset-file-pos Resets file position pointer in kernel interface upon error], 306 [if test "x$enableval" = "xyes" ; then 307 RESET_FILE_POS="-DRESET_FILE_POS" 308 fi] 309 ,) 310 AC_SUBST(RESET_FILE_POS) 311 300 312 301 313 dnl See if the --enable-trusted-connections option was given to configure … … 1503 1515 fi 1504 1516 1517 if test "x$RESET_FILE_POS" = "x" -a "x$BUILD_BMI_ONLY" != "x1"; then 1518 AC_MSG_RESULT([PVFS2 configured for resetting file position : no]) 1519 else 1520 AC_MSG_RESULT([PVFS2 configured for resetting file position : yes]) 1521 fi 1522 1505 1523 if test "x$REDHAT_RELEASE" = "x" -a "x$BUILD_BMI_ONLY" != "x1"; then 1506 1524 AC_MSG_RESULT([PVFS2 will use workaround for redhat 2.4 kernels : no]) -
branches/stable/src/client/sysint/client-state-machine.c
r9020 r9336 531 531 532 532 gossip_debug(GOSSIP_CLIENT_DEBUG, 533 "PINT_client_io_cancel id %lld\n",lld(id)); 534 gossip_debug(GOSSIP_CANCEL_DEBUG, 533 535 "PINT_client_io_cancel id %lld\n",lld(id)); 534 536 -
branches/stable/src/client/usrint/posix.c
r9234 r9336 18 18 #include "posix-pvfs.h" 19 19 #include "openfile-util.h" 20 21 /** 22 * function prototypes not defined in libc, though it is a linux 23 * system call and we define it in the usr lib 24 */ 25 26 int getdents(unsigned int, struct dirent *, unsigned int); 27 int getdents64(unsigned int, struct dirent64 *, unsigned int); 28 int flock(int, int); 29 int fadvise64(int, off64_t, off64_t, int); 20 30 21 31 /* … … 1305 1315 } 1306 1316 1317 1307 1318 /** 1308 1319 * man page calls last arg count but is ambiguous if it is number … … 1407 1418 return rc; 1408 1419 } 1420 1409 1421 1410 1422 int flock(int fd, int op) -
branches/stable/src/client/usrint/stdio.c
r9234 r9336 567 567 #endif 568 568 /* write data directly */ 569 rc = write(stream->_fileno, ptr + rsz_buf, rsz_extra);569 rc = write(stream->_fileno, (char *)ptr + rsz_buf, rsz_extra); 570 570 if (rc == -1) 571 571 { … … 577 577 else 578 578 { 579 memcpy(stream->_IO_write_ptr, ptr + rsz_buf, rsz_extra);579 memcpy(stream->_IO_write_ptr, (char *)ptr + rsz_buf, rsz_extra); 580 580 stream->_IO_write_ptr += rsz_extra; 581 581 } … … 717 717 } 718 718 719 /* if more bytes requested */719 /* if more bytes requested */ 720 720 if (rsz_extra) 721 721 { … … 727 727 { 728 728 /* read directly from file for remainder of request */ 729 bytes_read = read(stream->_fileno, ptr+rsz_buf, rsz_extra);729 bytes_read = read(stream->_fileno, (char *)ptr+rsz_buf, rsz_extra); 730 730 if (bytes_read == -1) 731 731 { -
branches/stable/src/common/misc/realpath.c
r9323 r9336 43 43 44 44 #define MAX_READLINKS 32 45 46 extern int PVFS_util_resolve_absolute(47 const char* local_path,48 PVFS_fs_id* out_fs_id,49 char* out_fs_path,50 int out_fs_path_max);51 45 52 46 #ifdef WIN32 -
branches/stable/src/io/trove/trove-dbpf/dbpf-bstream-direct.c
r9247 r9336 582 582 #ifdef HAVE_OPEN_O_DIRECT 583 583 if(!(fcntl(fd, F_GETFL) & O_DIRECT)) 584 #elif HAVE_FNCTL_F_NOCACHE584 #elif defined(HAVE_FNCTL_F_NOCACHE) 585 585 if (!(fcntl(fd, F_GETFL) & F_NOCACHE)) 586 586 #else -
branches/stable/src/kernel/linux-2.6/Makefile.in
r7495 r9336 79 79 80 80 EXTRA_CFLAGS += @MMAP_RA_CACHE@ 81 EXTRA_CFLAGS += @RESET_FILE_POS@ 81 82 EXTRA_CFLAGS += -DPVFS2_VERSION="\"@PVFS2_VERSION@\"" 82 83 -
branches/stable/src/kernel/linux-2.6/file.c
r9298 r9336 50 50 unsigned long xtnr_segs, 51 51 size_t total_size); 52 #ifdef RESET_FILE_POS 53 static ssize_t do_readv_writev_wrapper( struct rw_options *rw); 54 #endif 52 55 53 56 #define wake_up_daemon_for_return(op) \ … … 176 179 struct { 177 180 loff_t *offset; 181 loff_t offset_before_request; 178 182 } io; 179 183 /* Non-contiguous file I/O operations use a vector of offsets */ … … 451 455 { 452 456 gossip_lerr("invalid parameters (rw: %p, vec: %p, nr_segs: %lu, " 453 "total_size: %zd)\n", rw, vec, nr_segs, total_size);457 "total_size: %zd)\n", rw, vec, nr_segs, total_size); 454 458 ret = -EINVAL; 455 459 goto out; … … 477 481 goto out; 478 482 } 479 gossip_debug(GOSSIP_FILE_DEBUG, "GET op %p -> buffer_index %d\n", new_op, buffer_index); 483 gossip_debug(GOSSIP_FILE_DEBUG, "%s/%s(%llu): GET op %p -> buffer_index %d\n" 484 , __func__ 485 ,rw->fnstr 486 , llu(rw->pvfs2_inode->refn.handle) 487 , new_op, buffer_index); 480 488 481 489 new_op->uses_shared_memory = 1; … … 484 492 new_op->upcall.req.io.offset = *(rw->off.io.offset); 485 493 486 gossip_debug(GOSSIP_FILE_DEBUG, "%s: copy_to_user %d nr_segs %lu, " 487 "offset: %llu total_size: %zd\n", rw->fnstr, rw->copy_to_user_addresses, 488 nr_segs, llu(*(rw->off.io.offset)), total_size); 494 gossip_debug(GOSSIP_FILE_DEBUG, "%s/%s(%llu): copy_to_user %d nr_segs %lu, " 495 "offset: %llu total_size: %zd\n" 496 ,__func__ 497 ,rw->fnstr 498 ,llu(rw->pvfs2_inode->refn.handle) 499 ,rw->copy_to_user_addresses 500 ,nr_segs 501 ,llu(*(rw->off.io.offset)) 502 ,total_size); 503 489 504 490 505 /* Stage 1: copy the buffers into client-core's address space */ 506 /* precopy_buffers only pertains to writes. */ 491 507 if ((ret = precopy_buffers(buffer_index, rw, vec, nr_segs, total_size)) < 0) 492 508 { 493 509 goto out; 494 510 } 511 512 gossip_debug(GOSSIP_FILE_DEBUG,"%s/%s(%llu): Calling post_io_request with tag(%d)\n" 513 ,__func__ 514 ,rw->fnstr 515 ,llu(rw->pvfs2_inode->refn.handle) 516 ,(int)new_op->tag); 495 517 496 518 /* Stage 2: Service the I/O operation */ … … 500 522 /* If service_operation() returns -EAGAIN #and# the operation was purged from 501 523 * pvfs2_request_list or htable_ops_in_progress, then we know that the 502 * client was restarted, causing the share memory area to be wiped clean. To restart an 503 * I/O operation in this case, we must re-copy the data from the user's iovec 504 * to a NEW shared memory location. 524 * client was restarted, causing the shared memory area to be wiped clean. To restart a 525 * write operation in this case, we must re-copy the data from the user's iovec 526 * to a NEW shared memory location. To restart a read operation, we must get a new 527 * shared memory location. 505 528 */ 506 529 if ( ret == -EAGAIN && op_state_purged(new_op) ) 507 530 { 508 gossip_debug(GOSSIP_WAIT_DEBUG,"%s:going to populate_shared_memory.\n",__func__);531 gossip_debug(GOSSIP_WAIT_DEBUG,"%s:going to repopulate_shared_memory.\n",__func__); 509 532 goto populate_shared_memory; 510 533 } … … 540 563 goto out; 541 564 } 565 542 566 /* Stage 3: Post copy buffers from client-core's address space */ 567 /* postcopy_buffers only pertains to reads. */ 543 568 if ((ret = postcopy_buffers(buffer_index, rw, vec, nr_segs, 544 569 new_op->downcall.resp.io.amt_complete)) < 0) { … … 550 575 goto out; 551 576 } 577 578 gossip_debug(GOSSIP_FILE_DEBUG,"%s/%s(%llu): Amount written as returned by the sys-io call:%d\n" 579 ,__func__ 580 ,rw->fnstr 581 ,llu(rw->pvfs2_inode->refn.handle) 582 ,(int)new_op->downcall.resp.io.amt_complete); 583 552 584 ret = new_op->downcall.resp.io.amt_complete; 553 gossip_debug(GOSSIP_FILE_DEBUG, "wait_for_io returning %ld\n", (long) ret);585 554 586 /* 555 587 tell the device file owner waiting on I/O that this read has … … 564 596 { 565 597 pvfs_bufmap_put(buffer_index); 566 gossip_debug(GOSSIP_FILE_DEBUG, "PUT buffer_index %d\n", buffer_index); 598 gossip_debug(GOSSIP_FILE_DEBUG, "%s(%llu): PUT buffer_index %d\n" 599 , rw->fnstr 600 , llu(rw->pvfs2_inode->refn.handle) 601 , buffer_index); 567 602 buffer_index = -1; 568 603 } … … 1288 1323 goto out; 1289 1324 } 1325 1326 gossip_debug(GOSSIP_FILE_DEBUG,"%s-BEGIN/%s(%llu): count(%d) after estimate_max_iovecs.\n" 1327 ,__func__ 1328 ,rw->fnstr 1329 ,llu(pvfs2_inode->refn.handle) 1330 ,(int)count); 1331 1290 1332 if (rw->type == IO_WRITEV) 1291 1333 { … … 1312 1354 goto out; 1313 1355 } 1314 gossip_debug(GOSSIP_FILE_DEBUG, "%s: proceeding with offset : %llu, " 1315 "size %zd\n", 1316 rw->fnstr, llu(*offset), count); 1317 } 1356 1357 gossip_debug(GOSSIP_FILE_DEBUG, "%s/%s(%llu): proceeding with offset : %llu, size %d\n" 1358 ,__func__ 1359 ,rw->fnstr 1360 ,llu(pvfs2_inode->refn.handle) 1361 ,llu(*offset), (int)count); 1362 } /*endif IO_WRITEV*/ 1363 1318 1364 if (count == 0) 1319 1365 { … … 1328 1374 * such that no iovec description straddles a block size limit 1329 1375 */ 1376 1377 gossip_debug(GOSSIP_FILE_DEBUG,"%s: pvfs_bufmap_size:%d\n" 1378 ,rw->fnstr 1379 ,pvfs_bufmap_size_query()); 1380 1330 1381 if (count > pvfs_bufmap_size_query()) 1331 1382 { … … 1372 1423 ptr = iovecptr; 1373 1424 1374 gossip_debug(GOSSIP_FILE_DEBUG, "%s %zd@%llu\n", 1375 rw->fnstr, count, llu(*offset)); 1376 gossip_debug(GOSSIP_FILE_DEBUG, "%s: new_nr_segs: %lu, seg_count: %lu\n", 1377 rw->fnstr, new_nr_segs, seg_count); 1425 gossip_debug(GOSSIP_FILE_DEBUG, "%s/%s(%llu) %d@%llu\n" 1426 , __func__ 1427 , rw->fnstr 1428 , llu(pvfs2_inode->refn.handle) 1429 , (int)count, llu(*offset)); 1430 gossip_debug(GOSSIP_FILE_DEBUG, "%s/%s(%llu): new_nr_segs: %lu, seg_count: %lu\n" 1431 , __func__ 1432 , rw->fnstr 1433 , llu(pvfs2_inode->refn.handle) 1434 , new_nr_segs, seg_count); 1435 1378 1436 #ifdef PVFS2_KERNEL_DEBUG 1379 1437 for (seg = 0; seg < new_nr_segs; seg++) … … 1414 1472 //{ 1415 1473 /* push the I/O directly through to storage */ 1416 ret = wait_for_direct_io(rw, ptr, seg_array[seg], each_count); 1417 //} 1474 1475 gossip_debug(GOSSIP_FILE_DEBUG,"%s/%s(%llu): size of each_count(%d)\n" 1476 ,__func__ 1477 ,rw->fnstr 1478 ,llu(pvfs2_inode->refn.handle) 1479 ,(int)each_count); 1480 gossip_debug(GOSSIP_FILE_DEBUG,"%s/%s(%llu): BEFORE wait_for_io: offset is %d\n" 1481 ,__func__ 1482 ,rw->fnstr 1483 ,llu(pvfs2_inode->refn.handle) 1484 ,(int)*offset); 1485 1486 ret = wait_for_direct_io(rw, ptr, seg_array[seg], each_count); 1487 1488 gossip_debug(GOSSIP_FILE_DEBUG,"%s%s(%llu): return from wait_for_io:%d\n" 1489 ,__func__ 1490 ,rw->fnstr 1491 ,llu(pvfs2_inode->refn.handle) 1492 ,(int)ret); 1493 1418 1494 if (ret < 0) 1419 1495 { 1420 1496 goto out; 1421 1497 } 1498 1422 1499 /* advance the iovec pointer */ 1423 1500 ptr += seg_array[seg]; … … 1427 1504 amt_complete = ret; 1428 1505 1506 gossip_debug(GOSSIP_FILE_DEBUG,"%s/%s(%llu): AFTER wait_for_io: offset is %d\n" 1507 ,__func__ 1508 ,rw->fnstr 1509 ,llu(pvfs2_inode->refn.handle) 1510 ,(int)*offset); 1511 1429 1512 /* if we got a short I/O operations, 1430 1513 * fall out and return what we got so far … … 1434 1517 break; 1435 1518 } 1436 } 1519 }/*end while*/ 1520 1437 1521 if (total_count > 0) 1438 1522 { … … 1459 1543 mark_inode_dirty_sync(inode); 1460 1544 } 1545 1546 gossip_debug(GOSSIP_FILE_DEBUG,"%s/%s(%llu): Value(%d) returned.\n" 1547 ,__func__ 1548 ,rw->fnstr 1549 ,llu(pvfs2_inode->refn.handle) 1550 ,(int)ret); 1551 1461 1552 return ret; 1462 1553 } … … 1529 1620 g_pvfs2_stats.reads++; 1530 1621 1622 #ifdef RESET_FILE_POS 1623 return do_readv_writev_wrapper(&rw); 1624 #else 1531 1625 return do_readv_writev(&rw); 1626 #endif 1532 1627 } 1533 1628 … … 1560 1655 rw.off.io.offset = offset; 1561 1656 g_pvfs2_stats.writes++; 1657 1658 #ifdef RESET_FILE_POS 1659 return do_readv_writev_wrapper(&rw); 1660 #else 1562 1661 return do_readv_writev(&rw); 1662 #endif 1563 1663 } 1564 1664 … … 2701 2801 if (!rw->async) 2702 2802 { 2803 2804 #ifdef RESET_FILE_POS 2805 error = do_readv_writev_wrapper(rw); 2806 #else 2703 2807 error = do_readv_writev(rw); 2808 #endif 2809 2704 2810 /* not sure this is the correct place or way to update ki_pos but it 2705 2811 * definitely needs to occur somehow. otherwise, a write following … … 3553 3659 #endif 3554 3660 3661 3662 #ifdef RESET_FILE_POS 3663 /* This function wrapper imposes the rule that the user's 3664 * request was either entirely fulfilled or it wasn't. If it wasn't, 3665 * then errno will be set appropriately, -1 will be returned as the 3666 * request's return value, and the file offset will be repositioned to 3667 * the beginning of the request. If it was successfully completed, then 3668 * the amount written/read will be returned and the file offset will be 3669 * incremented the appropriate amount. 3670 */ 3671 static ssize_t do_readv_writev_wrapper( struct rw_options *rw) 3672 { 3673 ssize_t ret; 3674 3675 gossip_err("Wrapper called.\n"); 3676 3677 /* Save the file's current offset before issuing this read/write 3678 * request. 3679 */ 3680 rw->off.io.offset_before_request = *(rw->off.io.offset); 3681 3682 /* If the return code from the request is negative, 3683 * restore the offset to it's original value. 3684 */ 3685 ret = do_readv_writev(rw); 3686 if (ret < 0) 3687 { 3688 *(rw->off.io.offset) = rw->off.io.offset_before_request; 3689 } 3690 return (ret); 3691 } 3692 #endif 3693 3694 3695 3555 3696 /* 3556 3697 * Local variables: -
branches/stable/src/kernel/linux-2.6/pvfs2-kernel.h
r9298 r9336 385 385 /* buffer and re-populate it. */ 386 386 int uses_shared_memory; 387 388 387 389 388 pvfs2_upcall_t upcall;
