diff --git a/[refs] b/[refs] index b9959e8249b5..9642a0c50983 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 4c823cc3d568277aa6340d8df6981e34f4c4dee5 +refs/heads/master: 32a8d26cc9b96629269e04ee6c583e14398f6f47 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 2429ecbbd97d..5cb51c55f6d8 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_part_scan_enabled(disk)) + if (!disk_partitionable(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_max_parts(sgp) && + if (!get_capacity(sgp) || (!disk_partitionable(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 5c74efc01903..1124cd297263 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_part_scan_enabled(disk) || bdev != bdev->bd_contains) + if (!disk_partitionable(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/cpqarray.c b/trunk/drivers/block/cpqarray.c index 9125bbeacd4d..b2fceb53e809 100644 --- a/trunk/drivers/block/cpqarray.c +++ b/trunk/drivers/block/cpqarray.c @@ -620,7 +620,6 @@ static int cpqarray_pci_init(ctlr_info_t *c, struct pci_dev *pdev) } vendor_id = pdev->vendor; device_id = pdev->device; - revision = pdev->revision; irq = pdev->irq; for(i=0; i<6; i++) @@ -633,6 +632,7 @@ static int cpqarray_pci_init(ctlr_info_t *c, struct pci_dev *pdev) } pci_read_config_word(pdev, PCI_COMMAND, &command); + pci_read_config_byte(pdev, PCI_CLASS_REVISION, &revision); pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &cache_line_size); pci_read_config_byte(pdev, PCI_LATENCY_TIMER, &latency_timer); diff --git a/trunk/drivers/block/loop.c b/trunk/drivers/block/loop.c index 9b2f5d3c19ab..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) { @@ -724,7 +700,7 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev, goto out_putf; fput(old_file); - if (lo->lo_flags & LO_FLAGS_PARTSCAN) + if (max_part > 0) ioctl_by_bdev(bdev, BLKRRPART, 0); return 0; @@ -808,25 +784,16 @@ static ssize_t loop_attr_autoclear_show(struct loop_device *lo, char *buf) return sprintf(buf, "%s\n", autoclear ? "1" : "0"); } -static ssize_t loop_attr_partscan_show(struct loop_device *lo, char *buf) -{ - int partscan = (lo->lo_flags & LO_FLAGS_PARTSCAN); - - return sprintf(buf, "%s\n", partscan ? "1" : "0"); -} - LOOP_ATTR_RO(backing_file); LOOP_ATTR_RO(offset); LOOP_ATTR_RO(sizelimit); LOOP_ATTR_RO(autoclear); -LOOP_ATTR_RO(partscan); static struct attribute *loop_attrs[] = { &loop_attr_backing_file.attr, &loop_attr_offset.attr, &loop_attr_sizelimit.attr, &loop_attr_autoclear.attr, - &loop_attr_partscan.attr, NULL, }; @@ -847,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) { @@ -988,9 +926,7 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode, } lo->lo_state = Lo_bound; wake_up_process(lo->lo_thread); - if (part_shift) - lo->lo_flags |= LO_FLAGS_PARTSCAN; - if (lo->lo_flags & LO_FLAGS_PARTSCAN) + if (max_part > 0) ioctl_by_bdev(bdev, BLKRRPART, 0); return 0; @@ -1051,11 +987,10 @@ loop_init_xfer(struct loop_device *lo, struct loop_func_table *xfer, return err; } -static int loop_clr_fd(struct loop_device *lo) +static int loop_clr_fd(struct loop_device *lo, struct block_device *bdev) { struct file *filp = lo->lo_backing_file; gfp_t gfp = lo->old_gfp_mask; - struct block_device *bdev = lo->lo_device; if (lo->lo_state != Lo_bound) return -ENXIO; @@ -1082,6 +1017,7 @@ static int loop_clr_fd(struct loop_device *lo) lo->lo_offset = 0; lo->lo_sizelimit = 0; lo->lo_encrypt_key_size = 0; + lo->lo_flags = 0; lo->lo_thread = NULL; memset(lo->lo_encrypt_key, 0, LO_KEY_SIZE); memset(lo->lo_crypt_name, 0, LO_NAME_SIZE); @@ -1099,11 +1035,8 @@ static int loop_clr_fd(struct loop_device *lo) lo->lo_state = Lo_unbound; /* This is safe: open() is still holding a reference. */ module_put(THIS_MODULE); - if (lo->lo_flags & LO_FLAGS_PARTSCAN && bdev) + if (max_part > 0 && bdev) ioctl_by_bdev(bdev, BLKRRPART, 0); - lo->lo_flags = 0; - if (!part_shift) - lo->lo_disk->flags |= GENHD_FL_NO_PART_SCAN; mutex_unlock(&lo->lo_ctl_mutex); /* * Need not hold lo_ctl_mutex to fput backing file. @@ -1157,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); @@ -1173,13 +1105,6 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info) (info->lo_flags & LO_FLAGS_AUTOCLEAR)) lo->lo_flags ^= LO_FLAGS_AUTOCLEAR; - if ((info->lo_flags & LO_FLAGS_PARTSCAN) && - !(lo->lo_flags & LO_FLAGS_PARTSCAN)) { - lo->lo_flags |= LO_FLAGS_PARTSCAN; - lo->lo_disk->flags &= ~GENHD_FL_NO_PART_SCAN; - ioctl_by_bdev(lo->lo_device, BLKRRPART, 0); - } - lo->lo_encrypt_key_size = info->lo_encrypt_key_size; lo->lo_init[0] = info->lo_init[0]; lo->lo_init[1] = info->lo_init[1]; @@ -1373,7 +1298,7 @@ static int lo_ioctl(struct block_device *bdev, fmode_t mode, break; case LOOP_CLR_FD: /* loop_clr_fd would have unlocked lo_ctl_mutex on success */ - err = loop_clr_fd(lo); + err = loop_clr_fd(lo, bdev); if (!err) goto out_unlocked; break; @@ -1584,7 +1509,7 @@ static int lo_release(struct gendisk *disk, fmode_t mode) * In autoclear mode, stop the loop thread * and remove configuration after last close. */ - err = loop_clr_fd(lo); + err = loop_clr_fd(lo, NULL); if (!err) goto out_unlocked; } else { @@ -1675,27 +1600,6 @@ static struct loop_device *loop_alloc(int i) if (!disk) goto out_free_queue; - /* - * Disable partition scanning by default. The in-kernel partition - * scanning can be requested individually per-device during its - * setup. Userspace can always add and remove partitions from all - * devices. The needed partition minors are allocated from the - * extended minor space, the main loop device numbers will continue - * to match the loop minors, regardless of the number of partitions - * used. - * - * If max_part is given, partition scanning is globally enabled for - * all loop devices. The minors for the main loop devices will be - * multiples of max_part. - * - * Note: Global-for-all-devices, set-only-at-init, read-only module - * parameteters like 'max_loop' and 'max_part' make things needlessly - * complicated, are too static, inflexible and may surprise - * userspace tools. Parameters like this in general should be avoided. - */ - if (!part_shift) - disk->flags |= GENHD_FL_NO_PART_SCAN; - disk->flags |= GENHD_FL_EXT_DEVT; mutex_init(&lo->lo_ctl_mutex); lo->lo_number = i; lo->lo_thread = NULL; 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 0bed0d4588dd..ff77262e887c 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_part_scan_enabled(bdev->bd_disk)) + if (disk_partitionable(bdev->bd_disk)) bdev->bd_invalidated = 1; } diff --git a/trunk/include/linux/genhd.h b/trunk/include/linux/genhd.h index 6d18f3531f18..02fa4697a0e5 100644 --- a/trunk/include/linux/genhd.h +++ b/trunk/include/linux/genhd.h @@ -128,7 +128,6 @@ 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 */ @@ -235,10 +234,9 @@ static inline int disk_max_parts(struct gendisk *disk) return disk->minors; } -static inline bool disk_part_scan_enabled(struct gendisk *disk) +static inline bool disk_partitionable(struct gendisk *disk) { - return disk_max_parts(disk) > 1 && - !(disk->flags & GENHD_FL_NO_PART_SCAN); + return disk_max_parts(disk) > 1; } static inline dev_t disk_devt(struct gendisk *disk) diff --git a/trunk/include/linux/loop.h b/trunk/include/linux/loop.h index 4367fc507fe9..66c194e2d9b9 100644 --- a/trunk/include/linux/loop.h +++ b/trunk/include/linux/loop.h @@ -76,7 +76,6 @@ enum { LO_FLAGS_READ_ONLY = 1, LO_FLAGS_USE_AOPS = 2, LO_FLAGS_AUTOCLEAR = 4, - LO_FLAGS_PARTSCAN = 8, }; #include /* for __kernel_old_dev_t */ diff --git a/trunk/include/xen/interface/io/blkif.h b/trunk/include/xen/interface/io/blkif.h index 3d5d6db864fe..9324488f23f0 100644 --- a/trunk/include/xen/interface/io/blkif.h +++ b/trunk/include/xen/interface/io/blkif.h @@ -57,6 +57,36 @@ typedef uint64_t blkif_sector_t; * "feature-flush-cache" node! */ #define BLKIF_OP_FLUSH_DISKCACHE 3 + +/* + * Recognised only if "feature-discard" is present in backend xenbus info. + * The "feature-discard" node contains a boolean indicating whether trim + * (ATA) or unmap (SCSI) - conviently called discard requests are likely + * to succeed or fail. Either way, a discard request + * may fail at any time with BLKIF_RSP_EOPNOTSUPP if it is unsupported by + * the underlying block-device hardware. The boolean simply indicates whether + * or not it is worthwhile for the frontend to attempt discard requests. + * If a backend does not recognise BLKIF_OP_DISCARD, it should *not* + * create the "feature-discard" node! + * + * Discard operation is a request for the underlying block device to mark + * extents to be erased. However, discard does not guarantee that the blocks + * will be erased from the device - it is just a hint to the device + * controller that these blocks are no longer in use. What the device + * controller does with that information is left to the controller. + * Discard operations are passed with sector_number as the + * sector index to begin discard operations at and nr_sectors as the number of + * sectors to be discarded. The specified sectors should be discarded if the + * underlying block device supports trim (ATA) or unmap (SCSI) operations, + * or a BLKIF_RSP_EOPNOTSUPP should be returned. + * More information about trim/unmap operations at: + * http://t13.org/Documents/UploadedDocuments/docs2008/ + * e07154r6-Data_Set_Management_Proposal_for_ATA-ACS2.doc + * http://www.seagate.com/staticfiles/support/disc/manuals/ + * Interface%20manuals/100293068c.pdf + */ +#define BLKIF_OP_DISCARD 5 + /* * Maximum scatter/gather segments per request. * This is carefully chosen so that sizeof(struct blkif_ring) <= PAGE_SIZE. @@ -74,6 +104,11 @@ struct blkif_request_rw { } seg[BLKIF_MAX_SEGMENTS_PER_REQUEST]; }; +struct blkif_request_discard { + blkif_sector_t sector_number; + uint64_t nr_sectors; +}; + struct blkif_request { uint8_t operation; /* BLKIF_OP_??? */ uint8_t nr_segments; /* number of segments */ @@ -81,6 +116,7 @@ struct blkif_request { uint64_t id; /* private guest value, echoed in resp */ union { struct blkif_request_rw rw; + struct blkif_request_discard discard; } u; };