Commit a779ed75 authored by Dave Kleikamp's avatar Dave Kleikamp
Browse files

jfs: define xtree root and page independently



In order to make array bounds checking sane, provide a separate
definition of the in-inode xtree root and the external xtree page.

Signed-off-by: default avatarDave Kleikamp <dave.kleikamp@oracle.com>
Tested-by: default avatarManas Ghandat <ghandatmanas@gmail.com>
parent 05d9ea1c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -96,7 +96,7 @@ struct dinode {
#define di_gengen	u._file._u1._imap._gengen

			union {
				xtpage_t _xtroot;
				xtroot_t _xtroot;
				struct {
					u8 unused[16];	/* 16: */
					dxd_t _dxd;	/* 16: */
+3 −3
Original line number Diff line number Diff line
@@ -670,7 +670,7 @@ int diWrite(tid_t tid, struct inode *ip)
		 * This is the special xtree inside the directory for storing
		 * the directory table
		 */
		xtpage_t *p, *xp;
		xtroot_t *p, *xp;
		xad_t *xad;

		jfs_ip->xtlid = 0;
@@ -684,7 +684,7 @@ int diWrite(tid_t tid, struct inode *ip)
		 * copy xtree root from inode to dinode:
		 */
		p = &jfs_ip->i_xtroot;
		xp = (xtpage_t *) &dp->di_dirtable;
		xp = (xtroot_t *) &dp->di_dirtable;
		lv = ilinelock->lv;
		for (n = 0; n < ilinelock->index; n++, lv++) {
			memcpy(&xp->xad[lv->offset], &p->xad[lv->offset],
@@ -713,7 +713,7 @@ int diWrite(tid_t tid, struct inode *ip)
	 *	regular file: 16 byte (XAD slot) granularity
	 */
	if (type & tlckXTREE) {
		xtpage_t *p, *xp;
		xtroot_t *p, *xp;
		xad_t *xad;

		/*
+1 −1
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ struct jfs_inode_info {
	lid_t	xtlid;		/* lid of xtree lock on directory */
	union {
		struct {
			xtpage_t _xtroot;	/* 288: xtree root */
			xtroot_t _xtroot;	/* 288: xtree root */
			struct inomap *_imap;	/* 4: inode map header	*/
		} file;
		struct {
+2 −2
Original line number Diff line number Diff line
@@ -783,7 +783,7 @@ struct tlock *txLock(tid_t tid, struct inode *ip, struct metapage * mp,
			if (mp->xflag & COMMIT_PAGE)
				p = (xtpage_t *) mp->data;
			else
				p = &jfs_ip->i_xtroot;
				p = (xtpage_t *) &jfs_ip->i_xtroot;
			xtlck->lwm.offset =
			    le16_to_cpu(p->header.nextindex);
		}
@@ -1676,7 +1676,7 @@ static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,

	if (tlck->type & tlckBTROOT) {
		lrd->log.redopage.type |= cpu_to_le16(LOG_BTROOT);
		p = &JFS_IP(ip)->i_xtroot;
		p = (xtpage_t *) &JFS_IP(ip)->i_xtroot;
		if (S_ISDIR(ip->i_mode))
			lrd->log.redopage.type |=
			    cpu_to_le16(LOG_DIR_XTREE);
+2 −2
Original line number Diff line number Diff line
@@ -1213,7 +1213,7 @@ xtSplitRoot(tid_t tid,
	struct xtlock *xtlck;
	int rc;

	sp = &JFS_IP(ip)->i_xtroot;
	sp = (xtpage_t *) &JFS_IP(ip)->i_xtroot;

	INCREMENT(xtStat.split);

@@ -2098,7 +2098,7 @@ int xtAppend(tid_t tid, /* transaction id */
 */
void xtInitRoot(tid_t tid, struct inode *ip)
{
	xtpage_t *p;
	xtroot_t *p;

	/*
	 * acquire a transaction lock on the root
Loading