JFS: [3 of 6] implement get_index_page to replace some uses of read_index_page
Dave Kleikamp <[email protected]> Wed, 26 Feb 2003 11:28:28 -0600
| Newsgroups | gmane.comp.file-systems.jfs.patches |
|---|---|
| Message-ID | <[email protected]> |
# This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.953.1.2 -> 1.953.1.3 # fs/jfs/jfs_dtree.c 1.9 -> 1.10 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/01/29 [email protected] 1.953.1.3 # JFS: implement get_index_page to replace some uses of read_index_page # # A recent change added the function read_index_page to replace calls to # read_metapage() when accessing the directory index table. However, we # replaced both calls to read_metapage() and get_metapage() with the same # function, but we really need two. In addition to unnecesary disk reads, # this problem caused an oops in __get_metapage(). # -------------------------------------------- # diff -Nru a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c --- a/fs/jfs/jfs_dtree.c Wed Feb 26 11:11:00 2003 +++ b/fs/jfs/jfs_dtree.c Wed Feb 26 11:11:00 2003 @@ -222,6 +222,25 @@ } /* + * get_index_page() + * + * Same as get_index_page(), but get's a new page without reading + */ +static struct metapage *get_index_page(struct inode *inode, s64 blkno) +{ + int rc; + s64 xaddr; + int xflag; + s32 xlen; + + rc = xtLookup(inode, blkno, 1, &xflag, &xaddr, &xlen, 1); + if (rc || (xlen == 0)) + return NULL; + + return get_metapage(inode, xaddr, PSIZE, 1); +} + +/* * find_index() * * Returns dtree page containing directory table entry for specified @@ -390,7 +409,7 @@ ip->i_size = PSIZE; ip->i_blocks += LBLK2PBLK(sb, sbi->nbperpage); - if ((mp = read_index_page(ip, 0)) == 0) { + if ((mp = get_index_page(ip, 0)) == 0) { jfs_err("add_index: get_metapage failed!"); xtTruncate(tid, ip, 0, COMMIT_PWMAP); return -1; @@ -433,7 +452,7 @@ ip->i_size += PSIZE; ip->i_blocks += LBLK2PBLK(sb, sbi->nbperpage); - if ((mp = read_index_page(ip, blkno))) + if ((mp = get_index_page(ip, blkno))) memset(mp->data, 0, PSIZE); /* Just looks better */ else xtTruncate(tid, ip, offset, COMMIT_PWMAP);