[BACK]Return to rf_netbsdkintf.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / dev / raidframe

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/sys/dev/raidframe/rf_netbsdkintf.c between version 1.345.2.8 and 1.346

version 1.345.2.8, 2017/04/26 02:53:23 version 1.346, 2016/09/19 23:32:30
Line 127  __KERNEL_RCSID(0, "$NetBSD$");
Line 127  __KERNEL_RCSID(0, "$NetBSD$");
 #include <sys/reboot.h>  #include <sys/reboot.h>
 #include <sys/kauth.h>  #include <sys/kauth.h>
 #include <sys/module.h>  #include <sys/module.h>
 #include <sys/localcount.h>  
   
 #include <prop/proplib.h>  #include <prop/proplib.h>
   
Line 189  static void InitBP(struct buf *, struct 
Line 188  static void InitBP(struct buf *, struct 
 struct raid_softc;  struct raid_softc;
 static void raidinit(struct raid_softc *);  static void raidinit(struct raid_softc *);
 static int raiddoaccess(RF_Raid_t *raidPtr, struct buf *bp);  static int raiddoaccess(RF_Raid_t *raidPtr, struct buf *bp);
 static int rf_get_component_caches(RF_Raid_t *raidPtr, int *);  
   
 static int raid_match(device_t, cfdata_t, void *);  static int raid_match(device_t, cfdata_t, void *);
 static void raid_attach(device_t, device_t, void *);  static void raid_attach(device_t, device_t, void *);
Line 219  static dev_type_dump(raiddump);
Line 217  static dev_type_dump(raiddump);
 static dev_type_size(raidsize);  static dev_type_size(raidsize);
   
 const struct bdevsw raid_bdevsw = {  const struct bdevsw raid_bdevsw = {
         DEVSW_MODULE_INIT  
         .d_open = raidopen,          .d_open = raidopen,
         .d_close = raidclose,          .d_close = raidclose,
         .d_strategy = raidstrategy,          .d_strategy = raidstrategy,
Line 231  const struct bdevsw raid_bdevsw = {
Line 228  const struct bdevsw raid_bdevsw = {
 };  };
   
 const struct cdevsw raid_cdevsw = {  const struct cdevsw raid_cdevsw = {
         DEVSW_MODULE_INIT  
         .d_open = raidopen,          .d_open = raidopen,
         .d_close = raidclose,          .d_close = raidclose,
         .d_read = raidread,          .d_read = raidread,
Line 754  raid_dumpblocks(device_t dev, void *va, 
Line 750  raid_dumpblocks(device_t dev, void *va, 
                 goto out;                  goto out;
         }          }
   
         bdev = bdevsw_lookup_acquire(raidPtr->Disks[dumpto].dev);          bdev = bdevsw_lookup(raidPtr->Disks[dumpto].dev);
         if (bdev == NULL) {          if (bdev == NULL) {
                 error = ENXIO;                  error = ENXIO;
                 goto out;                  goto out;
Line 762  raid_dumpblocks(device_t dev, void *va, 
Line 758  raid_dumpblocks(device_t dev, void *va, 
   
         error = (*bdev->d_dump)(raidPtr->Disks[dumpto].dev,          error = (*bdev->d_dump)(raidPtr->Disks[dumpto].dev,
                                 blkno, va, nblk * raidPtr->bytesPerSector);                                  blkno, va, nblk * raidPtr->bytesPerSector);
         bdevsw_release(bdev);  
 out:  out:
         raidunlock(rs);          raidunlock(rs);
   
Line 1791  raidioctl(dev_t dev, u_long cmd, void *d
Line 1787  raidioctl(dev_t dev, u_long cmd, void *d
          */           */
   
         switch (cmd) {          switch (cmd) {
         case DIOCGCACHE:  
                 retcode = rf_get_component_caches(raidPtr, (int *)data);  
                 break;  
   
         case DIOCCACHESYNC:          case DIOCCACHESYNC:
                 retcode = rf_sync_component_caches(raidPtr);                  retcode = rf_sync_component_caches(raidPtr);
                 break;  
   
         default:          default:
                 retcode = dk_ioctl(dksc, dev, cmd, data, flag, l);                  retcode = dk_ioctl(dksc, dev, cmd, data, flag, l);
                 break;  
         }          }
   
         return (retcode);          return (retcode);
Line 3687  rf_set_geometry(struct raid_softc *rs, R
Line 3677  rf_set_geometry(struct raid_softc *rs, R
         disk_set_info(dksc->sc_dev, &dksc->sc_dkdev, NULL);          disk_set_info(dksc->sc_dev, &dksc->sc_dkdev, NULL);
 }  }
   
 /*  
  * Get cache info for all the components (including spares).  
  * Returns intersection of all the cache flags of all disks, or first  
  * error if any encountered.  
  * XXXfua feature flags can change as spares are added - lock down somehow  
  */  
 static int  
 rf_get_component_caches(RF_Raid_t *raidPtr, int *data)  
 {  
         int c;  
         int error;  
         int dkwhole = 0, dkpart;  
   
         for (c = 0; c < raidPtr->numCol + raidPtr->numSpare; c++) {  
                 /*  
                  * Check any non-dead disk, even when currently being  
                  * reconstructed.  
                  */  
                 if (!RF_DEAD_DISK(raidPtr->Disks[c].status)  
                     || raidPtr->Disks[c].status == rf_ds_reconstructing) {  
                         error = VOP_IOCTL(raidPtr->raid_cinfo[c].ci_vp,  
                             DIOCGCACHE, &dkpart, FREAD, NOCRED);  
                         if (error) {  
                                 if (error != ENODEV) {  
                                         printf("raid%d: get cache for component %s failed\n",  
                                             raidPtr->raidid,  
                                             raidPtr->Disks[c].devname);  
                                 }  
   
                                 return error;  
                         }  
   
                         if (c == 0)  
                                 dkwhole = dkpart;  
                         else  
                                 dkwhole = DKCACHE_COMBINE(dkwhole, dkpart);  
                 }  
         }  
   
         *data = dkwhole;  
   
         return 0;  
 }  
   
 /*  /*
  * Implement forwarding of the DIOCCACHESYNC ioctl to each of the components.   * Implement forwarding of the DIOCCACHESYNC ioctl to each of the components.
  * We end up returning whatever error was returned by the first cache flush   * We end up returning whatever error was returned by the first cache flush
Line 3817  static int
Line 3763  static int
 raid_modcmd_init(void)  raid_modcmd_init(void)
 {  {
         int error;          int error;
 #ifdef _MODULE  
         int bmajor, cmajor;          int bmajor, cmajor;
 #endif  
   
         mutex_init(&raid_lock, MUTEX_DEFAULT, IPL_NONE);          mutex_init(&raid_lock, MUTEX_DEFAULT, IPL_NONE);
         mutex_enter(&raid_lock);          mutex_enter(&raid_lock);
Line 3831  raid_modcmd_init(void)
Line 3775  raid_modcmd_init(void)
         rf_sparet_wait_queue = rf_sparet_resp_queue = NULL;          rf_sparet_wait_queue = rf_sparet_resp_queue = NULL;
 #endif  #endif
   
 #ifdef _MODULE  
         bmajor = cmajor = -1;          bmajor = cmajor = -1;
         error = devsw_attach("raid", &raid_bdevsw, &bmajor,          error = devsw_attach("raid", &raid_bdevsw, &bmajor,
             &raid_cdevsw, &cmajor);              &raid_cdevsw, &cmajor);
         if (error != 0) {          if (error != 0 && error != EEXIST) {
                 aprint_error("%s: devsw_attach failed %d\n", __func__, error);                  aprint_error("%s: devsw_attach failed %d\n", __func__, error);
                 mutex_exit(&raid_lock);                  mutex_exit(&raid_lock);
                 return error;                  return error;
         }          }
   #ifdef _MODULE
         error = config_cfdriver_attach(&raid_cd);          error = config_cfdriver_attach(&raid_cd);
         if (error != 0) {          if (error != 0) {
                 aprint_error("%s: config_cfdriver_attach failed %d\n",                  aprint_error("%s: config_cfdriver_attach failed %d\n",
Line 3913  raid_modcmd_fini(void)
Line 3857  raid_modcmd_fini(void)
                 mutex_exit(&raid_lock);                  mutex_exit(&raid_lock);
                 return error;                  return error;
         }          }
   #endif
         error = devsw_detach(&raid_bdevsw, &raid_cdevsw);          error = devsw_detach(&raid_bdevsw, &raid_cdevsw);
         if (error != 0) {          if (error != 0) {
                 aprint_error("%s: cannot detach devsw\n",__func__);                  aprint_error("%s: cannot detach devsw\n",__func__);
   #ifdef _MODULE
                 config_cfdriver_attach(&raid_cd);                  config_cfdriver_attach(&raid_cd);
   #endif
                 config_cfattach_attach(raid_cd.cd_name, &raid_ca);                  config_cfattach_attach(raid_cd.cd_name, &raid_ca);
                 mutex_exit(&raid_lock);                  mutex_exit(&raid_lock);
                 return error;                  return error;
         }          }
 #endif  
         rf_BootRaidframe(false);          rf_BootRaidframe(false);
 #if (RF_INCLUDE_PARITY_DECLUSTERING_DS > 0)  #if (RF_INCLUDE_PARITY_DECLUSTERING_DS > 0)
         rf_destroy_mutex2(rf_sparet_wait_mutex);          rf_destroy_mutex2(rf_sparet_wait_mutex);

Legend:
Removed from v.1.345.2.8  
changed lines
  Added in v.1.346

CVSweb <webmaster@jp.NetBSD.org>