From 74a089f7b6f6ec4af1ef57655533cee6bbb831e5 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Tue, 23 Aug 2011 20:01:04 +0200 Subject: [PATCH] --- yaml --- r: 273826 b: refs/heads/master c: d27769ec3df1a8de9ca450d2dcd72d1ab259ba32 h: refs/heads/master v: v3 --- [refs] | 2 +- .../ABI/testing/sysfs-bus-pci-devices-cciss | 7 -- trunk/Documentation/blockdev/cciss.txt | 10 --- trunk/block/genhd.c | 4 +- trunk/block/ioctl.c | 2 +- trunk/drivers/block/cciss.c | 69 +++---------------- trunk/drivers/block/cciss.h | 1 - trunk/drivers/block/loop.c | 54 --------------- trunk/drivers/block/nbd.c | 69 ++++++++++--------- trunk/fs/block_dev.c | 2 +- trunk/include/linux/genhd.h | 6 +- 11 files changed, 55 insertions(+), 171 deletions(-) diff --git a/[refs] b/[refs] index a89cf2e76612..32c37869aeca 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: dfaa2ef68e80c378e610e3c8c536f1c239e8d3ef +refs/heads/master: d27769ec3df1a8de9ca450d2dcd72d1ab259ba32 diff --git a/trunk/Documentation/ABI/testing/sysfs-bus-pci-devices-cciss b/trunk/Documentation/ABI/testing/sysfs-bus-pci-devices-cciss index 53d99edd1d75..f5bb0a3bb8c0 100644 --- a/trunk/Documentation/ABI/testing/sysfs-bus-pci-devices-cciss +++ b/trunk/Documentation/ABI/testing/sysfs-bus-pci-devices-cciss @@ -71,10 +71,3 @@ Description: Value of 1 indicates the controller can honor the reset_devices a dump device, as kdump requires resetting the device in order to work reliably. -Where: /sys/bus/pci/devices//ccissX/transport_mode -Date: July 2011 -Kernel Version: 3.0 -Contact: iss_storagedev@hp.com -Description: Value of "simple" indicates that the controller has been placed - in "simple mode". Value of "performant" indicates that the - controller has been placed in "performant mode". diff --git a/trunk/Documentation/blockdev/cciss.txt b/trunk/Documentation/blockdev/cciss.txt index 71464e09ec18..c00c6a5ab21f 100644 --- a/trunk/Documentation/blockdev/cciss.txt +++ b/trunk/Documentation/blockdev/cciss.txt @@ -78,16 +78,6 @@ The device naming scheme is: /dev/cciss/c1d1p2 Controller 1, disk 1, partition 2 /dev/cciss/c1d1p3 Controller 1, disk 1, partition 3 -CCISS simple mode support -------------------------- - -The "cciss_simple_mode=1" boot parameter may be used to prevent the driver -from putting the controller into "performant" mode. The difference is that -with simple mode, each command completion requires an interrupt, while with -"performant mode" (the default, and ordinarily better performing) it is -possible to have multiple command completions indicated by a single -interrupt. - SCSI tape drive and medium changer support ------------------------------------------ diff --git a/trunk/block/genhd.c b/trunk/block/genhd.c index 5cb51c55f6d8..2429ecbbd97d 100644 --- a/trunk/block/genhd.c +++ b/trunk/block/genhd.c @@ -536,7 +536,7 @@ void register_disk(struct gendisk *disk) disk->slave_dir = kobject_create_and_add("slaves", &ddev->kobj); /* No minors to use for partitions */ - if (!disk_partitionable(disk)) + if (!disk_part_scan_enabled(disk)) goto exit; /* No such device (e.g., media were just removed) */ @@ -841,7 +841,7 @@ static int show_partition(struct seq_file *seqf, void *v) char buf[BDEVNAME_SIZE]; /* Don't show non-partitionable removeable devices or empty devices */ - if (!get_capacity(sgp) || (!disk_partitionable(sgp) && + if (!get_capacity(sgp) || (!disk_max_parts(sgp) && (sgp->flags & GENHD_FL_REMOVABLE))) return 0; if (sgp->flags & GENHD_FL_SUPPRESS_PARTITION_INFO) diff --git a/trunk/block/ioctl.c b/trunk/block/ioctl.c index 1124cd297263..5c74efc01903 100644 --- a/trunk/block/ioctl.c +++ b/trunk/block/ioctl.c @@ -101,7 +101,7 @@ static int blkdev_reread_part(struct block_device *bdev) struct gendisk *disk = bdev->bd_disk; int res; - if (!disk_partitionable(disk) || bdev != bdev->bd_contains) + if (!disk_part_scan_enabled(disk) || bdev != bdev->bd_contains) return -EINVAL; if (!capable(CAP_SYS_ADMIN)) return -EACCES; diff --git a/trunk/drivers/block/cciss.c b/trunk/drivers/block/cciss.c index 6da7edea700a..8f4ef656a1af 100644 --- a/trunk/drivers/block/cciss.c +++ b/trunk/drivers/block/cciss.c @@ -68,10 +68,6 @@ static int cciss_tape_cmds = 6; module_param(cciss_tape_cmds, int, 0644); MODULE_PARM_DESC(cciss_tape_cmds, "number of commands to allocate for tape devices (default: 6)"); -static int cciss_simple_mode; -module_param(cciss_simple_mode, int, S_IRUGO|S_IWUSR); -MODULE_PARM_DESC(cciss_simple_mode, - "Use 'simple mode' rather than 'performant mode'"); static DEFINE_MUTEX(cciss_mutex); static struct proc_dir_entry *proc_cciss; @@ -180,7 +176,6 @@ static void cciss_geometry_inquiry(ctlr_info_t *h, int logvol, unsigned int block_size, InquiryData_struct *inq_buff, drive_info_struct *drv); static void __devinit cciss_interrupt_mode(ctlr_info_t *); -static int __devinit cciss_enter_simple_mode(struct ctlr_info *h); static void start_io(ctlr_info_t *h); static int sendcmd_withirq(ctlr_info_t *h, __u8 cmd, void *buff, size_t size, __u8 page_code, unsigned char scsi3addr[], @@ -393,7 +388,7 @@ static void cciss_seq_show_header(struct seq_file *seq) h->product_name, (unsigned long)h->board_id, h->firm_ver[0], h->firm_ver[1], h->firm_ver[2], - h->firm_ver[3], (unsigned int)h->intr[h->intr_mode], + h->firm_ver[3], (unsigned int)h->intr[PERF_MODE_INT], h->num_luns, h->Qdepth, h->commands_outstanding, h->maxQsinceinit, h->max_outstanding, h->maxSG); @@ -641,18 +636,6 @@ static ssize_t host_store_rescan(struct device *dev, } static DEVICE_ATTR(rescan, S_IWUSR, NULL, host_store_rescan); -static ssize_t host_show_transport_mode(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct ctlr_info *h = to_hba(dev); - - return snprintf(buf, 20, "%s\n", - h->transMethod & CFGTBL_Trans_Performant ? - "performant" : "simple"); -} -static DEVICE_ATTR(transport_mode, S_IRUGO, host_show_transport_mode, NULL); - static ssize_t dev_show_unique_id(struct device *dev, struct device_attribute *attr, char *buf) @@ -825,7 +808,6 @@ static DEVICE_ATTR(usage_count, S_IRUGO, cciss_show_usage_count, NULL); static struct attribute *cciss_host_attrs[] = { &dev_attr_rescan.attr, &dev_attr_resettable.attr, - &dev_attr_transport_mode.attr, NULL }; @@ -4002,9 +3984,6 @@ static void __devinit cciss_put_controller_into_performant_mode(ctlr_info_t *h) { __u32 trans_support; - if (cciss_simple_mode) - return; - dev_dbg(&h->pdev->dev, "Trying to put board into Performant mode\n"); /* Attempt to put controller into performant mode if supported */ /* Does board support performant mode? */ @@ -4102,7 +4081,7 @@ static void __devinit cciss_interrupt_mode(ctlr_info_t *h) default_int_mode: #endif /* CONFIG_PCI_MSI */ /* if we get here we're going to use the default interrupt mode */ - h->intr[h->intr_mode] = h->pdev->irq; + h->intr[PERF_MODE_INT] = h->pdev->irq; return; } @@ -4362,9 +4341,6 @@ static int __devinit cciss_pci_init(ctlr_info_t *h) } cciss_enable_scsi_prefetch(h); cciss_p600_dma_prefetch_quirk(h); - err = cciss_enter_simple_mode(h); - if (err) - goto err_out_free_res; cciss_put_controller_into_performant_mode(h); return 0; @@ -4867,20 +4843,20 @@ static int cciss_request_irq(ctlr_info_t *h, irqreturn_t (*intxhandler)(int, void *)) { if (h->msix_vector || h->msi_vector) { - if (!request_irq(h->intr[h->intr_mode], msixhandler, + if (!request_irq(h->intr[PERF_MODE_INT], msixhandler, IRQF_DISABLED, h->devname, h)) return 0; dev_err(&h->pdev->dev, "Unable to get msi irq %d" - " for %s\n", h->intr[h->intr_mode], + " for %s\n", h->intr[PERF_MODE_INT], h->devname); return -1; } - if (!request_irq(h->intr[h->intr_mode], intxhandler, + if (!request_irq(h->intr[PERF_MODE_INT], intxhandler, IRQF_DISABLED, h->devname, h)) return 0; dev_err(&h->pdev->dev, "Unable to get irq %d for %s\n", - h->intr[h->intr_mode], h->devname); + h->intr[PERF_MODE_INT], h->devname); return -1; } @@ -4911,7 +4887,7 @@ static void cciss_undo_allocations_after_kdump_soft_reset(ctlr_info_t *h) { int ctlr = h->ctlr; - free_irq(h->intr[h->intr_mode], h); + free_irq(h->intr[PERF_MODE_INT], h); #ifdef CONFIG_PCI_MSI if (h->msix_vector) pci_disable_msix(h->pdev); @@ -4977,7 +4953,6 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, h = hba[i]; h->pdev = pdev; h->busy_initializing = 1; - h->intr_mode = cciss_simple_mode ? SIMPLE_MODE_INT : PERF_MODE_INT; INIT_LIST_HEAD(&h->cmpQ); INIT_LIST_HEAD(&h->reqQ); mutex_init(&h->busy_shutting_down); @@ -5034,7 +5009,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, dev_info(&h->pdev->dev, "%s: <0x%x> at PCI %s IRQ %d%s using DAC\n", h->devname, pdev->device, pci_name(pdev), - h->intr[h->intr_mode], dac ? "" : " not"); + h->intr[PERF_MODE_INT], dac ? "" : " not"); if (cciss_allocate_cmd_pool(h)) goto clean4; @@ -5081,7 +5056,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, spin_lock_irqsave(&h->lock, flags); h->access.set_intr_mask(h, CCISS_INTR_OFF); spin_unlock_irqrestore(&h->lock, flags); - free_irq(h->intr[h->intr_mode], h); + free_irq(h->intr[PERF_MODE_INT], h); rc = cciss_request_irq(h, cciss_msix_discard_completions, cciss_intx_discard_completions); if (rc) { @@ -5158,7 +5133,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, cciss_free_cmd_pool(h); cciss_free_scatterlists(h); cciss_free_sg_chain_blocks(h->cmd_sg_list, h->nr_cmds); - free_irq(h->intr[h->intr_mode], h); + free_irq(h->intr[PERF_MODE_INT], h); clean2: unregister_blkdev(h->major, h->devname); clean1: @@ -5197,31 +5172,9 @@ static void cciss_shutdown(struct pci_dev *pdev) if (return_code != IO_OK) dev_warn(&h->pdev->dev, "Error flushing cache\n"); h->access.set_intr_mask(h, CCISS_INTR_OFF); - free_irq(h->intr[h->intr_mode], h); -} - -static int __devinit cciss_enter_simple_mode(struct ctlr_info *h) -{ - u32 trans_support; - - trans_support = readl(&(h->cfgtable->TransportSupport)); - if (!(trans_support & SIMPLE_MODE)) - return -ENOTSUPP; - - h->max_commands = readl(&(h->cfgtable->CmdsOutMax)); - writel(CFGTBL_Trans_Simple, &(h->cfgtable->HostWrite.TransportRequest)); - writel(CFGTBL_ChangeReq, h->vaddr + SA5_DOORBELL); - cciss_wait_for_mode_change_ack(h); - print_cfg_table(h); - if (!(readl(&(h->cfgtable->TransportActive)) & CFGTBL_Trans_Simple)) { - dev_warn(&h->pdev->dev, "unable to get board into simple mode\n"); - return -ENODEV; - } - h->transMethod = CFGTBL_Trans_Simple; - return 0; + free_irq(h->intr[PERF_MODE_INT], h); } - static void __devexit cciss_remove_one(struct pci_dev *pdev) { ctlr_info_t *h; diff --git a/trunk/drivers/block/cciss.h b/trunk/drivers/block/cciss.h index 7fda30e4a241..c049548e68b7 100644 --- a/trunk/drivers/block/cciss.h +++ b/trunk/drivers/block/cciss.h @@ -92,7 +92,6 @@ struct ctlr_info unsigned int intr[4]; unsigned int msix_vector; unsigned int msi_vector; - int intr_mode; int cciss_max_sectors; BYTE cciss_read; BYTE cciss_write; diff --git a/trunk/drivers/block/loop.c b/trunk/drivers/block/loop.c index 936cac3c3126..76c8da78212b 100644 --- a/trunk/drivers/block/loop.c +++ b/trunk/drivers/block/loop.c @@ -75,7 +75,6 @@ #include #include #include -#include #include @@ -485,29 +484,6 @@ static int do_bio_filebacked(struct loop_device *lo, struct bio *bio) } } - /* - * We use punch hole to reclaim the free space used by the - * image a.k.a. discard. However we do support discard if - * encryption is enabled, because it may give an attacker - * useful information. - */ - if (bio->bi_rw & REQ_DISCARD) { - struct file *file = lo->lo_backing_file; - int mode = FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE; - - if ((!file->f_op->fallocate) || - lo->lo_encrypt_key_size) { - ret = -EOPNOTSUPP; - goto out; - } - ret = file->f_op->fallocate(file, mode, pos, - bio->bi_size); - if (unlikely(ret && ret != -EINVAL && - ret != -EOPNOTSUPP)) - ret = -EIO; - goto out; - } - ret = lo_send(lo, bio, pos); if ((bio->bi_rw & REQ_FUA) && !ret) { @@ -838,35 +814,6 @@ static void loop_sysfs_exit(struct loop_device *lo) &loop_attribute_group); } -static void loop_config_discard(struct loop_device *lo) -{ - struct file *file = lo->lo_backing_file; - struct inode *inode = file->f_mapping->host; - struct request_queue *q = lo->lo_queue; - - /* - * We use punch hole to reclaim the free space used by the - * image a.k.a. discard. However we do support discard if - * encryption is enabled, because it may give an attacker - * useful information. - */ - if ((!file->f_op->fallocate) || - lo->lo_encrypt_key_size) { - q->limits.discard_granularity = 0; - q->limits.discard_alignment = 0; - q->limits.max_discard_sectors = 0; - q->limits.discard_zeroes_data = 0; - queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, q); - return; - } - - q->limits.discard_granularity = inode->i_sb->s_blocksize; - q->limits.discard_alignment = inode->i_sb->s_blocksize; - q->limits.max_discard_sectors = UINT_MAX >> 9; - q->limits.discard_zeroes_data = 1; - queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, q); -} - static int loop_set_fd(struct loop_device *lo, fmode_t mode, struct block_device *bdev, unsigned int arg) { @@ -1143,7 +1090,6 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info) if (figure_loop_size(lo)) return -EFBIG; } - loop_config_discard(lo); memcpy(lo->lo_file_name, info->lo_file_name, LO_NAME_SIZE); memcpy(lo->lo_crypt_name, info->lo_crypt_name, LO_NAME_SIZE); diff --git a/trunk/drivers/block/nbd.c b/trunk/drivers/block/nbd.c index c3f0ee16594d..f533f3375e24 100644 --- a/trunk/drivers/block/nbd.c +++ b/trunk/drivers/block/nbd.c @@ -127,7 +127,8 @@ static void sock_shutdown(struct nbd_device *lo, int lock) if (lock) mutex_lock(&lo->tx_lock); if (lo->sock) { - dev_warn(disk_to_dev(lo->disk), "shutting down socket\n"); + printk(KERN_WARNING "%s: shutting down socket\n", + lo->disk->disk_name); kernel_sock_shutdown(lo->sock, SHUT_RDWR); lo->sock = NULL; } @@ -157,9 +158,8 @@ static int sock_xmit(struct nbd_device *lo, int send, void *buf, int size, sigset_t blocked, oldset; if (unlikely(!sock)) { - dev_err(disk_to_dev(lo->disk), - "Attempted %s on closed socket in sock_xmit\n", - (send ? "send" : "recv")); + printk(KERN_ERR "%s: Attempted %s on closed socket in sock_xmit\n", + lo->disk->disk_name, (send ? "send" : "recv")); return -EINVAL; } @@ -250,8 +250,8 @@ static int nbd_send_req(struct nbd_device *lo, struct request *req) result = sock_xmit(lo, 1, &request, sizeof(request), (nbd_cmd(req) == NBD_CMD_WRITE) ? MSG_MORE : 0); if (result <= 0) { - dev_err(disk_to_dev(lo->disk), - "Send control failed (result %d)\n", result); + printk(KERN_ERR "%s: Send control failed (result %d)\n", + lo->disk->disk_name, result); goto error_out; } @@ -270,9 +270,8 @@ static int nbd_send_req(struct nbd_device *lo, struct request *req) lo->disk->disk_name, req, bvec->bv_len); result = sock_send_bvec(lo, bvec, flags); if (result <= 0) { - dev_err(disk_to_dev(lo->disk), - "Send data failed (result %d)\n", - result); + printk(KERN_ERR "%s: Send data failed (result %d)\n", + lo->disk->disk_name, result); goto error_out; } } @@ -329,13 +328,14 @@ static struct request *nbd_read_stat(struct nbd_device *lo) reply.magic = 0; result = sock_xmit(lo, 0, &reply, sizeof(reply), MSG_WAITALL); if (result <= 0) { - dev_err(disk_to_dev(lo->disk), - "Receive control failed (result %d)\n", result); + printk(KERN_ERR "%s: Receive control failed (result %d)\n", + lo->disk->disk_name, result); goto harderror; } if (ntohl(reply.magic) != NBD_REPLY_MAGIC) { - dev_err(disk_to_dev(lo->disk), "Wrong magic (0x%lx)\n", + printk(KERN_ERR "%s: Wrong magic (0x%lx)\n", + lo->disk->disk_name, (unsigned long)ntohl(reply.magic)); result = -EPROTO; goto harderror; @@ -347,15 +347,15 @@ static struct request *nbd_read_stat(struct nbd_device *lo) if (result != -ENOENT) goto harderror; - dev_err(disk_to_dev(lo->disk), "Unexpected reply (%p)\n", - reply.handle); + printk(KERN_ERR "%s: Unexpected reply (%p)\n", + lo->disk->disk_name, reply.handle); result = -EBADR; goto harderror; } if (ntohl(reply.error)) { - dev_err(disk_to_dev(lo->disk), "Other side returned error (%d)\n", - ntohl(reply.error)); + printk(KERN_ERR "%s: Other side returned error (%d)\n", + lo->disk->disk_name, ntohl(reply.error)); req->errors++; return req; } @@ -369,8 +369,8 @@ static struct request *nbd_read_stat(struct nbd_device *lo) rq_for_each_segment(bvec, req, iter) { result = sock_recv_bvec(lo, bvec); if (result <= 0) { - dev_err(disk_to_dev(lo->disk), "Receive data failed (result %d)\n", - result); + printk(KERN_ERR "%s: Receive data failed (result %d)\n", + lo->disk->disk_name, result); req->errors++; return req; } @@ -405,10 +405,10 @@ static int nbd_do_it(struct nbd_device *lo) BUG_ON(lo->magic != LO_MAGIC); - lo->pid = task_pid_nr(current); - ret = device_create_file(disk_to_dev(lo->disk), &pid_attr); + lo->pid = current->pid; + ret = sysfs_create_file(&disk_to_dev(lo->disk)->kobj, &pid_attr.attr); if (ret) { - dev_err(disk_to_dev(lo->disk), "device_create_file failed!\n"); + printk(KERN_ERR "nbd: sysfs_create_file failed!"); lo->pid = 0; return ret; } @@ -416,7 +416,7 @@ static int nbd_do_it(struct nbd_device *lo) while ((req = nbd_read_stat(lo)) != NULL) nbd_end_request(req); - device_remove_file(disk_to_dev(lo->disk), &pid_attr); + sysfs_remove_file(&disk_to_dev(lo->disk)->kobj, &pid_attr.attr); lo->pid = 0; return 0; } @@ -457,8 +457,8 @@ static void nbd_handle_req(struct nbd_device *lo, struct request *req) if (rq_data_dir(req) == WRITE) { nbd_cmd(req) = NBD_CMD_WRITE; if (lo->flags & NBD_READ_ONLY) { - dev_err(disk_to_dev(lo->disk), - "Write on read-only\n"); + printk(KERN_ERR "%s: Write on read-only\n", + lo->disk->disk_name); goto error_out; } } @@ -468,15 +468,16 @@ static void nbd_handle_req(struct nbd_device *lo, struct request *req) mutex_lock(&lo->tx_lock); if (unlikely(!lo->sock)) { mutex_unlock(&lo->tx_lock); - dev_err(disk_to_dev(lo->disk), - "Attempted send on closed socket\n"); + printk(KERN_ERR "%s: Attempted send on closed socket\n", + lo->disk->disk_name); goto error_out; } lo->active_req = req; if (nbd_send_req(lo, req) != 0) { - dev_err(disk_to_dev(lo->disk), "Request send failed\n"); + printk(KERN_ERR "%s: Request send failed\n", + lo->disk->disk_name); req->errors++; nbd_end_request(req); } else { @@ -548,8 +549,8 @@ static void do_nbd_request(struct request_queue *q) BUG_ON(lo->magic != LO_MAGIC); if (unlikely(!lo->sock)) { - dev_err(disk_to_dev(lo->disk), - "Attempted send on closed socket\n"); + printk(KERN_ERR "%s: Attempted send on closed socket\n", + lo->disk->disk_name); req->errors++; nbd_end_request(req); spin_lock_irq(q->queue_lock); @@ -575,7 +576,7 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *lo, case NBD_DISCONNECT: { struct request sreq; - dev_info(disk_to_dev(lo->disk), "NBD_DISCONNECT\n"); + printk(KERN_INFO "%s: NBD_DISCONNECT\n", lo->disk->disk_name); blk_rq_init(NULL, &sreq); sreq.cmd_type = REQ_TYPE_SPECIAL; @@ -673,7 +674,7 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *lo, file = lo->file; lo->file = NULL; nbd_clear_que(lo); - dev_warn(disk_to_dev(lo->disk), "queue cleared\n"); + printk(KERN_WARNING "%s: queue cleared\n", lo->disk->disk_name); if (file) fput(file); lo->bytesize = 0; @@ -693,8 +694,8 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *lo, return 0; case NBD_PRINT_DEBUG: - dev_info(disk_to_dev(lo->disk), - "next = %p, prev = %p, head = %p\n", + printk(KERN_INFO "%s: next = %p, prev = %p, head = %p\n", + bdev->bd_disk->disk_name, lo->queue_head.next, lo->queue_head.prev, &lo->queue_head); return 0; @@ -744,7 +745,7 @@ static int __init nbd_init(void) BUILD_BUG_ON(sizeof(struct nbd_request) != 28); if (max_part < 0) { - printk(KERN_ERR "nbd: max_part must be >= 0\n"); + printk(KERN_CRIT "nbd: max_part must be >= 0\n"); return -EINVAL; } diff --git a/trunk/fs/block_dev.c b/trunk/fs/block_dev.c index ff77262e887c..0bed0d4588dd 100644 --- a/trunk/fs/block_dev.c +++ b/trunk/fs/block_dev.c @@ -971,7 +971,7 @@ static void flush_disk(struct block_device *bdev, bool kill_dirty) if (!bdev->bd_disk) return; - if (disk_partitionable(bdev->bd_disk)) + if (disk_part_scan_enabled(bdev->bd_disk)) bdev->bd_invalidated = 1; } diff --git a/trunk/include/linux/genhd.h b/trunk/include/linux/genhd.h index 02fa4697a0e5..6d18f3531f18 100644 --- a/trunk/include/linux/genhd.h +++ b/trunk/include/linux/genhd.h @@ -128,6 +128,7 @@ struct hd_struct { #define GENHD_FL_EXT_DEVT 64 /* allow extended devt */ #define GENHD_FL_NATIVE_CAPACITY 128 #define GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE 256 +#define GENHD_FL_NO_PART_SCAN 512 enum { DISK_EVENT_MEDIA_CHANGE = 1 << 0, /* media changed */ @@ -234,9 +235,10 @@ static inline int disk_max_parts(struct gendisk *disk) return disk->minors; } -static inline bool disk_partitionable(struct gendisk *disk) +static inline bool disk_part_scan_enabled(struct gendisk *disk) { - return disk_max_parts(disk) > 1; + return disk_max_parts(disk) > 1 && + !(disk->flags & GENHD_FL_NO_PART_SCAN); } static inline dev_t disk_devt(struct gendisk *disk)