Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 137614
b: refs/heads/master
c: fec1878
h: refs/heads/master
v: v3
  • Loading branch information
Dave Kleikamp committed Jan 9, 2009
1 parent aae15a6 commit edd0bc0
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 333 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: da9c138e9e1cc08aa3a4e8c09411a5d08f866445
refs/heads/master: fec1878fe952b994125a3be7c94b1322db586f3b
63 changes: 24 additions & 39 deletions trunk/fs/jfs/jfs_extent.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,12 @@ int extRealloc(struct inode *ip, s64 nxlen, xad_t * xp, bool abnr)
int extHint(struct inode *ip, s64 offset, xad_t * xp)
{
struct super_block *sb = ip->i_sb;
struct xadlist xadl;
struct lxdlist lxdl;
lxd_t lxd;
int nbperpage = JFS_SBI(sb)->nbperpage;
s64 prev;
int rc, nbperpage = JFS_SBI(sb)->nbperpage;
int rc = 0;
s64 xaddr;
int xlen;
int xflag;

/* init the hint as "no hint provided" */
XADaddress(xp, 0);
Expand All @@ -376,46 +377,30 @@ int extHint(struct inode *ip, s64 offset, xad_t * xp)
*/
prev = ((offset & ~POFFSET) >> JFS_SBI(sb)->l2bsize) - nbperpage;

/* if the offsets in the first page of the file,
* no hint provided.
/* if the offset is in the first page of the file, no hint provided.
*/
if (prev < 0)
return (0);

/* prepare to lookup the previous page's extent info */
lxdl.maxnlxd = 1;
lxdl.nlxd = 1;
lxdl.lxd = &lxd;
LXDoffset(&lxd, prev)
LXDlength(&lxd, nbperpage);

xadl.maxnxad = 1;
xadl.nxad = 0;
xadl.xad = xp;

/* perform the lookup */
if ((rc = xtLookupList(ip, &lxdl, &xadl, 0)))
return (rc);

/* check if no extent exists for the previous page.
* this is possible for sparse files.
*/
if (xadl.nxad == 0) {
// assert(ISSPARSE(ip));
return (0);
}
goto out;

/* only preserve the abnr flag within the xad flags
* of the returned hint.
*/
xp->flag &= XAD_NOTRECORDED;
rc = xtLookup(ip, prev, nbperpage, &xflag, &xaddr, &xlen, 0);

if(xadl.nxad != 1 || lengthXAD(xp) != nbperpage) {
jfs_error(ip->i_sb, "extHint: corrupt xtree");
return -EIO;
}
if ((rc == 0) && xlen) {
if (xlen != nbperpage) {
jfs_error(ip->i_sb, "extHint: corrupt xtree");
rc = -EIO;
}
XADaddress(xp, xaddr);
XADlength(xp, xlen);
/*
* only preserve the abnr flag within the xad flags
* of the returned hint.
*/
xp->flag = xflag & XAD_NOTRECORDED;
} else
rc = 0;

return (0);
out:
return (rc);
}


Expand Down
29 changes: 0 additions & 29 deletions trunk/fs/jfs/jfs_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,35 +57,6 @@ struct timestruc_t {
#define HIGHORDER 0x80000000u /* high order bit on */
#define ONES 0xffffffffu /* all bit on */

/*
* logical xd (lxd)
*/
typedef struct {
unsigned len:24;
unsigned off1:8;
u32 off2;
} lxd_t;

/* lxd_t field construction */
#define LXDlength(lxd, length32) ( (lxd)->len = length32 )
#define LXDoffset(lxd, offset64)\
{\
(lxd)->off1 = ((s64)offset64) >> 32;\
(lxd)->off2 = (offset64) & 0xffffffff;\
}

/* lxd_t field extraction */
#define lengthLXD(lxd) ( (lxd)->len )
#define offsetLXD(lxd)\
( ((s64)((lxd)->off1)) << 32 | (lxd)->off2 )

/* lxd list */
struct lxdlist {
s16 maxnlxd;
s16 nlxd;
lxd_t *lxd;
};

/*
* physical xd (pxd)
*/
Expand Down
Loading

0 comments on commit edd0bc0

Please sign in to comment.