Print this page
3515 sd gives RMW warnings for reads
Reviewed by: Albert Lee <trisk@nexenta.com>
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/scsi/targets/sd.c
          +++ new/usr/src/uts/common/io/scsi/targets/sd.c
↓ open down ↓ 15 lines elided ↑ open up ↑
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
  24   24   */
  25   25  /*
  26      - * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  27   26   * Copyright (c) 2011 Bayard G. Bell.  All rights reserved.
  28   27   * Copyright (c) 2012 by Delphix. All rights reserved.
       28 + * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  29   29   */
  30   30  /*
  31   31   * Copyright 2011 cyril.galibern@opensvc.com
  32   32   */
  33   33  
  34   34  /*
  35   35   * SCSI disk target driver.
  36   36   */
  37   37  #include <sys/scsi/scsi.h>
  38   38  #include <sys/dkbad.h>
↓ open down ↓ 12601 lines elided ↑ open up ↑
12640 12640  
12641 12641          if (!(NOT_DEVBSIZE(un)) || un->un_f_enable_rmw) {
12642 12642                  /*
12643 12643                   * If I/O is aligned, no need to involve RMW(Read Modify Write)
12644 12644                   * Convert the logical block number to target's physical sector
12645 12645                   * number.
12646 12646                   */
12647 12647                  if (is_aligned) {
12648 12648                          xp->xb_blkno = SD_SYS2TGTBLOCK(un, xp->xb_blkno);
12649 12649                  } else {
12650      -                        switch (un->un_f_rmw_type) {
12651      -                        case SD_RMW_TYPE_RETURN_ERROR:
12652      -                                if (un->un_f_enable_rmw)
12653      -                                        break;
12654      -                                else {
12655      -                                        bp->b_flags |= B_ERROR;
12656      -                                        goto error_exit;
12657      -                                }
12658      -
12659      -                        case SD_RMW_TYPE_DEFAULT:
     12650 +                        /*
     12651 +                         * There is no RMW if we're just reading, so don't
     12652 +                         * warn or error out because of it.
     12653 +                         */
     12654 +                        if (bp->b_flags & B_READ) {
     12655 +                                /*EMPTY*/
     12656 +                        } else if (!un->un_f_enable_rmw &&
     12657 +                            un->un_f_rmw_type == SD_RMW_TYPE_RETURN_ERROR) {
     12658 +                                bp->b_flags |= B_ERROR;
     12659 +                                goto error_exit;
     12660 +                        } else if (un->un_f_rmw_type == SD_RMW_TYPE_DEFAULT) {
12660 12661                                  mutex_enter(SD_MUTEX(un));
12661 12662                                  if (!un->un_f_enable_rmw &&
12662 12663                                      un->un_rmw_msg_timeid == NULL) {
12663 12664                                          scsi_log(SD_DEVINFO(un), sd_label,
12664 12665                                              CE_WARN, "I/O request is not "
12665 12666                                              "aligned with %d disk sector size. "
12666 12667                                              "It is handled through Read Modify "
12667 12668                                              "Write but the performance is "
12668 12669                                              "very low.\n",
12669 12670                                              un->un_tgt_blocksize);
12670 12671                                          un->un_rmw_msg_timeid =
12671 12672                                              timeout(sd_rmw_msg_print_handler,
12672 12673                                              un, SD_RMW_MSG_PRINT_TIMEOUT);
12673 12674                                  } else {
12674 12675                                          un->un_rmw_incre_count ++;
12675 12676                                  }
12676 12677                                  mutex_exit(SD_MUTEX(un));
12677      -                                break;
12678      -
12679      -                        case SD_RMW_TYPE_NO_WARNING:
12680      -                        default:
12681      -                                break;
12682 12678                          }
12683 12679  
12684 12680                          nblocks = SD_TGT2SYSBLOCK(un, nblocks);
12685 12681                          partition_offset = SD_TGT2SYSBLOCK(un,
12686 12682                              partition_offset);
12687 12683                  }
12688 12684          }
12689 12685  
12690 12686          /*
12691 12687           * blocknum is the starting block number of the request. At this
↓ open down ↓ 19098 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX