Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block

* 'for-linus' of git://git.kernel.dk/linux-2.6-block: (34 commits)
cfq-iosched: Fix the incorrect timeslice accounting with forced_dispatch
loop: Update mtime when writing using aops
block: expose the statistics in blkio.time and blkio.sectors for the root cgroup
backing-dev: Handle class_create() failure
Block: Fix block/elevator.c elevator_get() off-by-one error
drbd: lc_element_by_index() never returns NULL
cciss: unlock on error path
cfq-iosched: Do not merge queues of BE and IDLE classes
cfq-iosched: Add additional blktrace log messages in CFQ for easier debugging
i2o: Remove the dangerous kobj_to_i2o_device macro
block: remove 16 bytes of padding from struct request on 64bits
cfq-iosched: fix a kbuild regression
block: make CONFIG_BLK_CGROUP visible
Remove GENHD_FL_DRIVERFS
block: Export max number of segments and max segment size in sysfs
block: Finalize conversion of block limits functions
block: Fix overrun in lcm() and move it to lib
vfs: improve writeback_inodes_wb()
paride: fix off-by-one test
drbd: fix al-to-on-disk-bitmap for 4k logical_block_size
...

+476 -179
+13
Documentation/DocBook/tracepoint.tmpl
··· 16 16 </address> 17 17 </affiliation> 18 18 </author> 19 + <author> 20 + <firstname>William</firstname> 21 + <surname>Cohen</surname> 22 + <affiliation> 23 + <address> 24 + <email>wcohen@redhat.com</email> 25 + </address> 26 + </affiliation> 27 + </author> 19 28 </authorgroup> 20 29 21 30 <legalnotice> ··· 100 91 !Iinclude/trace/events/signal.h 101 92 </chapter> 102 93 94 + <chapter id="block"> 95 + <title>Block IO</title> 96 + !Iinclude/trace/events/block.h 97 + </chapter> 103 98 </book>
+2 -2
Documentation/block/biodoc.txt
··· 1162 1162 1163 1163 As mentioned, there is no virtual mapping of a bio. For DMA, this is 1164 1164 not a problem as the driver probably never will need a virtual mapping. 1165 - Instead it needs a bus mapping (pci_map_page for a single segment or 1166 - use blk_rq_map_sg for scatter gather) to be able to ship it to the driver. For 1165 + Instead it needs a bus mapping (dma_map_page for a single segment or 1166 + use dma_map_sg for scatter gather) to be able to ship it to the driver. For 1167 1167 PIO drivers (or drivers that need to revert to PIO transfer once in a 1168 1168 while (IDE for example)), where the CPU is doing the actual data 1169 1169 transfer a virtual mapping is needed. If the driver supports highmem I/O,
+2 -1
block/Kconfig
··· 78 78 Protection. If in doubt, say N. 79 79 80 80 config BLK_CGROUP 81 - tristate 81 + tristate "Block cgroup support" 82 82 depends on CGROUPS 83 + depends on CFQ_GROUP_IOSCHED 83 84 default n 84 85 ---help--- 85 86 Generic block IO controller cgroup interface. This is the common
+1 -10
block/blk-settings.c
··· 8 8 #include <linux/blkdev.h> 9 9 #include <linux/bootmem.h> /* for max_pfn/max_low_pfn */ 10 10 #include <linux/gcd.h> 11 + #include <linux/lcm.h> 11 12 #include <linux/jiffies.h> 12 13 #include <linux/gfp.h> 13 14 ··· 462 461 } 463 462 } 464 463 EXPORT_SYMBOL(blk_queue_stack_limits); 465 - 466 - static unsigned int lcm(unsigned int a, unsigned int b) 467 - { 468 - if (a && b) 469 - return (a * b) / gcd(a, b); 470 - else if (b) 471 - return b; 472 - 473 - return a; 474 - } 475 464 476 465 /** 477 466 * blk_stack_limits - adjust queue_limits for stacked devices
+25
block/blk-sysfs.c
··· 107 107 return queue_var_show(max_sectors_kb, (page)); 108 108 } 109 109 110 + static ssize_t queue_max_segments_show(struct request_queue *q, char *page) 111 + { 112 + return queue_var_show(queue_max_segments(q), (page)); 113 + } 114 + 115 + static ssize_t queue_max_segment_size_show(struct request_queue *q, char *page) 116 + { 117 + if (test_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags)) 118 + return queue_var_show(queue_max_segment_size(q), (page)); 119 + 120 + return queue_var_show(PAGE_CACHE_SIZE, (page)); 121 + } 122 + 110 123 static ssize_t queue_logical_block_size_show(struct request_queue *q, char *page) 111 124 { 112 125 return queue_var_show(queue_logical_block_size(q), page); ··· 294 281 .show = queue_max_hw_sectors_show, 295 282 }; 296 283 284 + static struct queue_sysfs_entry queue_max_segments_entry = { 285 + .attr = {.name = "max_segments", .mode = S_IRUGO }, 286 + .show = queue_max_segments_show, 287 + }; 288 + 289 + static struct queue_sysfs_entry queue_max_segment_size_entry = { 290 + .attr = {.name = "max_segment_size", .mode = S_IRUGO }, 291 + .show = queue_max_segment_size_show, 292 + }; 293 + 297 294 static struct queue_sysfs_entry queue_iosched_entry = { 298 295 .attr = {.name = "scheduler", .mode = S_IRUGO | S_IWUSR }, 299 296 .show = elv_iosched_show, ··· 379 356 &queue_ra_entry.attr, 380 357 &queue_max_hw_sectors_entry.attr, 381 358 &queue_max_sectors_entry.attr, 359 + &queue_max_segments_entry.attr, 360 + &queue_max_segment_size_entry.attr, 382 361 &queue_iosched_entry.attr, 383 362 &queue_hw_sector_size_entry.attr, 384 363 &queue_logical_block_size_entry.attr,
+32 -11
block/cfq-iosched.c
··· 48 48 #define CFQ_SERVICE_SHIFT 12 49 49 50 50 #define CFQQ_SEEK_THR (sector_t)(8 * 100) 51 + #define CFQQ_CLOSE_THR (sector_t)(8 * 1024) 51 52 #define CFQQ_SECT_THR_NONROT (sector_t)(2 * 32) 52 53 #define CFQQ_SEEKY(cfqq) (hweight32(cfqq->seek_history) > 32/8) 53 54 ··· 949 948 unsigned int major, minor; 950 949 951 950 cfqg = cfqg_of_blkg(blkiocg_lookup_group(blkcg, key)); 951 + if (cfqg && !cfqg->blkg.dev && bdi->dev && dev_name(bdi->dev)) { 952 + sscanf(dev_name(bdi->dev), "%u:%u", &major, &minor); 953 + cfqg->blkg.dev = MKDEV(major, minor); 954 + goto done; 955 + } 952 956 if (cfqg || !create) 953 957 goto done; 954 958 ··· 1524 1518 struct cfq_queue *cfqq) 1525 1519 { 1526 1520 if (cfqq) { 1527 - cfq_log_cfqq(cfqd, cfqq, "set_active"); 1521 + cfq_log_cfqq(cfqd, cfqq, "set_active wl_prio:%d wl_type:%d", 1522 + cfqd->serving_prio, cfqd->serving_type); 1528 1523 cfqq->slice_start = 0; 1529 1524 cfqq->dispatch_start = jiffies; 1530 1525 cfqq->allocated_slice = 0; ··· 1668 1661 } 1669 1662 1670 1663 static inline int cfq_rq_close(struct cfq_data *cfqd, struct cfq_queue *cfqq, 1671 - struct request *rq, bool for_preempt) 1664 + struct request *rq) 1672 1665 { 1673 - return cfq_dist_from_last(cfqd, rq) <= CFQQ_SEEK_THR; 1666 + return cfq_dist_from_last(cfqd, rq) <= CFQQ_CLOSE_THR; 1674 1667 } 1675 1668 1676 1669 static struct cfq_queue *cfqq_close(struct cfq_data *cfqd, ··· 1697 1690 * will contain the closest sector. 1698 1691 */ 1699 1692 __cfqq = rb_entry(parent, struct cfq_queue, p_node); 1700 - if (cfq_rq_close(cfqd, cur_cfqq, __cfqq->next_rq, false)) 1693 + if (cfq_rq_close(cfqd, cur_cfqq, __cfqq->next_rq)) 1701 1694 return __cfqq; 1702 1695 1703 1696 if (blk_rq_pos(__cfqq->next_rq) < sector) ··· 1708 1701 return NULL; 1709 1702 1710 1703 __cfqq = rb_entry(node, struct cfq_queue, p_node); 1711 - if (cfq_rq_close(cfqd, cur_cfqq, __cfqq->next_rq, false)) 1704 + if (cfq_rq_close(cfqd, cur_cfqq, __cfqq->next_rq)) 1712 1705 return __cfqq; 1713 1706 1714 1707 return NULL; ··· 1729 1722 { 1730 1723 struct cfq_queue *cfqq; 1731 1724 1725 + if (cfq_class_idle(cur_cfqq)) 1726 + return NULL; 1732 1727 if (!cfq_cfqq_sync(cur_cfqq)) 1733 1728 return NULL; 1734 1729 if (CFQQ_SEEKY(cur_cfqq)) ··· 1797 1788 * Otherwise, we do only if they are the last ones 1798 1789 * in their service tree. 1799 1790 */ 1800 - return service_tree->count == 1 && cfq_cfqq_sync(cfqq); 1791 + if (service_tree->count == 1 && cfq_cfqq_sync(cfqq)) 1792 + return 1; 1793 + cfq_log_cfqq(cfqd, cfqq, "Not idling. st->count:%d", 1794 + service_tree->count); 1795 + return 0; 1801 1796 } 1802 1797 1803 1798 static void cfq_arm_slice_timer(struct cfq_data *cfqd) ··· 1846 1833 * time slice. 1847 1834 */ 1848 1835 if (sample_valid(cic->ttime_samples) && 1849 - (cfqq->slice_end - jiffies < cic->ttime_mean)) 1836 + (cfqq->slice_end - jiffies < cic->ttime_mean)) { 1837 + cfq_log_cfqq(cfqd, cfqq, "Not idling. think_time:%d", 1838 + cic->ttime_mean); 1850 1839 return; 1840 + } 1851 1841 1852 1842 cfq_mark_cfqq_wait_request(cfqq); 1853 1843 ··· 2058 2042 slice = max(slice, 2 * cfqd->cfq_slice_idle); 2059 2043 2060 2044 slice = max_t(unsigned, slice, CFQ_MIN_TT); 2045 + cfq_log(cfqd, "workload slice:%d", slice); 2061 2046 cfqd->workload_expires = jiffies + slice; 2062 2047 cfqd->noidle_tree_requires_idle = false; 2063 2048 } ··· 2206 2189 struct cfq_queue *cfqq; 2207 2190 int dispatched = 0; 2208 2191 2209 - while ((cfqq = cfq_get_next_queue_forced(cfqd)) != NULL) 2210 - dispatched += __cfq_forced_dispatch_cfqq(cfqq); 2211 - 2192 + /* Expire the timeslice of the current active queue first */ 2212 2193 cfq_slice_expired(cfqd, 0); 2194 + while ((cfqq = cfq_get_next_queue_forced(cfqd)) != NULL) { 2195 + __cfq_set_active_queue(cfqd, cfqq); 2196 + dispatched += __cfq_forced_dispatch_cfqq(cfqq); 2197 + } 2198 + 2213 2199 BUG_ON(cfqd->busy_queues); 2214 2200 2215 2201 cfq_log(cfqd, "forced_dispatch=%d", dispatched); ··· 3124 3104 * if this request is as-good as one we would expect from the 3125 3105 * current cfqq, let it preempt 3126 3106 */ 3127 - if (cfq_rq_close(cfqd, cfqq, rq, true)) 3107 + if (cfq_rq_close(cfqd, cfqq, rq)) 3128 3108 return true; 3129 3109 3130 3110 return false; ··· 3328 3308 if (cfq_should_wait_busy(cfqd, cfqq)) { 3329 3309 cfqq->slice_end = jiffies + cfqd->cfq_slice_idle; 3330 3310 cfq_mark_cfqq_wait_busy(cfqq); 3311 + cfq_log_cfqq(cfqd, cfqq, "will busy wait"); 3331 3312 } 3332 3313 3333 3314 /*
+1 -1
block/elevator.c
··· 154 154 155 155 spin_unlock(&elv_list_lock); 156 156 157 - sprintf(elv, "%s-iosched", name); 157 + snprintf(elv, sizeof(elv), "%s-iosched", name); 158 158 159 159 request_module("%s", elv); 160 160 spin_lock(&elv_list_lock);
-1
drivers/block/DAC960.c
··· 2533 2533 Controller->RequestQueue[n] = RequestQueue; 2534 2534 blk_queue_bounce_limit(RequestQueue, Controller->BounceBufferLimit); 2535 2535 RequestQueue->queuedata = Controller; 2536 - blk_queue_max_hw_segments(RequestQueue, Controller->DriverScatterGatherLimit); 2537 2536 blk_queue_max_segments(RequestQueue, Controller->DriverScatterGatherLimit); 2538 2537 blk_queue_max_hw_sectors(RequestQueue, Controller->MaxBlocksPerCommand); 2539 2538 disk->queue = RequestQueue;
+14 -5
drivers/block/drbd/drbd_actlog.c
··· 536 536 put_ldev(mdev); 537 537 } 538 538 539 + /* sector to word */ 539 540 #define S2W(s) ((s)<<(BM_EXT_SHIFT-BM_BLOCK_SHIFT-LN2_BPL)) 541 + 540 542 /* activity log to on disk bitmap -- prepare bio unless that sector 541 543 * is already covered by previously prepared bios */ 542 544 static int atodb_prepare_unless_covered(struct drbd_conf *mdev, ··· 548 546 { 549 547 struct bio *bio; 550 548 struct page *page; 551 - sector_t on_disk_sector = enr + mdev->ldev->md.md_offset 552 - + mdev->ldev->md.bm_offset; 549 + sector_t on_disk_sector; 553 550 unsigned int page_offset = PAGE_SIZE; 554 551 int offset; 555 552 int i = 0; 556 553 int err = -ENOMEM; 554 + 555 + /* We always write aligned, full 4k blocks, 556 + * so we can ignore the logical_block_size (for now) */ 557 + enr &= ~7U; 558 + on_disk_sector = enr + mdev->ldev->md.md_offset 559 + + mdev->ldev->md.bm_offset; 560 + 561 + D_ASSERT(!(on_disk_sector & 7U)); 557 562 558 563 /* Check if that enr is already covered by an already created bio. 559 564 * Caution, bios[] is not NULL terminated, ··· 597 588 598 589 offset = S2W(enr); 599 590 drbd_bm_get_lel(mdev, offset, 600 - min_t(size_t, S2W(1), drbd_bm_words(mdev) - offset), 591 + min_t(size_t, S2W(8), drbd_bm_words(mdev) - offset), 601 592 kmap(page) + page_offset); 602 593 kunmap(page); 603 594 ··· 606 597 bio->bi_bdev = mdev->ldev->md_bdev; 607 598 bio->bi_sector = on_disk_sector; 608 599 609 - if (bio_add_page(bio, page, MD_SECTOR_SIZE, page_offset) != MD_SECTOR_SIZE) 600 + if (bio_add_page(bio, page, 4096, page_offset) != 4096) 610 601 goto out_put_page; 611 602 612 603 atomic_inc(&wc->count); ··· 1336 1327 /* ok, ->resync is there. */ 1337 1328 for (i = 0; i < mdev->resync->nr_elements; i++) { 1338 1329 e = lc_element_by_index(mdev->resync, i); 1339 - bm_ext = e ? lc_entry(e, struct bm_extent, lce) : NULL; 1330 + bm_ext = lc_entry(e, struct bm_extent, lce); 1340 1331 if (bm_ext->lce.lc_number == LC_FREE) 1341 1332 continue; 1342 1333 if (bm_ext->lce.lc_number == mdev->resync_wenr) {
+5 -5
drivers/block/drbd/drbd_bitmap.c
··· 67 67 size_t bm_words; 68 68 size_t bm_number_of_pages; 69 69 sector_t bm_dev_capacity; 70 - struct semaphore bm_change; /* serializes resize operations */ 70 + struct mutex bm_change; /* serializes resize operations */ 71 71 72 72 atomic_t bm_async_io; 73 73 wait_queue_head_t bm_io_wait; ··· 115 115 return; 116 116 } 117 117 118 - trylock_failed = down_trylock(&b->bm_change); 118 + trylock_failed = !mutex_trylock(&b->bm_change); 119 119 120 120 if (trylock_failed) { 121 121 dev_warn(DEV, "%s going to '%s' but bitmap already locked for '%s' by %s\n", ··· 126 126 b->bm_task == mdev->receiver.task ? "receiver" : 127 127 b->bm_task == mdev->asender.task ? "asender" : 128 128 b->bm_task == mdev->worker.task ? "worker" : "?"); 129 - down(&b->bm_change); 129 + mutex_lock(&b->bm_change); 130 130 } 131 131 if (__test_and_set_bit(BM_LOCKED, &b->bm_flags)) 132 132 dev_err(DEV, "FIXME bitmap already locked in bm_lock\n"); ··· 148 148 149 149 b->bm_why = NULL; 150 150 b->bm_task = NULL; 151 - up(&b->bm_change); 151 + mutex_unlock(&b->bm_change); 152 152 } 153 153 154 154 /* word offset to long pointer */ ··· 296 296 if (!b) 297 297 return -ENOMEM; 298 298 spin_lock_init(&b->bm_lock); 299 - init_MUTEX(&b->bm_change); 299 + mutex_init(&b->bm_change); 300 300 init_waitqueue_head(&b->bm_io_wait); 301 301 302 302 mdev->bitmap = b;
+11 -1
drivers/block/drbd/drbd_int.h
··· 261 261 [P_OV_REQUEST] = "OVRequest", 262 262 [P_OV_REPLY] = "OVReply", 263 263 [P_OV_RESULT] = "OVResult", 264 + [P_CSUM_RS_REQUEST] = "CsumRSRequest", 265 + [P_RS_IS_IN_SYNC] = "CsumRSIsInSync", 266 + [P_COMPRESSED_BITMAP] = "CBitmap", 264 267 [P_MAX_CMD] = NULL, 265 268 }; 266 269 ··· 446 443 char csums_alg[SHARED_SECRET_MAX]; 447 444 } __packed; 448 445 446 + enum drbd_conn_flags { 447 + CF_WANT_LOSE = 1, 448 + CF_DRY_RUN = 2, 449 + }; 450 + 449 451 struct p_protocol { 450 452 struct p_header head; 451 453 u32 protocol; 452 454 u32 after_sb_0p; 453 455 u32 after_sb_1p; 454 456 u32 after_sb_2p; 455 - u32 want_lose; 457 + u32 conn_flags; 456 458 u32 two_primaries; 457 459 458 460 /* Since protocol version 87 and higher. */ ··· 799 791 * while this is set. */ 800 792 RESIZE_PENDING, /* Size change detected locally, waiting for the response from 801 793 * the peer, if it changed there as well. */ 794 + CONN_DRY_RUN, /* Expect disconnect after resync handshake. */ 795 + GOT_PING_ACK, /* set when we receive a ping_ack packet, misc wait gets woken */ 802 796 }; 803 797 804 798 struct drbd_bitmap; /* opaque for drbd_conf */
+18 -2
drivers/block/drbd/drbd_main.c
··· 1668 1668 int drbd_send_protocol(struct drbd_conf *mdev) 1669 1669 { 1670 1670 struct p_protocol *p; 1671 - int size, rv; 1671 + int size, cf, rv; 1672 1672 1673 1673 size = sizeof(struct p_protocol); 1674 1674 ··· 1685 1685 p->after_sb_0p = cpu_to_be32(mdev->net_conf->after_sb_0p); 1686 1686 p->after_sb_1p = cpu_to_be32(mdev->net_conf->after_sb_1p); 1687 1687 p->after_sb_2p = cpu_to_be32(mdev->net_conf->after_sb_2p); 1688 - p->want_lose = cpu_to_be32(mdev->net_conf->want_lose); 1689 1688 p->two_primaries = cpu_to_be32(mdev->net_conf->two_primaries); 1689 + 1690 + cf = 0; 1691 + if (mdev->net_conf->want_lose) 1692 + cf |= CF_WANT_LOSE; 1693 + if (mdev->net_conf->dry_run) { 1694 + if (mdev->agreed_pro_version >= 92) 1695 + cf |= CF_DRY_RUN; 1696 + else { 1697 + dev_err(DEV, "--dry-run is not supported by peer"); 1698 + return 0; 1699 + } 1700 + } 1701 + p->conn_flags = cpu_to_be32(cf); 1690 1702 1691 1703 if (mdev->agreed_pro_version >= 87) 1692 1704 strcpy(p->integrity_alg, mdev->net_conf->integrity_alg); ··· 3173 3161 void drbd_free_sock(struct drbd_conf *mdev) 3174 3162 { 3175 3163 if (mdev->data.socket) { 3164 + mutex_lock(&mdev->data.mutex); 3176 3165 kernel_sock_shutdown(mdev->data.socket, SHUT_RDWR); 3177 3166 sock_release(mdev->data.socket); 3178 3167 mdev->data.socket = NULL; 3168 + mutex_unlock(&mdev->data.mutex); 3179 3169 } 3180 3170 if (mdev->meta.socket) { 3171 + mutex_lock(&mdev->meta.mutex); 3181 3172 kernel_sock_shutdown(mdev->meta.socket, SHUT_RDWR); 3182 3173 sock_release(mdev->meta.socket); 3183 3174 mdev->meta.socket = NULL; 3175 + mutex_unlock(&mdev->meta.mutex); 3184 3176 } 3185 3177 } 3186 3178
+22 -22
drivers/block/drbd/drbd_nl.c
··· 285 285 } 286 286 287 287 if (r == SS_NO_UP_TO_DATE_DISK && force && 288 - (mdev->state.disk == D_INCONSISTENT || 289 - mdev->state.disk == D_OUTDATED)) { 288 + (mdev->state.disk < D_UP_TO_DATE && 289 + mdev->state.disk >= D_INCONSISTENT)) { 290 290 mask.disk = D_MASK; 291 291 val.disk = D_UP_TO_DATE; 292 292 forced = 1; ··· 407 407 } 408 408 409 409 reply->ret_code = 410 - drbd_set_role(mdev, R_PRIMARY, primary_args.overwrite_peer); 410 + drbd_set_role(mdev, R_PRIMARY, primary_args.primary_force); 411 411 412 412 return 0; 413 413 } ··· 941 941 942 942 drbd_md_set_sector_offsets(mdev, nbc); 943 943 944 + /* allocate a second IO page if logical_block_size != 512 */ 945 + logical_block_size = bdev_logical_block_size(nbc->md_bdev); 946 + if (logical_block_size == 0) 947 + logical_block_size = MD_SECTOR_SIZE; 948 + 949 + if (logical_block_size != MD_SECTOR_SIZE) { 950 + if (!mdev->md_io_tmpp) { 951 + struct page *page = alloc_page(GFP_NOIO); 952 + if (!page) 953 + goto force_diskless_dec; 954 + 955 + dev_warn(DEV, "Meta data's bdev logical_block_size = %d != %d\n", 956 + logical_block_size, MD_SECTOR_SIZE); 957 + dev_warn(DEV, "Workaround engaged (has performance impact).\n"); 958 + 959 + mdev->md_io_tmpp = page; 960 + } 961 + } 962 + 944 963 if (!mdev->bitmap) { 945 964 if (drbd_bm_init(mdev)) { 946 965 retcode = ERR_NOMEM; ··· 997 978 if (!drbd_al_read_log(mdev, nbc)) { 998 979 retcode = ERR_IO_MD_DISK; 999 980 goto force_diskless_dec; 1000 - } 1001 - 1002 - /* allocate a second IO page if logical_block_size != 512 */ 1003 - logical_block_size = bdev_logical_block_size(nbc->md_bdev); 1004 - if (logical_block_size == 0) 1005 - logical_block_size = MD_SECTOR_SIZE; 1006 - 1007 - if (logical_block_size != MD_SECTOR_SIZE) { 1008 - if (!mdev->md_io_tmpp) { 1009 - struct page *page = alloc_page(GFP_NOIO); 1010 - if (!page) 1011 - goto force_diskless_dec; 1012 - 1013 - dev_warn(DEV, "Meta data's bdev logical_block_size = %d != %d\n", 1014 - logical_block_size, MD_SECTOR_SIZE); 1015 - dev_warn(DEV, "Workaround engaged (has performance impact).\n"); 1016 - 1017 - mdev->md_io_tmpp = page; 1018 - } 1019 981 } 1020 982 1021 983 /* Reset the "barriers don't work" bits here, then force meta data to
+28 -6
drivers/block/drbd/drbd_receiver.c
··· 2513 2513 } 2514 2514 2515 2515 if (hg == -100) { 2516 + /* FIXME this log message is not correct if we end up here 2517 + * after an attempted attach on a diskless node. 2518 + * We just refuse to attach -- well, we drop the "connection" 2519 + * to that disk, in a way... */ 2516 2520 dev_alert(DEV, "Split-Brain detected, dropping connection!\n"); 2517 2521 drbd_khelper(mdev, "split-brain"); 2518 2522 return C_MASK; ··· 2540 2536 dev_warn(DEV, "Becoming SyncTarget, violating the stable-data" 2541 2537 "assumption\n"); 2542 2538 } 2539 + } 2540 + 2541 + if (mdev->net_conf->dry_run || test_bit(CONN_DRY_RUN, &mdev->flags)) { 2542 + if (hg == 0) 2543 + dev_info(DEV, "dry-run connect: No resync, would become Connected immediately.\n"); 2544 + else 2545 + dev_info(DEV, "dry-run connect: Would become %s, doing a %s resync.", 2546 + drbd_conn_str(hg > 0 ? C_SYNC_SOURCE : C_SYNC_TARGET), 2547 + abs(hg) >= 2 ? "full" : "bit-map based"); 2548 + return C_MASK; 2543 2549 } 2544 2550 2545 2551 if (abs(hg) >= 2) { ··· 2599 2585 struct p_protocol *p = (struct p_protocol *)h; 2600 2586 int header_size, data_size; 2601 2587 int p_proto, p_after_sb_0p, p_after_sb_1p, p_after_sb_2p; 2602 - int p_want_lose, p_two_primaries; 2588 + int p_want_lose, p_two_primaries, cf; 2603 2589 char p_integrity_alg[SHARED_SECRET_MAX] = ""; 2604 2590 2605 2591 header_size = sizeof(*p) - sizeof(*h); ··· 2612 2598 p_after_sb_0p = be32_to_cpu(p->after_sb_0p); 2613 2599 p_after_sb_1p = be32_to_cpu(p->after_sb_1p); 2614 2600 p_after_sb_2p = be32_to_cpu(p->after_sb_2p); 2615 - p_want_lose = be32_to_cpu(p->want_lose); 2616 2601 p_two_primaries = be32_to_cpu(p->two_primaries); 2602 + cf = be32_to_cpu(p->conn_flags); 2603 + p_want_lose = cf & CF_WANT_LOSE; 2604 + 2605 + clear_bit(CONN_DRY_RUN, &mdev->flags); 2606 + 2607 + if (cf & CF_DRY_RUN) 2608 + set_bit(CONN_DRY_RUN, &mdev->flags); 2617 2609 2618 2610 if (p_proto != mdev->net_conf->wire_protocol) { 2619 2611 dev_err(DEV, "incompatible communication protocols\n"); ··· 3138 3118 3139 3119 put_ldev(mdev); 3140 3120 if (nconn == C_MASK) { 3121 + nconn = C_CONNECTED; 3141 3122 if (mdev->state.disk == D_NEGOTIATING) { 3142 3123 drbd_force_state(mdev, NS(disk, D_DISKLESS)); 3143 - nconn = C_CONNECTED; 3144 3124 } else if (peer_state.disk == D_NEGOTIATING) { 3145 3125 dev_err(DEV, "Disk attach process on the peer node was aborted.\n"); 3146 3126 peer_state.disk = D_DISKLESS; 3127 + real_peer_disk = D_DISKLESS; 3147 3128 } else { 3129 + if (test_and_clear_bit(CONN_DRY_RUN, &mdev->flags)) 3130 + return FALSE; 3148 3131 D_ASSERT(oconn == C_WF_REPORT_PARAMS); 3149 3132 drbd_force_state(mdev, NS(conn, C_DISCONNECTING)); 3150 3133 return FALSE; ··· 3617 3594 3618 3595 /* asender does not clean up anything. it must not interfere, either */ 3619 3596 drbd_thread_stop(&mdev->asender); 3620 - 3621 - mutex_lock(&mdev->data.mutex); 3622 3597 drbd_free_sock(mdev); 3623 - mutex_unlock(&mdev->data.mutex); 3624 3598 3625 3599 spin_lock_irq(&mdev->req_lock); 3626 3600 _drbd_wait_ee_list_empty(mdev, &mdev->active_ee); ··· 4074 4054 { 4075 4055 /* restore idle timeout */ 4076 4056 mdev->meta.socket->sk->sk_rcvtimeo = mdev->net_conf->ping_int*HZ; 4057 + if (!test_and_set_bit(GOT_PING_ACK, &mdev->flags)) 4058 + wake_up(&mdev->misc_wait); 4077 4059 4078 4060 return TRUE; 4079 4061 }
+12 -6
drivers/block/drbd/drbd_worker.c
··· 938 938 939 939 if (eq) { 940 940 drbd_set_in_sync(mdev, e->sector, e->size); 941 - mdev->rs_same_csum++; 941 + /* rs_same_csums unit is BM_BLOCK_SIZE */ 942 + mdev->rs_same_csum += e->size >> BM_BLOCK_SHIFT; 942 943 ok = drbd_send_ack(mdev, P_RS_IS_IN_SYNC, e); 943 944 } else { 944 945 inc_rs_pending(mdev); ··· 1289 1288 return retcode; 1290 1289 } 1291 1290 1291 + static void ping_peer(struct drbd_conf *mdev) 1292 + { 1293 + clear_bit(GOT_PING_ACK, &mdev->flags); 1294 + request_ping(mdev); 1295 + wait_event(mdev->misc_wait, 1296 + test_bit(GOT_PING_ACK, &mdev->flags) || mdev->state.conn < C_CONNECTED); 1297 + } 1298 + 1292 1299 /** 1293 1300 * drbd_start_resync() - Start the resync process 1294 1301 * @mdev: DRBD device. ··· 1380 1371 _drbd_pause_after(mdev); 1381 1372 } 1382 1373 write_unlock_irq(&global_state_lock); 1383 - drbd_state_unlock(mdev); 1384 1374 put_ldev(mdev); 1385 1375 1386 1376 if (r == SS_SUCCESS) { ··· 1390 1382 1391 1383 if (mdev->rs_total == 0) { 1392 1384 /* Peer still reachable? Beware of failing before-resync-target handlers! */ 1393 - request_ping(mdev); 1394 - __set_current_state(TASK_INTERRUPTIBLE); 1395 - schedule_timeout(mdev->net_conf->ping_timeo*HZ/9); /* 9 instead 10 */ 1385 + ping_peer(mdev); 1396 1386 drbd_resync_finished(mdev); 1397 - return; 1398 1387 } 1399 1388 1400 1389 /* ns.conn may already be != mdev->state.conn, ··· 1403 1398 1404 1399 drbd_md_sync(mdev); 1405 1400 } 1401 + drbd_state_unlock(mdev); 1406 1402 } 1407 1403 1408 1404 int drbd_worker(struct drbd_thread *thi)
+2
drivers/block/loop.c
··· 237 237 if (ret) 238 238 goto fail; 239 239 240 + file_update_time(file); 241 + 240 242 transfer_result = lo_do_transfer(lo, WRITE, page, offset, 241 243 bvec->bv_page, bv_offs, size, IV); 242 244 copied = size;
+2 -2
drivers/block/paride/pcd.c
··· 341 341 && (j++ < PCD_SPIN)) 342 342 udelay(PCD_DELAY); 343 343 344 - if ((r & (IDE_ERR & stop)) || (j >= PCD_SPIN)) { 344 + if ((r & (IDE_ERR & stop)) || (j > PCD_SPIN)) { 345 345 s = read_reg(cd, 7); 346 346 e = read_reg(cd, 1); 347 347 p = read_reg(cd, 2); 348 - if (j >= PCD_SPIN) 348 + if (j > PCD_SPIN) 349 349 e |= 0x100; 350 350 if (fun) 351 351 printk("%s: %s %s: alt=0x%x stat=0x%x err=0x%x"
+2 -2
drivers/block/paride/pf.c
··· 391 391 && (j++ < PF_SPIN)) 392 392 udelay(PF_SPIN_DEL); 393 393 394 - if ((r & (STAT_ERR & stop)) || (j >= PF_SPIN)) { 394 + if ((r & (STAT_ERR & stop)) || (j > PF_SPIN)) { 395 395 s = read_reg(pf, 7); 396 396 e = read_reg(pf, 1); 397 397 p = read_reg(pf, 2); 398 - if (j >= PF_SPIN) 398 + if (j > PF_SPIN) 399 399 e |= 0x100; 400 400 if (fun) 401 401 printk("%s: %s %s: alt=0x%x stat=0x%x err=0x%x"
+2 -2
drivers/block/paride/pt.c
··· 274 274 && (j++ < PT_SPIN)) 275 275 udelay(PT_SPIN_DEL); 276 276 277 - if ((r & (STAT_ERR & stop)) || (j >= PT_SPIN)) { 277 + if ((r & (STAT_ERR & stop)) || (j > PT_SPIN)) { 278 278 s = read_reg(pi, 7); 279 279 e = read_reg(pi, 1); 280 280 p = read_reg(pi, 2); 281 - if (j >= PT_SPIN) 281 + if (j > PT_SPIN) 282 282 e |= 0x100; 283 283 if (fun) 284 284 printk("%s: %s %s: alt=0x%x stat=0x%x err=0x%x"
+2 -3
drivers/block/virtio_blk.c
··· 348 348 set_capacity(vblk->disk, cap); 349 349 350 350 /* We can handle whatever the host told us to handle. */ 351 - blk_queue_max_phys_segments(q, vblk->sg_elems-2); 352 - blk_queue_max_hw_segments(q, vblk->sg_elems-2); 351 + blk_queue_max_segments(q, vblk->sg_elems-2); 353 352 354 353 /* No need to bounce any requests */ 355 354 blk_queue_bounce_limit(q, BLK_BOUNCE_ANY); 356 355 357 356 /* No real sector limit. */ 358 - blk_queue_max_sectors(q, -1U); 357 + blk_queue_max_hw_sectors(q, -1U); 359 358 360 359 /* Host can optionally specify maximum segment size and number of 361 360 * segments. */
+1 -1
drivers/scsi/sd.c
··· 2186 2186 blk_queue_prep_rq(sdp->request_queue, sd_prep_fn); 2187 2187 2188 2188 gd->driverfs_dev = &sdp->sdev_gendev; 2189 - gd->flags = GENHD_FL_EXT_DEVT | GENHD_FL_DRIVERFS; 2189 + gd->flags = GENHD_FL_EXT_DEVT; 2190 2190 if (sdp->removable) 2191 2191 gd->flags |= GENHD_FL_REMOVABLE; 2192 2192
+2 -2
fs/bio.c
··· 554 554 .bi_rw = bio->bi_rw, 555 555 }; 556 556 557 - if (q->merge_bvec_fn(q, &bvm, prev) < len) { 557 + if (q->merge_bvec_fn(q, &bvm, prev) < prev->bv_len) { 558 558 prev->bv_len -= len; 559 559 return 0; 560 560 } ··· 607 607 * merge_bvec_fn() returns number of bytes it can accept 608 608 * at this offset 609 609 */ 610 - if (q->merge_bvec_fn(q, &bvm, bvec) < len) { 610 + if (q->merge_bvec_fn(q, &bvm, bvec) < bvec->bv_len) { 611 611 bvec->bv_page = NULL; 612 612 bvec->bv_len = 0; 613 613 bvec->bv_offset = 0;
+73 -60
fs/fs-writeback.c
··· 554 554 return ret; 555 555 } 556 556 557 - static void unpin_sb_for_writeback(struct super_block **psb) 557 + static void unpin_sb_for_writeback(struct super_block *sb) 558 558 { 559 - struct super_block *sb = *psb; 560 - 561 - if (sb) { 562 - up_read(&sb->s_umount); 563 - put_super(sb); 564 - *psb = NULL; 565 - } 559 + up_read(&sb->s_umount); 560 + put_super(sb); 566 561 } 562 + 563 + enum sb_pin_state { 564 + SB_PINNED, 565 + SB_NOT_PINNED, 566 + SB_PIN_FAILED 567 + }; 567 568 568 569 /* 569 570 * For WB_SYNC_NONE writeback, the caller does not have the sb pinned 570 571 * before calling writeback. So make sure that we do pin it, so it doesn't 571 572 * go away while we are writing inodes from it. 572 - * 573 - * Returns 0 if the super was successfully pinned (or pinning wasn't needed), 574 - * 1 if we failed. 575 573 */ 576 - static int pin_sb_for_writeback(struct writeback_control *wbc, 577 - struct inode *inode, struct super_block **psb) 574 + static enum sb_pin_state pin_sb_for_writeback(struct writeback_control *wbc, 575 + struct super_block *sb) 578 576 { 579 - struct super_block *sb = inode->i_sb; 580 - 581 - /* 582 - * If this sb is already pinned, nothing more to do. If not and 583 - * *psb is non-NULL, unpin the old one first 584 - */ 585 - if (sb == *psb) 586 - return 0; 587 - else if (*psb) 588 - unpin_sb_for_writeback(psb); 589 - 590 577 /* 591 578 * Caller must already hold the ref for this 592 579 */ 593 580 if (wbc->sync_mode == WB_SYNC_ALL) { 594 581 WARN_ON(!rwsem_is_locked(&sb->s_umount)); 595 - return 0; 582 + return SB_NOT_PINNED; 596 583 } 597 - 598 584 spin_lock(&sb_lock); 599 585 sb->s_count++; 600 586 if (down_read_trylock(&sb->s_umount)) { 601 587 if (sb->s_root) { 602 588 spin_unlock(&sb_lock); 603 - goto pinned; 589 + return SB_PINNED; 604 590 } 605 591 /* 606 592 * umounted, drop rwsem again and fall through to failure 607 593 */ 608 594 up_read(&sb->s_umount); 609 595 } 610 - 611 596 sb->s_count--; 612 597 spin_unlock(&sb_lock); 613 - return 1; 614 - pinned: 615 - *psb = sb; 616 - return 0; 598 + return SB_PIN_FAILED; 617 599 } 618 600 619 - static void writeback_inodes_wb(struct bdi_writeback *wb, 620 - struct writeback_control *wbc) 601 + /* 602 + * Write a portion of b_io inodes which belong to @sb. 603 + * If @wbc->sb != NULL, then find and write all such 604 + * inodes. Otherwise write only ones which go sequentially 605 + * in reverse order. 606 + * Return 1, if the caller writeback routine should be 607 + * interrupted. Otherwise return 0. 608 + */ 609 + static int writeback_sb_inodes(struct super_block *sb, 610 + struct bdi_writeback *wb, 611 + struct writeback_control *wbc) 621 612 { 622 - struct super_block *sb = wbc->sb, *pin_sb = NULL; 623 - const unsigned long start = jiffies; /* livelock avoidance */ 624 - 625 - spin_lock(&inode_lock); 626 - 627 - if (!wbc->for_kupdate || list_empty(&wb->b_io)) 628 - queue_io(wb, wbc->older_than_this); 629 - 630 613 while (!list_empty(&wb->b_io)) { 631 - struct inode *inode = list_entry(wb->b_io.prev, 632 - struct inode, i_list); 633 614 long pages_skipped; 634 - 635 - /* 636 - * super block given and doesn't match, skip this inode 637 - */ 638 - if (sb && sb != inode->i_sb) { 615 + struct inode *inode = list_entry(wb->b_io.prev, 616 + struct inode, i_list); 617 + if (wbc->sb && sb != inode->i_sb) { 618 + /* super block given and doesn't 619 + match, skip this inode */ 639 620 redirty_tail(inode); 640 621 continue; 641 622 } 642 - 623 + if (sb != inode->i_sb) 624 + /* finish with this superblock */ 625 + return 0; 643 626 if (inode->i_state & (I_NEW | I_WILL_FREE)) { 644 627 requeue_io(inode); 645 628 continue; 646 629 } 647 - 648 630 /* 649 631 * Was this inode dirtied after sync_sb_inodes was called? 650 632 * This keeps sync from extra jobs and livelock. 651 633 */ 652 - if (inode_dirtied_after(inode, start)) 653 - break; 654 - 655 - if (pin_sb_for_writeback(wbc, inode, &pin_sb)) { 656 - requeue_io(inode); 657 - continue; 658 - } 634 + if (inode_dirtied_after(inode, wbc->wb_start)) 635 + return 1; 659 636 660 637 BUG_ON(inode->i_state & (I_FREEING | I_CLEAR)); 661 638 __iget(inode); ··· 651 674 spin_lock(&inode_lock); 652 675 if (wbc->nr_to_write <= 0) { 653 676 wbc->more_io = 1; 654 - break; 677 + return 1; 655 678 } 656 679 if (!list_empty(&wb->b_more_io)) 657 680 wbc->more_io = 1; 658 681 } 682 + /* b_io is empty */ 683 + return 1; 684 + } 659 685 660 - unpin_sb_for_writeback(&pin_sb); 686 + static void writeback_inodes_wb(struct bdi_writeback *wb, 687 + struct writeback_control *wbc) 688 + { 689 + int ret = 0; 661 690 691 + wbc->wb_start = jiffies; /* livelock avoidance */ 692 + spin_lock(&inode_lock); 693 + if (!wbc->for_kupdate || list_empty(&wb->b_io)) 694 + queue_io(wb, wbc->older_than_this); 695 + 696 + while (!list_empty(&wb->b_io)) { 697 + struct inode *inode = list_entry(wb->b_io.prev, 698 + struct inode, i_list); 699 + struct super_block *sb = inode->i_sb; 700 + enum sb_pin_state state; 701 + 702 + if (wbc->sb && sb != wbc->sb) { 703 + /* super block given and doesn't 704 + match, skip this inode */ 705 + redirty_tail(inode); 706 + continue; 707 + } 708 + state = pin_sb_for_writeback(wbc, sb); 709 + 710 + if (state == SB_PIN_FAILED) { 711 + requeue_io(inode); 712 + continue; 713 + } 714 + ret = writeback_sb_inodes(sb, wb, wbc); 715 + 716 + if (state == SB_PINNED) 717 + unpin_sb_for_writeback(sb); 718 + if (ret) 719 + break; 720 + } 662 721 spin_unlock(&inode_lock); 663 722 /* Leave any unwritten inodes on b_io */ 664 723 }
+6 -29
include/linux/blkdev.h
··· 158 158 struct request { 159 159 struct list_head queuelist; 160 160 struct call_single_data csd; 161 - int cpu; 162 161 163 162 struct request_queue *q; 164 163 ··· 165 166 enum rq_cmd_type_bits cmd_type; 166 167 unsigned long atomic_flags; 167 168 169 + int cpu; 170 + 168 171 /* the following two fields are internal, NEVER access directly */ 169 - sector_t __sector; /* sector cursor */ 170 172 unsigned int __data_len; /* total data len */ 173 + sector_t __sector; /* sector cursor */ 171 174 172 175 struct bio *bio; 173 176 struct bio *biotail; ··· 202 201 203 202 unsigned short ioprio; 204 203 204 + int ref_count; 205 + 205 206 void *special; /* opaque pointer available for LLD use */ 206 207 char *buffer; /* kaddr of the current segment if available */ 207 208 208 209 int tag; 209 210 int errors; 210 211 211 - int ref_count; 212 - 213 212 /* 214 213 * when request is used as a packet command carrier 215 214 */ 216 - unsigned short cmd_len; 217 215 unsigned char __cmd[BLK_MAX_CDB]; 218 216 unsigned char *cmd; 217 + unsigned short cmd_len; 219 218 220 219 unsigned int extra_len; /* length of alignment and padding */ 221 220 unsigned int sense_len; ··· 922 921 extern void blk_queue_make_request(struct request_queue *, make_request_fn *); 923 922 extern void blk_queue_bounce_limit(struct request_queue *, u64); 924 923 extern void blk_queue_max_hw_sectors(struct request_queue *, unsigned int); 925 - 926 - /* Temporary compatibility wrapper */ 927 - static inline void blk_queue_max_sectors(struct request_queue *q, unsigned int max) 928 - { 929 - blk_queue_max_hw_sectors(q, max); 930 - } 931 - 932 924 extern void blk_queue_max_segments(struct request_queue *, unsigned short); 933 - 934 - static inline void blk_queue_max_phys_segments(struct request_queue *q, unsigned short max) 935 - { 936 - blk_queue_max_segments(q, max); 937 - } 938 - 939 - static inline void blk_queue_max_hw_segments(struct request_queue *q, unsigned short max) 940 - { 941 - blk_queue_max_segments(q, max); 942 - } 943 - 944 - 945 925 extern void blk_queue_max_segment_size(struct request_queue *, unsigned int); 946 926 extern void blk_queue_max_discard_sectors(struct request_queue *q, 947 927 unsigned int max_discard_sectors); ··· 1011 1029 } 1012 1030 1013 1031 extern int blk_verify_command(unsigned char *cmd, fmode_t has_write_perm); 1014 - 1015 - #define MAX_PHYS_SEGMENTS 128 1016 - #define MAX_HW_SEGMENTS 128 1017 - #define SAFE_MAX_SECTORS 255 1018 - #define MAX_SEGMENT_SIZE 65536 1019 1032 1020 1033 enum blk_default_limits { 1021 1034 BLK_MAX_SEGMENTS = 128,
+1 -1
include/linux/drbd.h
··· 56 56 #define REL_VERSION "8.3.7" 57 57 #define API_VERSION 88 58 58 #define PRO_VERSION_MIN 86 59 - #define PRO_VERSION_MAX 91 59 + #define PRO_VERSION_MAX 92 60 60 61 61 62 62 enum drbd_io_error_p {
+2 -1
include/linux/drbd_nl.h
··· 12 12 #endif 13 13 14 14 NL_PACKET(primary, 1, 15 - NL_BIT( 1, T_MAY_IGNORE, overwrite_peer) 15 + NL_BIT( 1, T_MAY_IGNORE, primary_force) 16 16 ) 17 17 18 18 NL_PACKET(secondary, 2, ) ··· 63 63 NL_BIT( 41, T_MAY_IGNORE, always_asbp) 64 64 NL_BIT( 61, T_MAY_IGNORE, no_cork) 65 65 NL_BIT( 62, T_MANDATORY, auto_sndbuf_size) 66 + NL_BIT( 70, T_MANDATORY, dry_run) 66 67 ) 67 68 68 69 NL_PACKET(disconnect, 6, )
+1 -1
include/linux/genhd.h
··· 109 109 }; 110 110 111 111 #define GENHD_FL_REMOVABLE 1 112 - #define GENHD_FL_DRIVERFS 2 112 + /* 2 is unused */ 113 113 #define GENHD_FL_MEDIA_CHANGE_NOTIFY 4 114 114 #define GENHD_FL_CD 8 115 115 #define GENHD_FL_UP 16
-1
include/linux/i2o.h
··· 782 782 #define to_i2o_driver(drv) container_of(drv,struct i2o_driver, driver) 783 783 #define to_i2o_device(dev) container_of(dev, struct i2o_device, device) 784 784 #define to_i2o_controller(dev) container_of(dev, struct i2o_controller, device) 785 - #define kobj_to_i2o_device(kobj) to_i2o_device(container_of(kobj, struct device, kobj)) 786 785 787 786 /** 788 787 * i2o_out_to_virt - Turn an I2O message to a virtual address
+8
include/linux/lcm.h
··· 1 + #ifndef _LCM_H 2 + #define _LCM_H 3 + 4 + #include <linux/compiler.h> 5 + 6 + unsigned long lcm(unsigned long a, unsigned long b) __attribute_const__; 7 + 8 + #endif /* _LCM_H */
+3
include/linux/writeback.h
··· 34 34 enum writeback_sync_modes sync_mode; 35 35 unsigned long *older_than_this; /* If !NULL, only write back inodes 36 36 older than this */ 37 + unsigned long wb_start; /* Time writeback_inodes_wb was 38 + called. This is needed to avoid 39 + extra jobs and livelock */ 37 40 long nr_to_write; /* Write this many pages, and decrement 38 41 this for each page written */ 39 42 long pages_skipped; /* Pages which were not written */
+164
include/trace/events/block.h
··· 40 40 __entry->nr_sector, __entry->errors) 41 41 ); 42 42 43 + /** 44 + * block_rq_abort - abort block operation request 45 + * @q: queue containing the block operation request 46 + * @rq: block IO operation request 47 + * 48 + * Called immediately after pending block IO operation request @rq in 49 + * queue @q is aborted. The fields in the operation request @rq 50 + * can be examined to determine which device and sectors the pending 51 + * operation would access. 52 + */ 43 53 DEFINE_EVENT(block_rq_with_error, block_rq_abort, 44 54 45 55 TP_PROTO(struct request_queue *q, struct request *rq), ··· 57 47 TP_ARGS(q, rq) 58 48 ); 59 49 50 + /** 51 + * block_rq_requeue - place block IO request back on a queue 52 + * @q: queue holding operation 53 + * @rq: block IO operation request 54 + * 55 + * The block operation request @rq is being placed back into queue 56 + * @q. For some reason the request was not completed and needs to be 57 + * put back in the queue. 58 + */ 60 59 DEFINE_EVENT(block_rq_with_error, block_rq_requeue, 61 60 62 61 TP_PROTO(struct request_queue *q, struct request *rq), ··· 73 54 TP_ARGS(q, rq) 74 55 ); 75 56 57 + /** 58 + * block_rq_complete - block IO operation completed by device driver 59 + * @q: queue containing the block operation request 60 + * @rq: block operations request 61 + * 62 + * The block_rq_complete tracepoint event indicates that some portion 63 + * of operation request has been completed by the device driver. If 64 + * the @rq->bio is %NULL, then there is absolutely no additional work to 65 + * do for the request. If @rq->bio is non-NULL then there is 66 + * additional work required to complete the request. 67 + */ 76 68 DEFINE_EVENT(block_rq_with_error, block_rq_complete, 77 69 78 70 TP_PROTO(struct request_queue *q, struct request *rq), ··· 125 95 __entry->nr_sector, __entry->comm) 126 96 ); 127 97 98 + /** 99 + * block_rq_insert - insert block operation request into queue 100 + * @q: target queue 101 + * @rq: block IO operation request 102 + * 103 + * Called immediately before block operation request @rq is inserted 104 + * into queue @q. The fields in the operation request @rq struct can 105 + * be examined to determine which device and sectors the pending 106 + * operation would access. 107 + */ 128 108 DEFINE_EVENT(block_rq, block_rq_insert, 129 109 130 110 TP_PROTO(struct request_queue *q, struct request *rq), ··· 142 102 TP_ARGS(q, rq) 143 103 ); 144 104 105 + /** 106 + * block_rq_issue - issue pending block IO request operation to device driver 107 + * @q: queue holding operation 108 + * @rq: block IO operation operation request 109 + * 110 + * Called when block operation request @rq from queue @q is sent to a 111 + * device driver for processing. 112 + */ 145 113 DEFINE_EVENT(block_rq, block_rq_issue, 146 114 147 115 TP_PROTO(struct request_queue *q, struct request *rq), ··· 157 109 TP_ARGS(q, rq) 158 110 ); 159 111 112 + /** 113 + * block_bio_bounce - used bounce buffer when processing block operation 114 + * @q: queue holding the block operation 115 + * @bio: block operation 116 + * 117 + * A bounce buffer was used to handle the block operation @bio in @q. 118 + * This occurs when hardware limitations prevent a direct transfer of 119 + * data between the @bio data memory area and the IO device. Use of a 120 + * bounce buffer requires extra copying of data and decreases 121 + * performance. 122 + */ 160 123 TRACE_EVENT(block_bio_bounce, 161 124 162 125 TP_PROTO(struct request_queue *q, struct bio *bio), ··· 197 138 __entry->nr_sector, __entry->comm) 198 139 ); 199 140 141 + /** 142 + * block_bio_complete - completed all work on the block operation 143 + * @q: queue holding the block operation 144 + * @bio: block operation completed 145 + * 146 + * This tracepoint indicates there is no further work to do on this 147 + * block IO operation @bio. 148 + */ 200 149 TRACE_EVENT(block_bio_complete, 201 150 202 151 TP_PROTO(struct request_queue *q, struct bio *bio), ··· 260 193 __entry->nr_sector, __entry->comm) 261 194 ); 262 195 196 + /** 197 + * block_bio_backmerge - merging block operation to the end of an existing operation 198 + * @q: queue holding operation 199 + * @bio: new block operation to merge 200 + * 201 + * Merging block request @bio to the end of an existing block request 202 + * in queue @q. 203 + */ 263 204 DEFINE_EVENT(block_bio, block_bio_backmerge, 264 205 265 206 TP_PROTO(struct request_queue *q, struct bio *bio), ··· 275 200 TP_ARGS(q, bio) 276 201 ); 277 202 203 + /** 204 + * block_bio_frontmerge - merging block operation to the beginning of an existing operation 205 + * @q: queue holding operation 206 + * @bio: new block operation to merge 207 + * 208 + * Merging block IO operation @bio to the beginning of an existing block 209 + * operation in queue @q. 210 + */ 278 211 DEFINE_EVENT(block_bio, block_bio_frontmerge, 279 212 280 213 TP_PROTO(struct request_queue *q, struct bio *bio), ··· 290 207 TP_ARGS(q, bio) 291 208 ); 292 209 210 + /** 211 + * block_bio_queue - putting new block IO operation in queue 212 + * @q: queue holding operation 213 + * @bio: new block operation 214 + * 215 + * About to place the block IO operation @bio into queue @q. 216 + */ 293 217 DEFINE_EVENT(block_bio, block_bio_queue, 294 218 295 219 TP_PROTO(struct request_queue *q, struct bio *bio), ··· 333 243 __entry->nr_sector, __entry->comm) 334 244 ); 335 245 246 + /** 247 + * block_getrq - get a free request entry in queue for block IO operations 248 + * @q: queue for operations 249 + * @bio: pending block IO operation 250 + * @rw: low bit indicates a read (%0) or a write (%1) 251 + * 252 + * A request struct for queue @q has been allocated to handle the 253 + * block IO operation @bio. 254 + */ 336 255 DEFINE_EVENT(block_get_rq, block_getrq, 337 256 338 257 TP_PROTO(struct request_queue *q, struct bio *bio, int rw), ··· 349 250 TP_ARGS(q, bio, rw) 350 251 ); 351 252 253 + /** 254 + * block_sleeprq - waiting to get a free request entry in queue for block IO operation 255 + * @q: queue for operation 256 + * @bio: pending block IO operation 257 + * @rw: low bit indicates a read (%0) or a write (%1) 258 + * 259 + * In the case where a request struct cannot be provided for queue @q 260 + * the process needs to wait for an request struct to become 261 + * available. This tracepoint event is generated each time the 262 + * process goes to sleep waiting for request struct become available. 263 + */ 352 264 DEFINE_EVENT(block_get_rq, block_sleeprq, 353 265 354 266 TP_PROTO(struct request_queue *q, struct bio *bio, int rw), ··· 367 257 TP_ARGS(q, bio, rw) 368 258 ); 369 259 260 + /** 261 + * block_plug - keep operations requests in request queue 262 + * @q: request queue to plug 263 + * 264 + * Plug the request queue @q. Do not allow block operation requests 265 + * to be sent to the device driver. Instead, accumulate requests in 266 + * the queue to improve throughput performance of the block device. 267 + */ 370 268 TRACE_EVENT(block_plug, 371 269 372 270 TP_PROTO(struct request_queue *q), ··· 411 293 TP_printk("[%s] %d", __entry->comm, __entry->nr_rq) 412 294 ); 413 295 296 + /** 297 + * block_unplug_timer - timed release of operations requests in queue to device driver 298 + * @q: request queue to unplug 299 + * 300 + * Unplug the request queue @q because a timer expired and allow block 301 + * operation requests to be sent to the device driver. 302 + */ 414 303 DEFINE_EVENT(block_unplug, block_unplug_timer, 415 304 416 305 TP_PROTO(struct request_queue *q), ··· 425 300 TP_ARGS(q) 426 301 ); 427 302 303 + /** 304 + * block_unplug_io - release of operations requests in request queue 305 + * @q: request queue to unplug 306 + * 307 + * Unplug request queue @q because device driver is scheduled to work 308 + * on elements in the request queue. 309 + */ 428 310 DEFINE_EVENT(block_unplug, block_unplug_io, 429 311 430 312 TP_PROTO(struct request_queue *q), ··· 439 307 TP_ARGS(q) 440 308 ); 441 309 310 + /** 311 + * block_split - split a single bio struct into two bio structs 312 + * @q: queue containing the bio 313 + * @bio: block operation being split 314 + * @new_sector: The starting sector for the new bio 315 + * 316 + * The bio request @bio in request queue @q needs to be split into two 317 + * bio requests. The newly created @bio request starts at 318 + * @new_sector. This split may be required due to hardware limitation 319 + * such as operation crossing device boundaries in a RAID system. 320 + */ 442 321 TRACE_EVENT(block_split, 443 322 444 323 TP_PROTO(struct request_queue *q, struct bio *bio, ··· 480 337 __entry->comm) 481 338 ); 482 339 340 + /** 341 + * block_remap - map request for a partition to the raw device 342 + * @q: queue holding the operation 343 + * @bio: revised operation 344 + * @dev: device for the operation 345 + * @from: original sector for the operation 346 + * 347 + * An operation for a partition on a block device has been mapped to the 348 + * raw block device. 349 + */ 483 350 TRACE_EVENT(block_remap, 484 351 485 352 TP_PROTO(struct request_queue *q, struct bio *bio, dev_t dev, ··· 523 370 (unsigned long long)__entry->old_sector) 524 371 ); 525 372 373 + /** 374 + * block_rq_remap - map request for a block operation request 375 + * @q: queue holding the operation 376 + * @rq: block IO operation request 377 + * @dev: device for the operation 378 + * @from: original sector for the operation 379 + * 380 + * The block operation request @rq in @q has been remapped. The block 381 + * operation request @rq holds the current information and @from hold 382 + * the original sector. 383 + */ 526 384 TRACE_EVENT(block_rq_remap, 527 385 528 386 TP_PROTO(struct request_queue *q, struct request *rq, dev_t dev,
+1 -1
lib/Makefile
··· 21 21 22 22 obj-y += bcd.o div64.o sort.o parser.o halfmd4.o debug_locks.o random32.o \ 23 23 bust_spinlocks.o hexdump.o kasprintf.o bitmap.o scatterlist.o \ 24 - string_helpers.o gcd.o list_sort.o 24 + string_helpers.o gcd.o lcm.o list_sort.o 25 25 26 26 ifeq ($(CONFIG_DEBUG_KOBJECT),y) 27 27 CFLAGS_kobject.o += -DDEBUG
+15
lib/lcm.c
··· 1 + #include <linux/kernel.h> 2 + #include <linux/gcd.h> 3 + #include <linux/module.h> 4 + 5 + /* Lowest common multiple */ 6 + unsigned long lcm(unsigned long a, unsigned long b) 7 + { 8 + if (a && b) 9 + return (a * b) / gcd(a, b); 10 + else if (b) 11 + return b; 12 + 13 + return a; 14 + } 15 + EXPORT_SYMBOL_GPL(lcm);
+3
mm/backing-dev.c
··· 227 227 static __init int bdi_class_init(void) 228 228 { 229 229 bdi_class = class_create(THIS_MODULE, "bdi"); 230 + if (IS_ERR(bdi_class)) 231 + return PTR_ERR(bdi_class); 232 + 230 233 bdi_class->dev_attrs = bdi_dev_attrs; 231 234 bdi_debug_init(); 232 235 return 0;