block: do not parse BDRV_O_CACHE_WB in block drivers
Block drivers should ignore BDRV_O_CACHE_WB in .bdrv_open flags, and in the bs->open_flags. This patch removes the code, leaving the behaviour behind as if BDRV_O_CACHE_WB was set. Signed-off-by: Jeff Cody <jcody@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
		
							parent
							
								
									6a8dc0422e
								
							
						
					
					
						commit
						39c9fb9565
					
				| 
						 | 
				
			
			@ -268,10 +268,6 @@ iscsi_aio_writev(BlockDriverState *bs, int64_t sector_num,
 | 
			
		|||
    acb->task->xfer_dir = SCSI_XFER_WRITE;
 | 
			
		||||
    acb->task->cdb_size = 16;
 | 
			
		||||
    acb->task->cdb[0] = 0x8a;
 | 
			
		||||
    if (!(bs->open_flags & BDRV_O_CACHE_WB)) {
 | 
			
		||||
        /* set FUA on writes when cache mode is write through */
 | 
			
		||||
        acb->task->cdb[1] |= 0x04;
 | 
			
		||||
    }
 | 
			
		||||
    lba = sector_qemu2lun(sector_num, iscsilun);
 | 
			
		||||
    *(uint32_t *)&acb->task->cdb[2]  = htonl(lba >> 32);
 | 
			
		||||
    *(uint32_t *)&acb->task->cdb[6]  = htonl(lba & 0xffffffff);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -202,9 +202,6 @@ static void raw_parse_flags(int bdrv_flags, int *open_flags)
 | 
			
		|||
    if ((bdrv_flags & BDRV_O_NOCACHE)) {
 | 
			
		||||
        *open_flags |= O_DIRECT;
 | 
			
		||||
    }
 | 
			
		||||
    if (!(bdrv_flags & BDRV_O_CACHE_WB)) {
 | 
			
		||||
        *open_flags |= O_DSYNC;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifdef CONFIG_LINUX_AIO
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -92,9 +92,6 @@ static void raw_parse_flags(int flags, int *access_flags, DWORD *overlapped)
 | 
			
		|||
    if (flags & BDRV_O_NOCACHE) {
 | 
			
		||||
        *overlapped |= FILE_FLAG_NO_BUFFERING;
 | 
			
		||||
    }
 | 
			
		||||
    if (!(flags & BDRV_O_CACHE_WB)) {
 | 
			
		||||
        *overlapped |= FILE_FLAG_WRITE_THROUGH;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int raw_open(BlockDriverState *bs, const char *filename, int flags)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -487,12 +487,6 @@ static int qemu_rbd_open(BlockDriverState *bs, const char *filename, int flags)
 | 
			
		|||
        rados_conf_set(s->cluster, "rbd_cache", "false");
 | 
			
		||||
    } else {
 | 
			
		||||
        rados_conf_set(s->cluster, "rbd_cache", "true");
 | 
			
		||||
        if (!(flags & BDRV_O_CACHE_WB)) {
 | 
			
		||||
            r = rados_conf_set(s->cluster, "rbd_cache_max_dirty", "0");
 | 
			
		||||
            if (r < 0) {
 | 
			
		||||
                rados_conf_set(s->cluster, "rbd_cache", "false");
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (strstr(conf, "conf=") == NULL) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1114,7 +1114,6 @@ static int sd_open(BlockDriverState *bs, const char *filename, int flags)
 | 
			
		|||
        goto out;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (flags & BDRV_O_CACHE_WB) {
 | 
			
		||||
    s->cache_enabled = 1;
 | 
			
		||||
    s->flush_fd = connect_to_sdog(s->addr, s->port);
 | 
			
		||||
    if (s->flush_fd < 0) {
 | 
			
		||||
| 
						 | 
				
			
			@ -1122,7 +1121,6 @@ static int sd_open(BlockDriverState *bs, const char *filename, int flags)
 | 
			
		|||
        ret = s->flush_fd;
 | 
			
		||||
        goto out;
 | 
			
		||||
    }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (snapid || tag[0] != '\0') {
 | 
			
		||||
        dprintf("%" PRIx32 " snapshot inode was open.\n", vid);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue