aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/jfs')
-rw-r--r--fs/jfs/jfs_txnmgr.c63
1 files changed, 40 insertions, 23 deletions
diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c
index f40301d93f74..98e16d93e146 100644
--- a/fs/jfs/jfs_txnmgr.c
+++ b/fs/jfs/jfs_txnmgr.c
@@ -1712,7 +1712,7 @@ static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
1712 struct maplock *maplock; 1712 struct maplock *maplock;
1713 struct xdlistlock *xadlock; 1713 struct xdlistlock *xadlock;
1714 struct pxd_lock *pxdlock; 1714 struct pxd_lock *pxdlock;
1715 pxd_t *pxd; 1715 pxd_t *page_pxd;
1716 int next, lwm, hwm; 1716 int next, lwm, hwm;
1717 1717
1718 ip = tlck->ip; 1718 ip = tlck->ip;
@@ -1722,7 +1722,7 @@ static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
1722 lrd->log.redopage.type = cpu_to_le16(LOG_XTREE); 1722 lrd->log.redopage.type = cpu_to_le16(LOG_XTREE);
1723 lrd->log.redopage.l2linesize = cpu_to_le16(L2XTSLOTSIZE); 1723 lrd->log.redopage.l2linesize = cpu_to_le16(L2XTSLOTSIZE);
1724 1724
1725 pxd = &lrd->log.redopage.pxd; 1725 page_pxd = &lrd->log.redopage.pxd;
1726 1726
1727 if (tlck->type & tlckBTROOT) { 1727 if (tlck->type & tlckBTROOT) {
1728 lrd->log.redopage.type |= cpu_to_le16(LOG_BTROOT); 1728 lrd->log.redopage.type |= cpu_to_le16(LOG_BTROOT);
@@ -1752,9 +1752,9 @@ static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
1752 * applying the after-image to the meta-data page. 1752 * applying the after-image to the meta-data page.
1753 */ 1753 */
1754 lrd->type = cpu_to_le16(LOG_REDOPAGE); 1754 lrd->type = cpu_to_le16(LOG_REDOPAGE);
1755// *pxd = mp->cm_pxd; 1755// *page_pxd = mp->cm_pxd;
1756 PXDaddress(pxd, mp->index); 1756 PXDaddress(page_pxd, mp->index);
1757 PXDlength(pxd, 1757 PXDlength(page_pxd,
1758 mp->logical_size >> tblk->sb->s_blocksize_bits); 1758 mp->logical_size >> tblk->sb->s_blocksize_bits);
1759 lrd->backchain = cpu_to_le32(lmLog(log, tblk, lrd, tlck)); 1759 lrd->backchain = cpu_to_le32(lmLog(log, tblk, lrd, tlck));
1760 1760
@@ -1776,25 +1776,31 @@ static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
1776 tlck->flag |= tlckUPDATEMAP; 1776 tlck->flag |= tlckUPDATEMAP;
1777 xadlock->flag = mlckALLOCXADLIST; 1777 xadlock->flag = mlckALLOCXADLIST;
1778 xadlock->count = next - lwm; 1778 xadlock->count = next - lwm;
1779 if ((xadlock->count <= 2) && (tblk->xflag & COMMIT_LAZY)) { 1779 if ((xadlock->count <= 4) && (tblk->xflag & COMMIT_LAZY)) {
1780 int i; 1780 int i;
1781 pxd_t *pxd;
1781 /* 1782 /*
1782 * Lazy commit may allow xtree to be modified before 1783 * Lazy commit may allow xtree to be modified before
1783 * txUpdateMap runs. Copy xad into linelock to 1784 * txUpdateMap runs. Copy xad into linelock to
1784 * preserve correct data. 1785 * preserve correct data.
1786 *
1787 * We can fit twice as may pxd's as xads in the lock
1785 */ 1788 */
1786 xadlock->xdlist = &xtlck->pxdlock; 1789 xadlock->flag = mlckALLOCPXDLIST;
1787 memcpy(xadlock->xdlist, &p->xad[lwm], 1790 pxd = xadlock->xdlist = &xtlck->pxdlock;
1788 sizeof(xad_t) * xadlock->count); 1791 for (i = 0; i < xadlock->count; i++) {
1789 1792 PXDaddress(pxd, addressXAD(&p->xad[lwm + i]));
1790 for (i = 0; i < xadlock->count; i++) 1793 PXDlength(pxd, lengthXAD(&p->xad[lwm + i]));
1791 p->xad[lwm + i].flag &= 1794 p->xad[lwm + i].flag &=
1792 ~(XAD_NEW | XAD_EXTENDED); 1795 ~(XAD_NEW | XAD_EXTENDED);
1796 pxd++;
1797 }
1793 } else { 1798 } else {
1794 /* 1799 /*
1795 * xdlist will point to into inode's xtree, ensure 1800 * xdlist will point to into inode's xtree, ensure
1796 * that transaction is not committed lazily. 1801 * that transaction is not committed lazily.
1797 */ 1802 */
1803 xadlock->flag = mlckALLOCXADLIST;
1798 xadlock->xdlist = &p->xad[lwm]; 1804 xadlock->xdlist = &p->xad[lwm];
1799 tblk->xflag &= ~COMMIT_LAZY; 1805 tblk->xflag &= ~COMMIT_LAZY;
1800 } 1806 }
@@ -1836,8 +1842,8 @@ static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
1836 if (tblk->xflag & COMMIT_TRUNCATE) { 1842 if (tblk->xflag & COMMIT_TRUNCATE) {
1837 /* write NOREDOPAGE for the page */ 1843 /* write NOREDOPAGE for the page */
1838 lrd->type = cpu_to_le16(LOG_NOREDOPAGE); 1844 lrd->type = cpu_to_le16(LOG_NOREDOPAGE);
1839 PXDaddress(pxd, mp->index); 1845 PXDaddress(page_pxd, mp->index);
1840 PXDlength(pxd, 1846 PXDlength(page_pxd,
1841 mp->logical_size >> tblk->sb-> 1847 mp->logical_size >> tblk->sb->
1842 s_blocksize_bits); 1848 s_blocksize_bits);
1843 lrd->backchain = 1849 lrd->backchain =
@@ -1872,22 +1878,32 @@ static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
1872 * deleted page itself; 1878 * deleted page itself;
1873 */ 1879 */
1874 tlck->flag |= tlckUPDATEMAP; 1880 tlck->flag |= tlckUPDATEMAP;
1875 xadlock->flag = mlckFREEXADLIST;
1876 xadlock->count = hwm - XTENTRYSTART + 1; 1881 xadlock->count = hwm - XTENTRYSTART + 1;
1877 if ((xadlock->count <= 2) && (tblk->xflag & COMMIT_LAZY)) { 1882 if ((xadlock->count <= 4) && (tblk->xflag & COMMIT_LAZY)) {
1883 int i;
1884 pxd_t *pxd;
1878 /* 1885 /*
1879 * Lazy commit may allow xtree to be modified before 1886 * Lazy commit may allow xtree to be modified before
1880 * txUpdateMap runs. Copy xad into linelock to 1887 * txUpdateMap runs. Copy xad into linelock to
1881 * preserve correct data. 1888 * preserve correct data.
1889 *
1890 * We can fit twice as may pxd's as xads in the lock
1882 */ 1891 */
1883 xadlock->xdlist = &xtlck->pxdlock; 1892 xadlock->flag = mlckFREEPXDLIST;
1884 memcpy(xadlock->xdlist, &p->xad[XTENTRYSTART], 1893 pxd = xadlock->xdlist = &xtlck->pxdlock;
1885 sizeof(xad_t) * xadlock->count); 1894 for (i = 0; i < xadlock->count; i++) {
1895 PXDaddress(pxd,
1896 addressXAD(&p->xad[XTENTRYSTART + i]));
1897 PXDlength(pxd,
1898 lengthXAD(&p->xad[XTENTRYSTART + i]));
1899 pxd++;
1900 }
1886 } else { 1901 } else {
1887 /* 1902 /*
1888 * xdlist will point to into inode's xtree, ensure 1903 * xdlist will point to into inode's xtree, ensure
1889 * that transaction is not committed lazily. 1904 * that transaction is not committed lazily.
1890 */ 1905 */
1906 xadlock->flag = mlckFREEXADLIST;
1891 xadlock->xdlist = &p->xad[XTENTRYSTART]; 1907 xadlock->xdlist = &p->xad[XTENTRYSTART];
1892 tblk->xflag &= ~COMMIT_LAZY; 1908 tblk->xflag &= ~COMMIT_LAZY;
1893 } 1909 }
@@ -1918,7 +1934,7 @@ static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
1918 * header ? 1934 * header ?
1919 */ 1935 */
1920 if (tlck->type & tlckTRUNCATE) { 1936 if (tlck->type & tlckTRUNCATE) {
1921 pxd_t tpxd; /* truncated extent of xad */ 1937 pxd_t pxd; /* truncated extent of xad */
1922 int twm; 1938 int twm;
1923 1939
1924 /* 1940 /*
@@ -1947,8 +1963,9 @@ static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
1947 * applying the after-image to the meta-data page. 1963 * applying the after-image to the meta-data page.
1948 */ 1964 */
1949 lrd->type = cpu_to_le16(LOG_REDOPAGE); 1965 lrd->type = cpu_to_le16(LOG_REDOPAGE);
1950 PXDaddress(pxd, mp->index); 1966 PXDaddress(page_pxd, mp->index);
1951 PXDlength(pxd, mp->logical_size >> tblk->sb->s_blocksize_bits); 1967 PXDlength(page_pxd,
1968 mp->logical_size >> tblk->sb->s_blocksize_bits);
1952 lrd->backchain = cpu_to_le32(lmLog(log, tblk, lrd, tlck)); 1969 lrd->backchain = cpu_to_le32(lmLog(log, tblk, lrd, tlck));
1953 1970
1954 /* 1971 /*
@@ -1966,7 +1983,7 @@ static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
1966 lrd->log.updatemap.type = cpu_to_le16(LOG_FREEPXD); 1983 lrd->log.updatemap.type = cpu_to_le16(LOG_FREEPXD);
1967 lrd->log.updatemap.nxd = cpu_to_le16(1); 1984 lrd->log.updatemap.nxd = cpu_to_le16(1);
1968 lrd->log.updatemap.pxd = pxdlock->pxd; 1985 lrd->log.updatemap.pxd = pxdlock->pxd;
1969 tpxd = pxdlock->pxd; /* save to format maplock */ 1986 pxd = pxdlock->pxd; /* save to format maplock */
1970 lrd->backchain = 1987 lrd->backchain =
1971 cpu_to_le32(lmLog(log, tblk, lrd, NULL)); 1988 cpu_to_le32(lmLog(log, tblk, lrd, NULL));
1972 } 1989 }
@@ -2035,7 +2052,7 @@ static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
2035 pxdlock = (struct pxd_lock *) xadlock; 2052 pxdlock = (struct pxd_lock *) xadlock;
2036 pxdlock->flag = mlckFREEPXD; 2053 pxdlock->flag = mlckFREEPXD;
2037 pxdlock->count = 1; 2054 pxdlock->count = 1;
2038 pxdlock->pxd = tpxd; 2055 pxdlock->pxd = pxd;
2039 2056
2040 jfs_info("xtLog: truncate ip:0x%p mp:0x%p count:%d " 2057 jfs_info("xtLog: truncate ip:0x%p mp:0x%p count:%d "
2041 "hwm:%d", ip, mp, pxdlock->count, hwm); 2058 "hwm:%d", ip, mp, pxdlock->count, hwm);