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 git://oss.sgi.com:8090/xfs/linux-2.6

* git://oss.sgi.com:8090/xfs/linux-2.6:
[XFS] Remove xfs_iext_irec_compact_full()
[XFS] Fix extent list corruption in xfs_iext_irec_compact_full().

+3 -91
+3 -91
fs/xfs/xfs_inode.c
··· 4118 4118 ASSERT(nextents <= XFS_LINEAR_EXTS); 4119 4119 size = nextents * sizeof(xfs_bmbt_rec_t); 4120 4120 4121 - xfs_iext_irec_compact_full(ifp); 4121 + xfs_iext_irec_compact_pages(ifp); 4122 4122 ASSERT(ifp->if_real_bytes == XFS_IEXT_BUFSZ); 4123 4123 4124 4124 ep = ifp->if_u1.if_ext_irec->er_extbuf; ··· 4449 4449 * compaction policy is as follows: 4450 4450 * 4451 4451 * Full Compaction: Extents fit into a single page (or inline buffer) 4452 - * Full Compaction: Extents occupy less than 10% of allocated space 4453 - * Partial Compaction: Extents occupy > 10% and < 50% of allocated space 4452 + * Partial Compaction: Extents occupy less than 50% of allocated space 4454 4453 * No Compaction: Extents occupy at least 50% of allocated space 4455 4454 */ 4456 4455 void ··· 4470 4471 xfs_iext_direct_to_inline(ifp, nextents); 4471 4472 } else if (nextents <= XFS_LINEAR_EXTS) { 4472 4473 xfs_iext_indirect_to_direct(ifp); 4473 - } else if (nextents < (nlists * XFS_LINEAR_EXTS) >> 3) { 4474 - xfs_iext_irec_compact_full(ifp); 4475 4474 } else if (nextents < (nlists * XFS_LINEAR_EXTS) >> 1) { 4476 4475 xfs_iext_irec_compact_pages(ifp); 4477 4476 } ··· 4493 4496 erp_next = erp + 1; 4494 4497 if (erp_next->er_extcount <= 4495 4498 (XFS_LINEAR_EXTS - erp->er_extcount)) { 4496 - memmove(&erp->er_extbuf[erp->er_extcount], 4499 + memcpy(&erp->er_extbuf[erp->er_extcount], 4497 4500 erp_next->er_extbuf, erp_next->er_extcount * 4498 4501 sizeof(xfs_bmbt_rec_t)); 4499 4502 erp->er_extcount += erp_next->er_extcount; ··· 4509 4512 } else { 4510 4513 erp_idx++; 4511 4514 } 4512 - } 4513 - } 4514 - 4515 - /* 4516 - * Fully compact the extent records managed by the indirection array. 4517 - */ 4518 - void 4519 - xfs_iext_irec_compact_full( 4520 - xfs_ifork_t *ifp) /* inode fork pointer */ 4521 - { 4522 - xfs_bmbt_rec_host_t *ep, *ep_next; /* extent record pointers */ 4523 - xfs_ext_irec_t *erp, *erp_next; /* extent irec pointers */ 4524 - int erp_idx = 0; /* extent irec index */ 4525 - int ext_avail; /* empty entries in ex list */ 4526 - int ext_diff; /* number of exts to add */ 4527 - int nlists; /* number of irec's (ex lists) */ 4528 - 4529 - ASSERT(ifp->if_flags & XFS_IFEXTIREC); 4530 - 4531 - nlists = ifp->if_real_bytes / XFS_IEXT_BUFSZ; 4532 - erp = ifp->if_u1.if_ext_irec; 4533 - ep = &erp->er_extbuf[erp->er_extcount]; 4534 - erp_next = erp + 1; 4535 - ep_next = erp_next->er_extbuf; 4536 - 4537 - while (erp_idx < nlists - 1) { 4538 - /* 4539 - * Check how many extent records are available in this irec. 4540 - * If there is none skip the whole exercise. 4541 - */ 4542 - ext_avail = XFS_LINEAR_EXTS - erp->er_extcount; 4543 - if (ext_avail) { 4544 - 4545 - /* 4546 - * Copy over as many as possible extent records into 4547 - * the previous page. 4548 - */ 4549 - ext_diff = MIN(ext_avail, erp_next->er_extcount); 4550 - memcpy(ep, ep_next, ext_diff * sizeof(xfs_bmbt_rec_t)); 4551 - erp->er_extcount += ext_diff; 4552 - erp_next->er_extcount -= ext_diff; 4553 - 4554 - /* 4555 - * If the next irec is empty now we can simply 4556 - * remove it. 4557 - */ 4558 - if (erp_next->er_extcount == 0) { 4559 - /* 4560 - * Free page before removing extent record 4561 - * so er_extoffs don't get modified in 4562 - * xfs_iext_irec_remove. 4563 - */ 4564 - kmem_free(erp_next->er_extbuf); 4565 - erp_next->er_extbuf = NULL; 4566 - xfs_iext_irec_remove(ifp, erp_idx + 1); 4567 - erp = &ifp->if_u1.if_ext_irec[erp_idx]; 4568 - nlists = ifp->if_real_bytes / XFS_IEXT_BUFSZ; 4569 - 4570 - /* 4571 - * If the next irec is not empty move up the content 4572 - * that has not been copied to the previous page to 4573 - * the beggining of this one. 4574 - */ 4575 - } else { 4576 - memmove(erp_next->er_extbuf, &ep_next[ext_diff], 4577 - erp_next->er_extcount * 4578 - sizeof(xfs_bmbt_rec_t)); 4579 - ep_next = erp_next->er_extbuf; 4580 - memset(&ep_next[erp_next->er_extcount], 0, 4581 - (XFS_LINEAR_EXTS - 4582 - erp_next->er_extcount) * 4583 - sizeof(xfs_bmbt_rec_t)); 4584 - } 4585 - } 4586 - 4587 - if (erp->er_extcount == XFS_LINEAR_EXTS) { 4588 - erp_idx++; 4589 - if (erp_idx < nlists) 4590 - erp = &ifp->if_u1.if_ext_irec[erp_idx]; 4591 - else 4592 - break; 4593 - } 4594 - ep = &erp->er_extbuf[erp->er_extcount]; 4595 - erp_next = erp + 1; 4596 - ep_next = erp_next->er_extbuf; 4597 4515 } 4598 4516 } 4599 4517