Commit 4639c7a0 authored by Linus Torvalds's avatar Linus Torvalds

Merge http://jfs.bkbits.net/linux-2.5

into home.osdl.org:/home/torvalds/v2.5/linux
parents 3e3a129d f168295a
...@@ -23,6 +23,15 @@ resize=value Resize the volume to <value> blocks. JFS only supports ...@@ -23,6 +23,15 @@ resize=value Resize the volume to <value> blocks. JFS only supports
read-write. The resize keyword with no value will grow read-write. The resize keyword with no value will grow
the volume to the full size of the partition. the volume to the full size of the partition.
nointegrity Do not write to the journal. The primary use of this option
is to allow for higher performance when restoring a volume
from backup media. The integrity of the volume is not
guaranteed if the system abnormally abends.
integrity Default. Commit metadata changes to the journal. Use this
option to remount a volume where the nointegrity option was
previously specified in order to restore normal behavior.
JFS TODO list: JFS TODO list:
Plans for our near term development items Plans for our near term development items
......
...@@ -259,7 +259,7 @@ jfs_get_blocks(struct inode *ip, sector_t lblock, unsigned long max_blocks, ...@@ -259,7 +259,7 @@ jfs_get_blocks(struct inode *ip, sector_t lblock, unsigned long max_blocks,
else else
IREAD_UNLOCK(ip); IREAD_UNLOCK(ip);
} }
return -rc; return rc;
} }
static int jfs_get_block(struct inode *ip, sector_t lblock, static int jfs_get_block(struct inode *ip, sector_t lblock,
......
...@@ -81,7 +81,7 @@ struct btpage { ...@@ -81,7 +81,7 @@ struct btpage {
} else {\ } else {\
P = NULL;\ P = NULL;\
jfs_err("bread failed!");\ jfs_err("bread failed!");\
RC = EIO;\ RC = -EIO;\
}\ }\
}\ }\
} }
......
...@@ -188,8 +188,8 @@ signed char budtab[256] = { ...@@ -188,8 +188,8 @@ signed char budtab[256] = {
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success * 0 - success
* ENOMEM - insufficient memory * -ENOMEM - insufficient memory
* EIO - i/o error * -EIO - i/o error
*/ */
int dbMount(struct inode *ipbmap) int dbMount(struct inode *ipbmap)
{ {
...@@ -204,7 +204,7 @@ int dbMount(struct inode *ipbmap) ...@@ -204,7 +204,7 @@ int dbMount(struct inode *ipbmap)
/* allocate memory for the in-memory bmap descriptor */ /* allocate memory for the in-memory bmap descriptor */
bmp = kmalloc(sizeof(struct bmap), GFP_KERNEL); bmp = kmalloc(sizeof(struct bmap), GFP_KERNEL);
if (bmp == NULL) if (bmp == NULL)
return (ENOMEM); return -ENOMEM;
/* read the on-disk bmap descriptor. */ /* read the on-disk bmap descriptor. */
mp = read_metapage(ipbmap, mp = read_metapage(ipbmap,
...@@ -212,7 +212,7 @@ int dbMount(struct inode *ipbmap) ...@@ -212,7 +212,7 @@ int dbMount(struct inode *ipbmap)
PSIZE, 0); PSIZE, 0);
if (mp == NULL) { if (mp == NULL) {
kfree(bmp); kfree(bmp);
return (EIO); return -EIO;
} }
/* copy the on-disk bmap descriptor to its in-memory version. */ /* copy the on-disk bmap descriptor to its in-memory version. */
...@@ -267,7 +267,7 @@ int dbMount(struct inode *ipbmap) ...@@ -267,7 +267,7 @@ int dbMount(struct inode *ipbmap)
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success * 0 - success
* EIO - i/o error * -EIO - i/o error
*/ */
int dbUnmount(struct inode *ipbmap, int mounterror) int dbUnmount(struct inode *ipbmap, int mounterror)
{ {
...@@ -315,7 +315,7 @@ int dbSync(struct inode *ipbmap) ...@@ -315,7 +315,7 @@ int dbSync(struct inode *ipbmap)
PSIZE, 0); PSIZE, 0);
if (mp == NULL) { if (mp == NULL) {
jfs_err("dbSync: read_metapage failed!"); jfs_err("dbSync: read_metapage failed!");
return (EIO); return -EIO;
} }
/* copy the in-memory version of the bmap to the on-disk version */ /* copy the in-memory version of the bmap to the on-disk version */
dbmp_le = (struct dbmap *) mp->data; dbmp_le = (struct dbmap *) mp->data;
...@@ -368,7 +368,7 @@ int dbSync(struct inode *ipbmap) ...@@ -368,7 +368,7 @@ int dbSync(struct inode *ipbmap)
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success * 0 - success
* EIO - i/o error * -EIO - i/o error
*/ */
int dbFree(struct inode *ip, s64 blkno, s64 nblocks) int dbFree(struct inode *ip, s64 blkno, s64 nblocks)
{ {
...@@ -399,7 +399,7 @@ int dbFree(struct inode *ip, s64 blkno, s64 nblocks) ...@@ -399,7 +399,7 @@ int dbFree(struct inode *ip, s64 blkno, s64 nblocks)
mp = read_metapage(ipbmap, lblkno, PSIZE, 0); mp = read_metapage(ipbmap, lblkno, PSIZE, 0);
if (mp == NULL) { if (mp == NULL) {
IREAD_UNLOCK(ipbmap); IREAD_UNLOCK(ipbmap);
return (EIO); return -EIO;
} }
dp = (struct dmap *) mp->data; dp = (struct dmap *) mp->data;
...@@ -448,7 +448,7 @@ int dbFree(struct inode *ip, s64 blkno, s64 nblocks) ...@@ -448,7 +448,7 @@ int dbFree(struct inode *ip, s64 blkno, s64 nblocks)
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success * 0 - success
* EIO - i/o error * -EIO - i/o error
*/ */
int int
dbUpdatePMap(struct inode *ipbmap, dbUpdatePMap(struct inode *ipbmap,
...@@ -488,7 +488,7 @@ dbUpdatePMap(struct inode *ipbmap, ...@@ -488,7 +488,7 @@ dbUpdatePMap(struct inode *ipbmap,
mp = read_metapage(bmp->db_ipbmap, lblkno, PSIZE, mp = read_metapage(bmp->db_ipbmap, lblkno, PSIZE,
0); 0);
if (mp == NULL) if (mp == NULL)
return (EIO); return -EIO;
} }
dp = (struct dmap *) mp->data; dp = (struct dmap *) mp->data;
...@@ -721,8 +721,8 @@ int dbNextAG(struct inode *ipbmap) ...@@ -721,8 +721,8 @@ int dbNextAG(struct inode *ipbmap)
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success * 0 - success
* ENOSPC - insufficient disk resources * -ENOSPC - insufficient disk resources
* EIO - i/o error * -EIO - i/o error
*/ */
int dbAlloc(struct inode *ip, s64 hint, s64 nblocks, s64 * results) int dbAlloc(struct inode *ip, s64 hint, s64 nblocks, s64 * results)
{ {
...@@ -742,7 +742,7 @@ int dbAlloc(struct inode *ip, s64 hint, s64 nblocks, s64 * results) ...@@ -742,7 +742,7 @@ int dbAlloc(struct inode *ip, s64 hint, s64 nblocks, s64 * results)
#ifdef _STILL_TO_PORT #ifdef _STILL_TO_PORT
/* DASD limit check F226941 */ /* DASD limit check F226941 */
if (OVER_LIMIT(ip, nblocks)) if (OVER_LIMIT(ip, nblocks))
return ENOSPC; return -ENOSPC;
#endif /* _STILL_TO_PORT */ #endif /* _STILL_TO_PORT */
/* get the log2 number of blocks to be allocated. /* get the log2 number of blocks to be allocated.
...@@ -812,7 +812,7 @@ int dbAlloc(struct inode *ip, s64 hint, s64 nblocks, s64 * results) ...@@ -812,7 +812,7 @@ int dbAlloc(struct inode *ip, s64 hint, s64 nblocks, s64 * results)
/* get the buffer for the dmap containing the hint. /* get the buffer for the dmap containing the hint.
*/ */
rc = EIO; rc = -EIO;
lblkno = BLKTODMAP(blkno, bmp->db_l2nbperpage); lblkno = BLKTODMAP(blkno, bmp->db_l2nbperpage);
mp = read_metapage(ipbmap, lblkno, PSIZE, 0); mp = read_metapage(ipbmap, lblkno, PSIZE, 0);
if (mp == NULL) if (mp == NULL)
...@@ -824,7 +824,7 @@ int dbAlloc(struct inode *ip, s64 hint, s64 nblocks, s64 * results) ...@@ -824,7 +824,7 @@ int dbAlloc(struct inode *ip, s64 hint, s64 nblocks, s64 * results)
* blocks beginning at the hint. * blocks beginning at the hint.
*/ */
if ((rc = dbAllocNext(bmp, dp, blkno, (int) nblocks)) if ((rc = dbAllocNext(bmp, dp, blkno, (int) nblocks))
!= ENOSPC) { != -ENOSPC) {
if (rc == 0) { if (rc == 0) {
*results = blkno; *results = blkno;
DBALLOC(bmp->db_DBmap, bmp->db_mapsize, DBALLOC(bmp->db_DBmap, bmp->db_mapsize,
...@@ -853,7 +853,7 @@ int dbAlloc(struct inode *ip, s64 hint, s64 nblocks, s64 * results) ...@@ -853,7 +853,7 @@ int dbAlloc(struct inode *ip, s64 hint, s64 nblocks, s64 * results)
*/ */
if ((rc = if ((rc =
dbAllocNear(bmp, dp, blkno, (int) nblocks, l2nb, results)) dbAllocNear(bmp, dp, blkno, (int) nblocks, l2nb, results))
!= ENOSPC) { != -ENOSPC) {
if (rc == 0) { if (rc == 0) {
DBALLOC(bmp->db_DBmap, bmp->db_mapsize, DBALLOC(bmp->db_DBmap, bmp->db_mapsize,
*results, nblocks); *results, nblocks);
...@@ -868,7 +868,7 @@ int dbAlloc(struct inode *ip, s64 hint, s64 nblocks, s64 * results) ...@@ -868,7 +868,7 @@ int dbAlloc(struct inode *ip, s64 hint, s64 nblocks, s64 * results)
* the same dmap as the hint. * the same dmap as the hint.
*/ */
if ((rc = dbAllocDmapLev(bmp, dp, (int) nblocks, l2nb, results)) if ((rc = dbAllocDmapLev(bmp, dp, (int) nblocks, l2nb, results))
!= ENOSPC) { != -ENOSPC) {
if (rc == 0) { if (rc == 0) {
DBALLOC(bmp->db_DBmap, bmp->db_mapsize, DBALLOC(bmp->db_DBmap, bmp->db_mapsize,
*results, nblocks); *results, nblocks);
...@@ -888,7 +888,7 @@ int dbAlloc(struct inode *ip, s64 hint, s64 nblocks, s64 * results) ...@@ -888,7 +888,7 @@ int dbAlloc(struct inode *ip, s64 hint, s64 nblocks, s64 * results)
*/ */
IWRITE_LOCK(ipbmap); IWRITE_LOCK(ipbmap);
if ((rc = dbAllocAG(bmp, agno, nblocks, l2nb, results)) if ((rc = dbAllocAG(bmp, agno, nblocks, l2nb, results))
!= ENOSPC) { != -ENOSPC) {
if (rc == 0) if (rc == 0)
DBALLOC(bmp->db_DBmap, bmp->db_mapsize, DBALLOC(bmp->db_DBmap, bmp->db_mapsize,
*results, nblocks); *results, nblocks);
...@@ -907,7 +907,7 @@ int dbAlloc(struct inode *ip, s64 hint, s64 nblocks, s64 * results) ...@@ -907,7 +907,7 @@ int dbAlloc(struct inode *ip, s64 hint, s64 nblocks, s64 * results)
/* Try to allocate within this allocation group. if that fails, try to /* Try to allocate within this allocation group. if that fails, try to
* allocate anywhere in the map. * allocate anywhere in the map.
*/ */
if ((rc = dbAllocAG(bmp, agno, nblocks, l2nb, results)) == ENOSPC) if ((rc = dbAllocAG(bmp, agno, nblocks, l2nb, results)) == -ENOSPC)
rc = dbAllocAny(bmp, nblocks, l2nb, results); rc = dbAllocAny(bmp, nblocks, l2nb, results);
if (rc == 0) { if (rc == 0) {
DBALLOC(bmp->db_DBmap, bmp->db_mapsize, *results, nblocks); DBALLOC(bmp->db_DBmap, bmp->db_mapsize, *results, nblocks);
...@@ -937,8 +937,8 @@ int dbAlloc(struct inode *ip, s64 hint, s64 nblocks, s64 * results) ...@@ -937,8 +937,8 @@ int dbAlloc(struct inode *ip, s64 hint, s64 nblocks, s64 * results)
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success * 0 - success
* ENOSPC - insufficient disk resources * -ENOSPC - insufficient disk resources
* EIO - i/o error * -EIO - i/o error
*/ */
int dbAllocExact(struct inode *ip, s64 blkno, int nblocks) int dbAllocExact(struct inode *ip, s64 blkno, int nblocks)
{ {
...@@ -960,13 +960,13 @@ int dbAllocExact(struct inode *ip, s64 blkno, int nblocks) ...@@ -960,13 +960,13 @@ int dbAllocExact(struct inode *ip, s64 blkno, int nblocks)
*/ */
if (nblocks <= 0 || nblocks > BPERDMAP || blkno >= bmp->db_mapsize) { if (nblocks <= 0 || nblocks > BPERDMAP || blkno >= bmp->db_mapsize) {
IREAD_UNLOCK(ipbmap); IREAD_UNLOCK(ipbmap);
return EINVAL; return -EINVAL;
} }
if (nblocks > ((s64) 1 << bmp->db_maxfreebud)) { if (nblocks > ((s64) 1 << bmp->db_maxfreebud)) {
/* the free space is no longer available */ /* the free space is no longer available */
IREAD_UNLOCK(ipbmap); IREAD_UNLOCK(ipbmap);
return ENOSPC; return -ENOSPC;
} }
/* read in the dmap covering the extent */ /* read in the dmap covering the extent */
...@@ -974,7 +974,7 @@ int dbAllocExact(struct inode *ip, s64 blkno, int nblocks) ...@@ -974,7 +974,7 @@ int dbAllocExact(struct inode *ip, s64 blkno, int nblocks)
mp = read_metapage(ipbmap, lblkno, PSIZE, 0); mp = read_metapage(ipbmap, lblkno, PSIZE, 0);
if (mp == NULL) { if (mp == NULL) {
IREAD_UNLOCK(ipbmap); IREAD_UNLOCK(ipbmap);
return (EIO); return -EIO;
} }
dp = (struct dmap *) mp->data; dp = (struct dmap *) mp->data;
...@@ -1022,8 +1022,8 @@ int dbAllocExact(struct inode *ip, s64 blkno, int nblocks) ...@@ -1022,8 +1022,8 @@ int dbAllocExact(struct inode *ip, s64 blkno, int nblocks)
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success * 0 - success
* ENOSPC - insufficient disk resources * -ENOSPC - insufficient disk resources
* EIO - i/o error * -EIO - i/o error
*/ */
int int
dbReAlloc(struct inode *ip, dbReAlloc(struct inode *ip,
...@@ -1037,7 +1037,7 @@ dbReAlloc(struct inode *ip, ...@@ -1037,7 +1037,7 @@ dbReAlloc(struct inode *ip,
*results = blkno; *results = blkno;
return (0); return (0);
} else { } else {
if (rc != ENOSPC) if (rc != -ENOSPC)
return (rc); return (rc);
} }
...@@ -1071,8 +1071,8 @@ dbReAlloc(struct inode *ip, ...@@ -1071,8 +1071,8 @@ dbReAlloc(struct inode *ip,
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success * 0 - success
* ENOSPC - insufficient disk resources * -ENOSPC - insufficient disk resources
* EIO - i/o error * -EIO - i/o error
*/ */
int dbExtend(struct inode *ip, s64 blkno, s64 nblocks, s64 addnblocks) int dbExtend(struct inode *ip, s64 blkno, s64 nblocks, s64 addnblocks)
{ {
...@@ -1090,7 +1090,7 @@ int dbExtend(struct inode *ip, s64 blkno, s64 nblocks, s64 addnblocks) ...@@ -1090,7 +1090,7 @@ int dbExtend(struct inode *ip, s64 blkno, s64 nblocks, s64 addnblocks)
*/ */
if (((rel_block = blkno & (sbi->nbperpage - 1))) && if (((rel_block = blkno & (sbi->nbperpage - 1))) &&
(rel_block + nblocks + addnblocks > sbi->nbperpage)) (rel_block + nblocks + addnblocks > sbi->nbperpage))
return (ENOSPC); return -ENOSPC;
/* get the last block of the current allocation */ /* get the last block of the current allocation */
lastblkno = blkno + nblocks - 1; lastblkno = blkno + nblocks - 1;
...@@ -1117,7 +1117,7 @@ int dbExtend(struct inode *ip, s64 blkno, s64 nblocks, s64 addnblocks) ...@@ -1117,7 +1117,7 @@ int dbExtend(struct inode *ip, s64 blkno, s64 nblocks, s64 addnblocks)
if (addnblocks > BPERDMAP || extblkno >= bmp->db_mapsize || if (addnblocks > BPERDMAP || extblkno >= bmp->db_mapsize ||
(extblkno & (bmp->db_agsize - 1)) == 0) { (extblkno & (bmp->db_agsize - 1)) == 0) {
IREAD_UNLOCK(ipbmap); IREAD_UNLOCK(ipbmap);
return (ENOSPC); return -ENOSPC;
} }
/* get the buffer for the dmap containing the first block /* get the buffer for the dmap containing the first block
...@@ -1127,7 +1127,7 @@ int dbExtend(struct inode *ip, s64 blkno, s64 nblocks, s64 addnblocks) ...@@ -1127,7 +1127,7 @@ int dbExtend(struct inode *ip, s64 blkno, s64 nblocks, s64 addnblocks)
mp = read_metapage(ipbmap, lblkno, PSIZE, 0); mp = read_metapage(ipbmap, lblkno, PSIZE, 0);
if (mp == NULL) { if (mp == NULL) {
IREAD_UNLOCK(ipbmap); IREAD_UNLOCK(ipbmap);
return (EIO); return -EIO;
} }
DBALLOCCK(bmp->db_DBmap, bmp->db_mapsize, blkno, nblocks); DBALLOCCK(bmp->db_DBmap, bmp->db_mapsize, blkno, nblocks);
...@@ -1148,7 +1148,7 @@ int dbExtend(struct inode *ip, s64 blkno, s64 nblocks, s64 addnblocks) ...@@ -1148,7 +1148,7 @@ int dbExtend(struct inode *ip, s64 blkno, s64 nblocks, s64 addnblocks)
} else { } else {
/* we were not successful */ /* we were not successful */
release_metapage(mp); release_metapage(mp);
assert(rc == ENOSPC || rc == EIO); assert(rc == -ENOSPC || rc == -EIO);
} }
return (rc); return (rc);
...@@ -1169,8 +1169,8 @@ int dbExtend(struct inode *ip, s64 blkno, s64 nblocks, s64 addnblocks) ...@@ -1169,8 +1169,8 @@ int dbExtend(struct inode *ip, s64 blkno, s64 nblocks, s64 addnblocks)
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success * 0 - success
* ENOSPC - insufficient disk resources * -ENOSPC - insufficient disk resources
* EIO - i/o error * -EIO - i/o error
* *
* serialization: IREAD_LOCK(ipbmap) held on entry/exit; * serialization: IREAD_LOCK(ipbmap) held on entry/exit;
*/ */
...@@ -1196,13 +1196,13 @@ static int dbAllocNext(struct bmap * bmp, struct dmap * dp, s64 blkno, ...@@ -1196,13 +1196,13 @@ static int dbAllocNext(struct bmap * bmp, struct dmap * dp, s64 blkno,
* this dmap. * this dmap.
*/ */
if (dbitno + nblocks > BPERDMAP) if (dbitno + nblocks > BPERDMAP)
return (ENOSPC); return -ENOSPC;
/* check if the starting leaf indicates that anything /* check if the starting leaf indicates that anything
* is free. * is free.
*/ */
if (leaf[word] == NOFREE) if (leaf[word] == NOFREE)
return (ENOSPC); return -ENOSPC;
/* check the dmaps words corresponding to block range to see /* check the dmaps words corresponding to block range to see
* if the block range is free. not all bits of the first and * if the block range is free. not all bits of the first and
...@@ -1231,7 +1231,7 @@ static int dbAllocNext(struct bmap * bmp, struct dmap * dp, s64 blkno, ...@@ -1231,7 +1231,7 @@ static int dbAllocNext(struct bmap * bmp, struct dmap * dp, s64 blkno,
*/ */
mask = (ONES << (DBWORD - nb) >> wbitno); mask = (ONES << (DBWORD - nb) >> wbitno);
if ((mask & ~le32_to_cpu(dp->wmap[word])) != mask) if ((mask & ~le32_to_cpu(dp->wmap[word])) != mask)
return (ENOSPC); return -ENOSPC;
word += 1; word += 1;
} else { } else {
...@@ -1249,7 +1249,7 @@ static int dbAllocNext(struct bmap * bmp, struct dmap * dp, s64 blkno, ...@@ -1249,7 +1249,7 @@ static int dbAllocNext(struct bmap * bmp, struct dmap * dp, s64 blkno,
/* does the leaf describe any free space ? /* does the leaf describe any free space ?
*/ */
if (leaf[word] < BUDMIN) if (leaf[word] < BUDMIN)
return (ENOSPC); return -ENOSPC;
/* determine the l2 number of bits provided /* determine the l2 number of bits provided
* by this leaf. * by this leaf.
...@@ -1295,8 +1295,8 @@ static int dbAllocNext(struct bmap * bmp, struct dmap * dp, s64 blkno, ...@@ -1295,8 +1295,8 @@ static int dbAllocNext(struct bmap * bmp, struct dmap * dp, s64 blkno,
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success * 0 - success
* ENOSPC - insufficient disk resources * -ENOSPC - insufficient disk resources
* EIO - i/o error * -EIO - i/o error
* *
* serialization: IREAD_LOCK(ipbmap) held on entry/exit; * serialization: IREAD_LOCK(ipbmap) held on entry/exit;
*/ */
...@@ -1344,7 +1344,7 @@ dbAllocNear(struct bmap * bmp, ...@@ -1344,7 +1344,7 @@ dbAllocNear(struct bmap * bmp,
return (rc); return (rc);
} }
return (ENOSPC); return -ENOSPC;
} }
...@@ -1397,8 +1397,8 @@ dbAllocNear(struct bmap * bmp, ...@@ -1397,8 +1397,8 @@ dbAllocNear(struct bmap * bmp,
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success * 0 - success
* ENOSPC - insufficient disk resources * -ENOSPC - insufficient disk resources
* EIO - i/o error * -EIO - i/o error
* *
* note: IWRITE_LOCK(ipmap) held on entry/exit; * note: IWRITE_LOCK(ipmap) held on entry/exit;
*/ */
...@@ -1441,8 +1441,8 @@ dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb, s64 * results) ...@@ -1441,8 +1441,8 @@ dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb, s64 * results)
if (bmp->db_agsize == BPERDMAP if (bmp->db_agsize == BPERDMAP
|| bmp->db_agfree[agno] == bmp->db_agsize) { || bmp->db_agfree[agno] == bmp->db_agsize) {
rc = dbAllocCtl(bmp, nblocks, l2nb, blkno, results); rc = dbAllocCtl(bmp, nblocks, l2nb, blkno, results);
/* assert(!(rc == ENOSPC && bmp->db_agfree[agno] == bmp->db_agsize)); */ /* assert(!(rc == -ENOSPC && bmp->db_agfree[agno] == bmp->db_agsize)); */
if ((rc == ENOSPC) && if ((rc == -ENOSPC) &&
(bmp->db_agfree[agno] == bmp->db_agsize)) { (bmp->db_agfree[agno] == bmp->db_agsize)) {
jfs_err("dbAllocAG: removed assert, but still need to " jfs_err("dbAllocAG: removed assert, but still need to "
"debug here\nblkno = 0x%Lx, nblocks = 0x%Lx", "debug here\nblkno = 0x%Lx, nblocks = 0x%Lx",
...@@ -1458,7 +1458,7 @@ dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb, s64 * results) ...@@ -1458,7 +1458,7 @@ dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb, s64 * results)
lblkno = BLKTOCTL(blkno, bmp->db_l2nbperpage, bmp->db_aglevel); lblkno = BLKTOCTL(blkno, bmp->db_l2nbperpage, bmp->db_aglevel);
mp = read_metapage(bmp->db_ipbmap, lblkno, PSIZE, 0); mp = read_metapage(bmp->db_ipbmap, lblkno, PSIZE, 0);
if (mp == NULL) if (mp == NULL)
return (EIO); return -EIO;
dcp = (struct dmapctl *) mp->data; dcp = (struct dmapctl *) mp->data;
budmin = dcp->budmin; budmin = dcp->budmin;
...@@ -1531,7 +1531,7 @@ dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb, s64 * results) ...@@ -1531,7 +1531,7 @@ dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb, s64 * results)
if ((rc = if ((rc =
dbFindCtl(bmp, l2nb, bmp->db_aglevel - 1, dbFindCtl(bmp, l2nb, bmp->db_aglevel - 1,
&blkno))) { &blkno))) {
assert(rc != ENOSPC); assert(rc != -ENOSPC);
return (rc); return (rc);
} }
} }
...@@ -1539,16 +1539,16 @@ dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb, s64 * results) ...@@ -1539,16 +1539,16 @@ dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb, s64 * results)
/* allocate the blocks. /* allocate the blocks.
*/ */
rc = dbAllocCtl(bmp, nblocks, l2nb, blkno, results); rc = dbAllocCtl(bmp, nblocks, l2nb, blkno, results);
assert(rc != ENOSPC); assert(rc != -ENOSPC);
return (rc); return (rc);
} }
/* no space in the allocation group. release the buffer and /* no space in the allocation group. release the buffer and
* return ENOSPC. * return -ENOSPC.
*/ */
release_metapage(mp); release_metapage(mp);
return (ENOSPC); return -ENOSPC;
} }
...@@ -1573,8 +1573,8 @@ dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb, s64 * results) ...@@ -1573,8 +1573,8 @@ dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb, s64 * results)
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success * 0 - success
* ENOSPC - insufficient disk resources * -ENOSPC - insufficient disk resources
* EIO - i/o error * -EIO - i/o error
* *
* serialization: IWRITE_LOCK(ipbmap) held on entry/exit; * serialization: IWRITE_LOCK(ipbmap) held on entry/exit;
*/ */
...@@ -1595,7 +1595,7 @@ static int dbAllocAny(struct bmap * bmp, s64 nblocks, int l2nb, s64 * results) ...@@ -1595,7 +1595,7 @@ static int dbAllocAny(struct bmap * bmp, s64 nblocks, int l2nb, s64 * results)
/* allocate the blocks. /* allocate the blocks.
*/ */
rc = dbAllocCtl(bmp, nblocks, l2nb, blkno, results); rc = dbAllocCtl(bmp, nblocks, l2nb, blkno, results);
assert(rc != ENOSPC); assert(rc != -ENOSPC);
return (rc); return (rc);
} }
...@@ -1623,8 +1623,8 @@ static int dbAllocAny(struct bmap * bmp, s64 nblocks, int l2nb, s64 * results) ...@@ -1623,8 +1623,8 @@ static int dbAllocAny(struct bmap * bmp, s64 nblocks, int l2nb, s64 * results)
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success * 0 - success
* ENOSPC - insufficient disk resources * -ENOSPC - insufficient disk resources
* EIO - i/o error * -EIO - i/o error
* *
* serialization: IWRITE_LOCK(ipbmap) held on entry/exit; * serialization: IWRITE_LOCK(ipbmap) held on entry/exit;
*/ */
...@@ -1648,7 +1648,7 @@ static int dbFindCtl(struct bmap * bmp, int l2nb, int level, s64 * blkno) ...@@ -1648,7 +1648,7 @@ static int dbFindCtl(struct bmap * bmp, int l2nb, int level, s64 * blkno)
lblkno = BLKTOCTL(b, bmp->db_l2nbperpage, lev); lblkno = BLKTOCTL(b, bmp->db_l2nbperpage, lev);
mp = read_metapage(bmp->db_ipbmap, lblkno, PSIZE, 0); mp = read_metapage(bmp->db_ipbmap, lblkno, PSIZE, 0);
if (mp == NULL) if (mp == NULL)
return (EIO); return -EIO;
dcp = (struct dmapctl *) mp->data; dcp = (struct dmapctl *) mp->data;
budmin = dcp->budmin; budmin = dcp->budmin;
...@@ -1667,7 +1667,7 @@ static int dbFindCtl(struct bmap * bmp, int l2nb, int level, s64 * blkno) ...@@ -1667,7 +1667,7 @@ static int dbFindCtl(struct bmap * bmp, int l2nb, int level, s64 * blkno)
*/ */
if (rc) { if (rc) {
assert(lev == level); assert(lev == level);
return (ENOSPC); return -ENOSPC;
} }
/* adjust the block number to reflect the location within /* adjust the block number to reflect the location within
...@@ -1730,8 +1730,8 @@ static int dbFindCtl(struct bmap * bmp, int l2nb, int level, s64 * blkno) ...@@ -1730,8 +1730,8 @@ static int dbFindCtl(struct bmap * bmp, int l2nb, int level, s64 * blkno)
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success * 0 - success
* ENOSPC - insufficient disk resources * -ENOSPC - insufficient disk resources
* EIO - i/o error * -EIO - i/o error
* *
* serialization: IWRITE_LOCK(ipbmap) held on entry/exit; * serialization: IWRITE_LOCK(ipbmap) held on entry/exit;
*/ */
...@@ -1751,7 +1751,7 @@ dbAllocCtl(struct bmap * bmp, s64 nblocks, int l2nb, s64 blkno, s64 * results) ...@@ -1751,7 +1751,7 @@ dbAllocCtl(struct bmap * bmp, s64 nblocks, int l2nb, s64 blkno, s64 * results)
lblkno = BLKTODMAP(blkno, bmp->db_l2nbperpage); lblkno = BLKTODMAP(blkno, bmp->db_l2nbperpage);
mp = read_metapage(bmp->db_ipbmap, lblkno, PSIZE, 0); mp = read_metapage(bmp->db_ipbmap, lblkno, PSIZE, 0);
if (mp == NULL) if (mp == NULL)
return (EIO); return -EIO;
dp = (struct dmap *) mp->data; dp = (struct dmap *) mp->data;
/* try to allocate the blocks. /* try to allocate the blocks.
...@@ -1778,7 +1778,7 @@ dbAllocCtl(struct bmap * bmp, s64 nblocks, int l2nb, s64 blkno, s64 * results) ...@@ -1778,7 +1778,7 @@ dbAllocCtl(struct bmap * bmp, s64 nblocks, int l2nb, s64 blkno, s64 * results)
lblkno = BLKTODMAP(b, bmp->db_l2nbperpage); lblkno = BLKTODMAP(b, bmp->db_l2nbperpage);
mp = read_metapage(bmp->db_ipbmap, lblkno, PSIZE, 0); mp = read_metapage(bmp->db_ipbmap, lblkno, PSIZE, 0);
if (mp == NULL) { if (mp == NULL) {
rc = EIO; rc = -EIO;
goto backout; goto backout;
} }
dp = (struct dmap *) mp->data; dp = (struct dmap *) mp->data;
...@@ -1875,8 +1875,8 @@ dbAllocCtl(struct bmap * bmp, s64 nblocks, int l2nb, s64 blkno, s64 * results) ...@@ -1875,8 +1875,8 @@ dbAllocCtl(struct bmap * bmp, s64 nblocks, int l2nb, s64 blkno, s64 * results)
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success * 0 - success
* ENOSPC - insufficient disk resources * -ENOSPC - insufficient disk resources
* EIO - i/o error * -EIO - i/o error
* *
* serialization: IREAD_LOCK(ipbmap), e.g., from dbAlloc(), or * serialization: IREAD_LOCK(ipbmap), e.g., from dbAlloc(), or
* IWRITE_LOCK(ipbmap), e.g., dbAllocCtl(), held on entry/exit; * IWRITE_LOCK(ipbmap), e.g., dbAllocCtl(), held on entry/exit;
...@@ -1896,7 +1896,7 @@ dbAllocDmapLev(struct bmap * bmp, ...@@ -1896,7 +1896,7 @@ dbAllocDmapLev(struct bmap * bmp,
* returns the index of the leaf at which free space was found. * returns the index of the leaf at which free space was found.
*/ */
if (dbFindLeaf((dmtree_t *) & dp->tree, l2nb, &leafidx)) if (dbFindLeaf((dmtree_t *) & dp->tree, l2nb, &leafidx))
return (ENOSPC); return -ENOSPC;
/* determine the block number within the file system corresponding /* determine the block number within the file system corresponding
* to the leaf at which free space was found. * to the leaf at which free space was found.
...@@ -1941,7 +1941,7 @@ dbAllocDmapLev(struct bmap * bmp, ...@@ -1941,7 +1941,7 @@ dbAllocDmapLev(struct bmap * bmp,
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success * 0 - success
* EIO - i/o error * -EIO - i/o error
* *
* serialization: IREAD_LOCK(ipbmap) or IWRITE_LOCK(ipbmap) held on entry/exit; * serialization: IREAD_LOCK(ipbmap) or IWRITE_LOCK(ipbmap) held on entry/exit;
*/ */
...@@ -1996,7 +1996,7 @@ static int dbAllocDmap(struct bmap * bmp, struct dmap * dp, s64 blkno, ...@@ -1996,7 +1996,7 @@ static int dbAllocDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success * 0 - success
* EIO - i/o error * -EIO - i/o error
* *
* serialization: IREAD_LOCK(ipbmap) or IWRITE_LOCK(ipbmap) held on entry/exit; * serialization: IREAD_LOCK(ipbmap) or IWRITE_LOCK(ipbmap) held on entry/exit;
*/ */
...@@ -2376,7 +2376,7 @@ static void dbFreeBits(struct bmap * bmp, struct dmap * dp, s64 blkno, ...@@ -2376,7 +2376,7 @@ static void dbFreeBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success * 0 - success
* EIO - i/o error * -EIO - i/o error
* *
* serialization: IREAD_LOCK(ipbmap) or IWRITE_LOCK(ipbmap) held on entry/exit; * serialization: IREAD_LOCK(ipbmap) or IWRITE_LOCK(ipbmap) held on entry/exit;
*/ */
...@@ -2396,7 +2396,7 @@ dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, int level) ...@@ -2396,7 +2396,7 @@ dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, int level)
lblkno = BLKTOCTL(blkno, bmp->db_l2nbperpage, level); lblkno = BLKTOCTL(blkno, bmp->db_l2nbperpage, level);
mp = read_metapage(bmp->db_ipbmap, lblkno, PSIZE, 0); mp = read_metapage(bmp->db_ipbmap, lblkno, PSIZE, 0);
if (mp == NULL) if (mp == NULL)
return (EIO); return -EIO;
dcp = (struct dmapctl *) mp->data; dcp = (struct dmapctl *) mp->data;
/* determine the leaf number corresponding to the block and /* determine the leaf number corresponding to the block and
...@@ -2819,7 +2819,7 @@ static void dbAdjTree(dmtree_t * tp, int leafno, int newval) ...@@ -2819,7 +2819,7 @@ static void dbAdjTree(dmtree_t * tp, int leafno, int newval)
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success * 0 - success
* ENOSPC - insufficient free blocks. * -ENOSPC - insufficient free blocks.
*/ */
static int dbFindLeaf(dmtree_t * tp, int l2nb, int *leafidx) static int dbFindLeaf(dmtree_t * tp, int l2nb, int *leafidx)
{ {
...@@ -2829,7 +2829,7 @@ static int dbFindLeaf(dmtree_t * tp, int l2nb, int *leafidx) ...@@ -2829,7 +2829,7 @@ static int dbFindLeaf(dmtree_t * tp, int l2nb, int *leafidx)
* sufficient free space. * sufficient free space.
*/ */
if (l2nb > tp->dmt_stree[ROOT]) if (l2nb > tp->dmt_stree[ROOT])
return (ENOSPC); return -ENOSPC;
/* sufficient free space available. now search down the tree /* sufficient free space available. now search down the tree
* starting at the next level for the leftmost leaf that * starting at the next level for the leftmost leaf that
...@@ -3073,7 +3073,7 @@ void fsDirty(void) ...@@ -3073,7 +3073,7 @@ void fsDirty(void)
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success * 0 - success
* EIO - i/o error * -EIO - i/o error
*/ */
int dbAllocBottomUp(struct inode *ip, s64 blkno, s64 nblocks) int dbAllocBottomUp(struct inode *ip, s64 blkno, s64 nblocks)
{ {
...@@ -3104,7 +3104,7 @@ int dbAllocBottomUp(struct inode *ip, s64 blkno, s64 nblocks) ...@@ -3104,7 +3104,7 @@ int dbAllocBottomUp(struct inode *ip, s64 blkno, s64 nblocks)
mp = read_metapage(ipbmap, lblkno, PSIZE, 0); mp = read_metapage(ipbmap, lblkno, PSIZE, 0);
if (mp == NULL) { if (mp == NULL) {
IREAD_UNLOCK(ipbmap); IREAD_UNLOCK(ipbmap);
return (EIO); return -EIO;
} }
dp = (struct dmap *) mp->data; dp = (struct dmap *) mp->data;
...@@ -3514,7 +3514,7 @@ int dbExtendFS(struct inode *ipbmap, s64 blkno, s64 nblocks) ...@@ -3514,7 +3514,7 @@ int dbExtendFS(struct inode *ipbmap, s64 blkno, s64 nblocks)
return 0; return 0;
errout: errout:
return EIO; return -EIO;
} }
......
...@@ -134,7 +134,7 @@ struct dtsplit { ...@@ -134,7 +134,7 @@ struct dtsplit {
BT_PUTPAGE(MP);\ BT_PUTPAGE(MP);\
updateSuper((IP)->i_sb, FM_DIRTY);\ updateSuper((IP)->i_sb, FM_DIRTY);\
MP = NULL;\ MP = NULL;\
RC = EIO;\ RC = -EIO;\
}\ }\
}\ }\
} }
...@@ -404,7 +404,7 @@ static u32 add_index(tid_t tid, struct inode *ip, s64 bn, int slot) ...@@ -404,7 +404,7 @@ static u32 add_index(tid_t tid, struct inode *ip, s64 bn, int slot)
xtInsert(tid, ip, 0, 0, sbi->nbperpage, xtInsert(tid, ip, 0, 0, sbi->nbperpage,
&xaddr, 0))) { &xaddr, 0))) {
jfs_warn("add_index: xtInsert failed!"); jfs_warn("add_index: xtInsert failed!");
return -1; return -EPERM;
} }
ip->i_size = PSIZE; ip->i_size = PSIZE;
ip->i_blocks += LBLK2PBLK(sb, sbi->nbperpage); ip->i_blocks += LBLK2PBLK(sb, sbi->nbperpage);
...@@ -412,7 +412,7 @@ static u32 add_index(tid_t tid, struct inode *ip, s64 bn, int slot) ...@@ -412,7 +412,7 @@ static u32 add_index(tid_t tid, struct inode *ip, s64 bn, int slot)
if ((mp = get_index_page(ip, 0)) == 0) { if ((mp = get_index_page(ip, 0)) == 0) {
jfs_err("add_index: get_metapage failed!"); jfs_err("add_index: get_metapage failed!");
xtTruncate(tid, ip, 0, COMMIT_PWMAP); xtTruncate(tid, ip, 0, COMMIT_PWMAP);
return -1; return -EPERM;
} }
tlck = txLock(tid, ip, mp, tlckDATA); tlck = txLock(tid, ip, mp, tlckDATA);
llck = (struct linelock *) & tlck->lock; llck = (struct linelock *) & tlck->lock;
...@@ -447,7 +447,7 @@ static u32 add_index(tid_t tid, struct inode *ip, s64 bn, int slot) ...@@ -447,7 +447,7 @@ static u32 add_index(tid_t tid, struct inode *ip, s64 bn, int slot)
&xaddr, 0))) { &xaddr, 0))) {
jfs_warn("add_index: xtInsert failed!"); jfs_warn("add_index: xtInsert failed!");
jfs_ip->next_index--; jfs_ip->next_index--;
return -1; return -EPERM;
} }
ip->i_size += PSIZE; ip->i_size += PSIZE;
ip->i_blocks += LBLK2PBLK(sb, sbi->nbperpage); ip->i_blocks += LBLK2PBLK(sb, sbi->nbperpage);
...@@ -461,7 +461,7 @@ static u32 add_index(tid_t tid, struct inode *ip, s64 bn, int slot) ...@@ -461,7 +461,7 @@ static u32 add_index(tid_t tid, struct inode *ip, s64 bn, int slot)
if (mp == 0) { if (mp == 0) {
jfs_err("add_index: get/read_metapage failed!"); jfs_err("add_index: get/read_metapage failed!");
return -1; return -EPERM;
} }
lock_index(tid, ip, mp, index); lock_index(tid, ip, mp, index);
...@@ -588,7 +588,7 @@ int dtSearch(struct inode *ip, struct component_name * key, ino_t * data, ...@@ -588,7 +588,7 @@ int dtSearch(struct inode *ip, struct component_name * key, ino_t * data,
(wchar_t *) kmalloc((JFS_NAME_MAX + 1) * sizeof(wchar_t), (wchar_t *) kmalloc((JFS_NAME_MAX + 1) * sizeof(wchar_t),
GFP_NOFS); GFP_NOFS);
if (ciKey.name == 0) { if (ciKey.name == 0) {
rc = ENOMEM; rc = -ENOMEM;
goto dtSearch_Exit2; goto dtSearch_Exit2;
} }
...@@ -674,7 +674,7 @@ int dtSearch(struct inode *ip, struct component_name * key, ino_t * data, ...@@ -674,7 +674,7 @@ int dtSearch(struct inode *ip, struct component_name * key, ino_t * data,
*/ */
if (flag == JFS_CREATE) { if (flag == JFS_CREATE) {
*data = inumber; *data = inumber;
rc = EEXIST; rc = -EEXIST;
goto out; goto out;
} }
...@@ -684,7 +684,7 @@ int dtSearch(struct inode *ip, struct component_name * key, ino_t * data, ...@@ -684,7 +684,7 @@ int dtSearch(struct inode *ip, struct component_name * key, ino_t * data,
if ((flag == JFS_REMOVE || if ((flag == JFS_REMOVE ||
flag == JFS_RENAME) && flag == JFS_RENAME) &&
*data != inumber) { *data != inumber) {
rc = ESTALE; rc = -ESTALE;
goto out; goto out;
} }
...@@ -732,7 +732,7 @@ int dtSearch(struct inode *ip, struct component_name * key, ino_t * data, ...@@ -732,7 +732,7 @@ int dtSearch(struct inode *ip, struct component_name * key, ino_t * data,
*/ */
if (flag == JFS_LOOKUP || flag == JFS_REMOVE || if (flag == JFS_LOOKUP || flag == JFS_REMOVE ||
flag == JFS_RENAME) { flag == JFS_RENAME) {
rc = ENOENT; rc = -ENOENT;
goto out; goto out;
} }
...@@ -770,7 +770,7 @@ int dtSearch(struct inode *ip, struct component_name * key, ino_t * data, ...@@ -770,7 +770,7 @@ int dtSearch(struct inode *ip, struct component_name * key, ino_t * data,
*/ */
jfs_err("stack overrun in dtSearch!"); jfs_err("stack overrun in dtSearch!");
updateSuper(sb, FM_DIRTY); updateSuper(sb, FM_DIRTY);
rc = EIO; rc = -EIO;
goto out; goto out;
} }
btstack->nsplit++; btstack->nsplit++;
...@@ -840,7 +840,7 @@ int dtInsert(tid_t tid, struct inode *ip, ...@@ -840,7 +840,7 @@ int dtInsert(tid_t tid, struct inode *ip,
if (DO_INDEX(ip)) { if (DO_INDEX(ip)) {
if (JFS_IP(ip)->next_index == DIREND) { if (JFS_IP(ip)->next_index == DIREND) {
DT_PUTPAGE(mp); DT_PUTPAGE(mp);
return EMLINK; return -EMLINK;
} }
n = NDTLEAF(name->namlen); n = NDTLEAF(name->namlen);
data.leaf.tid = tid; data.leaf.tid = tid;
...@@ -953,7 +953,7 @@ static int dtSplitUp(tid_t tid, ...@@ -953,7 +953,7 @@ static int dtSplitUp(tid_t tid,
GFP_NOFS); GFP_NOFS);
if (key.name == 0) { if (key.name == 0) {
DT_PUTPAGE(smp); DT_PUTPAGE(smp);
rc = ENOMEM; rc = -ENOMEM;
goto dtSplitUp_Exit; goto dtSplitUp_Exit;
} }
...@@ -1579,7 +1579,7 @@ static int dtSplitPage(tid_t tid, struct inode *ip, struct dtsplit * split, ...@@ -1579,7 +1579,7 @@ static int dtSplitPage(tid_t tid, struct inode *ip, struct dtsplit * split,
ip->i_blocks += LBLK2PBLK(sb, lengthPXD(pxd)); ip->i_blocks += LBLK2PBLK(sb, lengthPXD(pxd));
return 0; return rc;
} }
...@@ -2628,7 +2628,7 @@ static int dtSearchNode(struct inode *ip, s64 lmxaddr, pxd_t * kpxd, ...@@ -2628,7 +2628,7 @@ static int dtSearchNode(struct inode *ip, s64 lmxaddr, pxd_t * kpxd,
* descend down to leftmost child page * descend down to leftmost child page
*/ */
if (p->header.flag & BT_LEAF) if (p->header.flag & BT_LEAF)
return ESTALE; return -ESTALE;
/* get the leftmost entry */ /* get the leftmost entry */
stbl = DT_GETSTBL(p); stbl = DT_GETSTBL(p);
...@@ -2666,7 +2666,7 @@ static int dtSearchNode(struct inode *ip, s64 lmxaddr, pxd_t * kpxd, ...@@ -2666,7 +2666,7 @@ static int dtSearchNode(struct inode *ip, s64 lmxaddr, pxd_t * kpxd,
bn = le64_to_cpu(p->header.next); bn = le64_to_cpu(p->header.next);
else { else {
DT_PUTPAGE(mp); DT_PUTPAGE(mp);
return ESTALE; return -ESTALE;
} }
/* unpin current page */ /* unpin current page */
...@@ -2908,7 +2908,7 @@ static void add_missing_indices(struct inode *inode, s64 bn) ...@@ -2908,7 +2908,7 @@ static void add_missing_indices(struct inode *inode, s64 bn)
d->index = cpu_to_le32(add_index(tid, inode, bn, i)); d->index = cpu_to_le32(add_index(tid, inode, bn, i));
if (dtlck->index >= dtlck->maxcnt) if (dtlck->index >= dtlck->maxcnt)
dtlck = (struct dt_lock *) txLinelock(dtlck); dtlck = (struct dt_lock *) txLinelock(dtlck);
lv = dtlck->lv; lv = &dtlck->lv[dtlck->index];
lv->offset = stbl[i]; lv->offset = stbl[i];
lv->length = 1; lv->length = 1;
dtlck->index++; dtlck->index++;
...@@ -3068,7 +3068,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir) ...@@ -3068,7 +3068,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
} }
if ((rc = dtReadFirst(ip, &btstack))) if ((rc = dtReadFirst(ip, &btstack)))
return -rc; return rc;
DT_GETSEARCH(ip, btstack.top, bn, mp, p, index); DT_GETSEARCH(ip, btstack.top, bn, mp, p, index);
} }
...@@ -3268,7 +3268,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir) ...@@ -3268,7 +3268,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
DT_GETPAGE(ip, bn, mp, PSIZE, p, rc); DT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
if (rc) { if (rc) {
free_page(dirent_buf); free_page(dirent_buf);
return -rc; return rc;
} }
} }
...@@ -4434,8 +4434,8 @@ static void dtLinelockFreelist(dtpage_t * p, /* directory page */ ...@@ -4434,8 +4434,8 @@ static void dtLinelockFreelist(dtpage_t * p, /* directory page */
* flag - JFS_RENAME * flag - JFS_RENAME
* *
* RETURNS: * RETURNS:
* ESTALE - If entry found does not match orig_ino passed in * -ESTALE - If entry found does not match orig_ino passed in
* ENOENT - If no entry can be found to match key * -ENOENT - If no entry can be found to match key
* 0 - If successfully modified entry * 0 - If successfully modified entry
*/ */
int dtModify(tid_t tid, struct inode *ip, int dtModify(tid_t tid, struct inode *ip,
......
...@@ -83,8 +83,8 @@ extern int jfs_commit_inode(struct inode *, int); ...@@ -83,8 +83,8 @@ extern int jfs_commit_inode(struct inode *, int);
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success * 0 - success
* EIO - i/o error. * -EIO - i/o error.
* ENOSPC - insufficient disk resources. * -ENOSPC - insufficient disk resources.
*/ */
int int
extAlloc(struct inode *ip, s64 xlen, s64 pno, xad_t * xp, boolean_t abnr) extAlloc(struct inode *ip, s64 xlen, s64 pno, xad_t * xp, boolean_t abnr)
...@@ -207,8 +207,8 @@ extAlloc(struct inode *ip, s64 xlen, s64 pno, xad_t * xp, boolean_t abnr) ...@@ -207,8 +207,8 @@ extAlloc(struct inode *ip, s64 xlen, s64 pno, xad_t * xp, boolean_t abnr)
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success * 0 - success
* EIO - i/o error. * -EIO - i/o error.
* ENOSPC - insufficient disk resources. * -ENOSPC - insufficient disk resources.
*/ */
int extRealloc(struct inode *ip, s64 nxlen, xad_t * xp, boolean_t abnr) int extRealloc(struct inode *ip, s64 nxlen, xad_t * xp, boolean_t abnr)
{ {
...@@ -350,7 +350,7 @@ int extRealloc(struct inode *ip, s64 nxlen, xad_t * xp, boolean_t abnr) ...@@ -350,7 +350,7 @@ int extRealloc(struct inode *ip, s64 nxlen, xad_t * xp, boolean_t abnr)
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success * 0 - success
* EIO - i/o error. * -EIO - i/o error.
*/ */
int extHint(struct inode *ip, s64 offset, xad_t * xp) int extHint(struct inode *ip, s64 offset, xad_t * xp)
{ {
...@@ -421,8 +421,8 @@ int extHint(struct inode *ip, s64 offset, xad_t * xp) ...@@ -421,8 +421,8 @@ int extHint(struct inode *ip, s64 offset, xad_t * xp)
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success * 0 - success
* EIO - i/o error. * -EIO - i/o error.
* ENOSPC - insufficient disk resources. * -ENOSPC - insufficient disk resources.
*/ */
int extRecord(struct inode *ip, xad_t * xp) int extRecord(struct inode *ip, xad_t * xp)
{ {
...@@ -436,7 +436,7 @@ int extRecord(struct inode *ip, xad_t * xp) ...@@ -436,7 +436,7 @@ int extRecord(struct inode *ip, xad_t * xp)
rc = xtUpdate(0, ip, xp); rc = xtUpdate(0, ip, xp);
up(&JFS_IP(ip)->commit_sem); up(&JFS_IP(ip)->commit_sem);
return (rc); return rc;
} }
...@@ -453,8 +453,8 @@ int extRecord(struct inode *ip, xad_t * xp) ...@@ -453,8 +453,8 @@ int extRecord(struct inode *ip, xad_t * xp)
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success * 0 - success
* EIO - i/o error. * -EIO - i/o error.
* ENOSPC - insufficient disk resources. * -ENOSPC - insufficient disk resources.
*/ */
int extFill(struct inode *ip, xad_t * xp) int extFill(struct inode *ip, xad_t * xp)
{ {
...@@ -505,8 +505,8 @@ int extFill(struct inode *ip, xad_t * xp) ...@@ -505,8 +505,8 @@ int extFill(struct inode *ip, xad_t * xp)
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success * 0 - success
* EIO - i/o error. * -EIO - i/o error.
* ENOSPC - insufficient disk resources. * -ENOSPC - insufficient disk resources.
*/ */
static int static int
extBalloc(struct inode *ip, s64 hint, s64 * nblocks, s64 * blkno) extBalloc(struct inode *ip, s64 hint, s64 * nblocks, s64 * blkno)
...@@ -535,7 +535,7 @@ extBalloc(struct inode *ip, s64 hint, s64 * nblocks, s64 * blkno) ...@@ -535,7 +535,7 @@ extBalloc(struct inode *ip, s64 hint, s64 * nblocks, s64 * blkno)
/* if something other than an out of space error, /* if something other than an out of space error,
* stop and return this error. * stop and return this error.
*/ */
if (rc != ENOSPC) if (rc != -ENOSPC)
return (rc); return (rc);
/* decrease the allocation request size */ /* decrease the allocation request size */
...@@ -596,8 +596,8 @@ extBalloc(struct inode *ip, s64 hint, s64 * nblocks, s64 * blkno) ...@@ -596,8 +596,8 @@ extBalloc(struct inode *ip, s64 hint, s64 * nblocks, s64 * blkno)
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success * 0 - success
* EIO - i/o error. * -EIO - i/o error.
* ENOSPC - insufficient disk resources. * -ENOSPC - insufficient disk resources.
*/ */
static int static int
extBrealloc(struct inode *ip, extBrealloc(struct inode *ip,
...@@ -610,7 +610,7 @@ extBrealloc(struct inode *ip, ...@@ -610,7 +610,7 @@ extBrealloc(struct inode *ip,
*newblkno = blkno; *newblkno = blkno;
return (0); return (0);
} else { } else {
if (rc != ENOSPC) if (rc != -ENOSPC)
return (rc); return (rc);
} }
......
/* /*
* Copyright (c) International Business Machines Corp., 2000-2001 * Copyright (c) International Business Machines Corp., 2000-2003
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -29,6 +29,9 @@ ...@@ -29,6 +29,9 @@
/* /*
* file system option (superblock flag) * file system option (superblock flag)
*/ */
/* mount time flag to disable journaling to disk */
#define JFS_NOINTEGRITY 0x00000010
/* platform option (conditional compilation) */ /* platform option (conditional compilation) */
#define JFS_AIX 0x80000000 /* AIX support */ #define JFS_AIX 0x80000000 /* AIX support */
/* POSIX name/directory support */ /* POSIX name/directory support */
......
...@@ -121,8 +121,8 @@ static void DBGdiFree(struct inomap * imap, ino_t ino); ...@@ -121,8 +121,8 @@ static void DBGdiFree(struct inomap * imap, ino_t ino);
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success * 0 - success
* ENOMEM - insufficient free virtual memory. * -ENOMEM - insufficient free virtual memory.
* EIO - i/o error. * -EIO - i/o error.
*/ */
int diMount(struct inode *ipimap) int diMount(struct inode *ipimap)
{ {
...@@ -138,7 +138,7 @@ int diMount(struct inode *ipimap) ...@@ -138,7 +138,7 @@ int diMount(struct inode *ipimap)
imap = (struct inomap *) kmalloc(sizeof(struct inomap), GFP_KERNEL); imap = (struct inomap *) kmalloc(sizeof(struct inomap), GFP_KERNEL);
if (imap == NULL) { if (imap == NULL) {
jfs_err("diMount: kmalloc returned NULL!"); jfs_err("diMount: kmalloc returned NULL!");
return (ENOMEM); return -ENOMEM;
} }
/* read the on-disk inode map control structure. */ /* read the on-disk inode map control structure. */
...@@ -148,7 +148,7 @@ int diMount(struct inode *ipimap) ...@@ -148,7 +148,7 @@ int diMount(struct inode *ipimap)
PSIZE, 0); PSIZE, 0);
if (mp == NULL) { if (mp == NULL) {
kfree(imap); kfree(imap);
return (EIO); return -EIO;
} }
/* copy the on-disk version to the in-memory version. */ /* copy the on-disk version to the in-memory version. */
...@@ -207,8 +207,8 @@ int diMount(struct inode *ipimap) ...@@ -207,8 +207,8 @@ int diMount(struct inode *ipimap)
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success * 0 - success
* ENOMEM - insufficient free virtual memory. * -ENOMEM - insufficient free virtual memory.
* EIO - i/o error. * -EIO - i/o error.
*/ */
int diUnmount(struct inode *ipimap, int mounterror) int diUnmount(struct inode *ipimap, int mounterror)
{ {
...@@ -254,7 +254,7 @@ int diSync(struct inode *ipimap) ...@@ -254,7 +254,7 @@ int diSync(struct inode *ipimap)
PSIZE, 0); PSIZE, 0);
if (mp == NULL) { if (mp == NULL) {
jfs_err("diSync: get_metapage failed!"); jfs_err("diSync: get_metapage failed!");
return EIO; return -EIO;
} }
/* copy the in-memory version to the on-disk version */ /* copy the in-memory version to the on-disk version */
...@@ -320,8 +320,8 @@ int diSync(struct inode *ipimap) ...@@ -320,8 +320,8 @@ int diSync(struct inode *ipimap)
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success * 0 - success
* EIO - i/o error. * -EIO - i/o error.
* ENOMEM - insufficient memory * -ENOMEM - insufficient memory
* *
*/ */
int diRead(struct inode *ip) int diRead(struct inode *ip)
...@@ -366,7 +366,7 @@ int diRead(struct inode *ip) ...@@ -366,7 +366,7 @@ int diRead(struct inode *ip)
if ((lengthPXD(&iagp->inoext[extno]) != imap->im_nbperiext) || if ((lengthPXD(&iagp->inoext[extno]) != imap->im_nbperiext) ||
(addressPXD(&iagp->inoext[extno]) == 0)) { (addressPXD(&iagp->inoext[extno]) == 0)) {
release_metapage(mp); release_metapage(mp);
return ESTALE; return -ESTALE;
} }
/* get disk block number of the page within the inode extent /* get disk block number of the page within the inode extent
...@@ -401,7 +401,7 @@ int diRead(struct inode *ip) ...@@ -401,7 +401,7 @@ int diRead(struct inode *ip)
mp = read_metapage(ipimap, pageno << sbi->l2nbperpage, PSIZE, 1); mp = read_metapage(ipimap, pageno << sbi->l2nbperpage, PSIZE, 1);
if (mp == 0) { if (mp == 0) {
jfs_err("diRead: read_metapage failed"); jfs_err("diRead: read_metapage failed");
return EIO; return -EIO;
} }
/* locate the the disk inode requested */ /* locate the the disk inode requested */
...@@ -411,9 +411,9 @@ int diRead(struct inode *ip) ...@@ -411,9 +411,9 @@ int diRead(struct inode *ip)
if (ip->i_ino != le32_to_cpu(dp->di_number)) { if (ip->i_ino != le32_to_cpu(dp->di_number)) {
jfs_err("diRead: i_ino != di_number"); jfs_err("diRead: i_ino != di_number");
updateSuper(ip->i_sb, FM_DIRTY); updateSuper(ip->i_sb, FM_DIRTY);
rc = EIO; rc = -EIO;
} else if (le32_to_cpu(dp->di_nlink) == 0) } else if (le32_to_cpu(dp->di_nlink) == 0)
rc = ESTALE; rc = -ESTALE;
else else
/* copy the disk inode to the in-memory inode */ /* copy the disk inode to the in-memory inode */
rc = copy_from_dinode(dp, ip); rc = copy_from_dinode(dp, ip);
...@@ -612,7 +612,7 @@ void diFreeSpecial(struct inode *ip) ...@@ -612,7 +612,7 @@ void diFreeSpecial(struct inode *ip)
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success * 0 - success
* EIO - i/o error. * -EIO - i/o error.
*/ */
int diWrite(tid_t tid, struct inode *ip) int diWrite(tid_t tid, struct inode *ip)
{ {
...@@ -671,7 +671,7 @@ int diWrite(tid_t tid, struct inode *ip) ...@@ -671,7 +671,7 @@ int diWrite(tid_t tid, struct inode *ip)
retry: retry:
mp = read_metapage(ipimap, pageno << sbi->l2nbperpage, PSIZE, 1); mp = read_metapage(ipimap, pageno << sbi->l2nbperpage, PSIZE, 1);
if (mp == 0) if (mp == 0)
return (EIO); return -EIO;
/* get the pointer to the disk inode */ /* get the pointer to the disk inode */
dp = (struct dinode *) mp->data; dp = (struct dinode *) mp->data;
...@@ -885,7 +885,7 @@ int diWrite(tid_t tid, struct inode *ip) ...@@ -885,7 +885,7 @@ int diWrite(tid_t tid, struct inode *ip)
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success * 0 - success
* EIO - i/o error. * -EIO - i/o error.
*/ */
int diFree(struct inode *ip) int diFree(struct inode *ip)
{ {
...@@ -923,7 +923,7 @@ int diFree(struct inode *ip) ...@@ -923,7 +923,7 @@ int diFree(struct inode *ip)
(uint) inum, iagno, imap->im_nextiag); (uint) inum, iagno, imap->im_nextiag);
dump_mem("imap", imap, 32); dump_mem("imap", imap, 32);
updateSuper(ip->i_sb, FM_DIRTY); updateSuper(ip->i_sb, FM_DIRTY);
return EIO; return -EIO;
} }
/* get the allocation group for this ino. /* get the allocation group for this ino.
...@@ -972,7 +972,7 @@ int diFree(struct inode *ip) ...@@ -972,7 +972,7 @@ int diFree(struct inode *ip)
IREAD_UNLOCK(ipimap); IREAD_UNLOCK(ipimap);
AG_UNLOCK(imap, agno); AG_UNLOCK(imap, agno);
updateSuper(ip->i_sb, FM_DIRTY); updateSuper(ip->i_sb, FM_DIRTY);
return EIO; return -EIO;
} }
/* /*
* inode extent still has some inodes or below low water mark: * inode extent still has some inodes or below low water mark:
...@@ -1362,8 +1362,8 @@ diInitInode(struct inode *ip, int iagno, int ino, int extno, struct iag * iagp) ...@@ -1362,8 +1362,8 @@ diInitInode(struct inode *ip, int iagno, int ino, int extno, struct iag * iagp)
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success. * 0 - success.
* ENOSPC - insufficient disk resources. * -ENOSPC - insufficient disk resources.
* EIO - i/o error. * -EIO - i/o error.
*/ */
int diAlloc(struct inode *pip, boolean_t dir, struct inode *ip) int diAlloc(struct inode *pip, boolean_t dir, struct inode *ip)
{ {
...@@ -1471,7 +1471,7 @@ int diAlloc(struct inode *pip, boolean_t dir, struct inode *ip) ...@@ -1471,7 +1471,7 @@ int diAlloc(struct inode *pip, boolean_t dir, struct inode *ip)
rc = diAllocBit(imap, iagp, ino); rc = diAllocBit(imap, iagp, ino);
IREAD_UNLOCK(ipimap); IREAD_UNLOCK(ipimap);
if (rc) { if (rc) {
assert(rc == EIO); assert(rc == -EIO);
} else { } else {
/* set the results of the allocation /* set the results of the allocation
* and write the iag. * and write the iag.
...@@ -1548,7 +1548,7 @@ int diAlloc(struct inode *pip, boolean_t dir, struct inode *ip) ...@@ -1548,7 +1548,7 @@ int diAlloc(struct inode *pip, boolean_t dir, struct inode *ip)
rc = diAllocBit(imap, iagp, ino); rc = diAllocBit(imap, iagp, ino);
IREAD_UNLOCK(ipimap); IREAD_UNLOCK(ipimap);
if (rc) { if (rc) {
assert(rc == EIO); assert(rc == -EIO);
} else { } else {
/* set the results of the allocation /* set the results of the allocation
* and write the iag. * and write the iag.
...@@ -1584,10 +1584,10 @@ int diAlloc(struct inode *pip, boolean_t dir, struct inode *ip) ...@@ -1584,10 +1584,10 @@ int diAlloc(struct inode *pip, boolean_t dir, struct inode *ip)
* new extent, try to allocate the * new extent, try to allocate the
* disk inode from somewhere else. * disk inode from somewhere else.
*/ */
if (rc == ENOSPC) if (rc == -ENOSPC)
break; break;
assert(rc == EIO); assert(rc == -EIO);
} else { } else {
/* set the results of the allocation /* set the results of the allocation
* and write the iag. * and write the iag.
...@@ -1626,7 +1626,7 @@ int diAlloc(struct inode *pip, boolean_t dir, struct inode *ip) ...@@ -1626,7 +1626,7 @@ int diAlloc(struct inode *pip, boolean_t dir, struct inode *ip)
AG_UNLOCK(imap, agno); AG_UNLOCK(imap, agno);
if (rc != ENOSPC) if (rc != -ENOSPC)
return (rc); return (rc);
/* /*
...@@ -1662,8 +1662,8 @@ int diAlloc(struct inode *pip, boolean_t dir, struct inode *ip) ...@@ -1662,8 +1662,8 @@ int diAlloc(struct inode *pip, boolean_t dir, struct inode *ip)
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success. * 0 - success.
* ENOSPC - insufficient disk resources. * -ENOSPC - insufficient disk resources.
* EIO - i/o error. * -EIO - i/o error.
*/ */
static int static int
diAllocAG(struct inomap * imap, int agno, boolean_t dir, struct inode *ip) diAllocAG(struct inomap * imap, int agno, boolean_t dir, struct inode *ip)
...@@ -1679,7 +1679,7 @@ diAllocAG(struct inomap * imap, int agno, boolean_t dir, struct inode *ip) ...@@ -1679,7 +1679,7 @@ diAllocAG(struct inomap * imap, int agno, boolean_t dir, struct inode *ip)
if (numfree > numinos) { if (numfree > numinos) {
jfs_err("diAllocAG: numfree > numinos"); jfs_err("diAllocAG: numfree > numinos");
updateSuper(ip->i_sb, FM_DIRTY); updateSuper(ip->i_sb, FM_DIRTY);
return EIO; return -EIO;
} }
/* determine if we should allocate a new extent of free inodes /* determine if we should allocate a new extent of free inodes
...@@ -1702,7 +1702,7 @@ diAllocAG(struct inomap * imap, int agno, boolean_t dir, struct inode *ip) ...@@ -1702,7 +1702,7 @@ diAllocAG(struct inomap * imap, int agno, boolean_t dir, struct inode *ip)
* below to allocate a free and existing (already backed) * below to allocate a free and existing (already backed)
* inode from the ag. * inode from the ag.
*/ */
if ((rc = diAllocExt(imap, agno, ip)) != ENOSPC) if ((rc = diAllocExt(imap, agno, ip)) != -ENOSPC)
return (rc); return (rc);
} }
...@@ -1733,8 +1733,8 @@ diAllocAG(struct inomap * imap, int agno, boolean_t dir, struct inode *ip) ...@@ -1733,8 +1733,8 @@ diAllocAG(struct inomap * imap, int agno, boolean_t dir, struct inode *ip)
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success. * 0 - success.
* ENOSPC - insufficient disk resources. * -ENOSPC - insufficient disk resources.
* EIO - i/o error. * -EIO - i/o error.
*/ */
static int static int
diAllocAny(struct inomap * imap, int agno, boolean_t dir, struct inode *ip) diAllocAny(struct inomap * imap, int agno, boolean_t dir, struct inode *ip)
...@@ -1753,7 +1753,7 @@ diAllocAny(struct inomap * imap, int agno, boolean_t dir, struct inode *ip) ...@@ -1753,7 +1753,7 @@ diAllocAny(struct inomap * imap, int agno, boolean_t dir, struct inode *ip)
AG_UNLOCK(imap, ag); AG_UNLOCK(imap, ag);
if (rc != ENOSPC) if (rc != -ENOSPC)
return (rc); return (rc);
} }
...@@ -1766,13 +1766,13 @@ diAllocAny(struct inomap * imap, int agno, boolean_t dir, struct inode *ip) ...@@ -1766,13 +1766,13 @@ diAllocAny(struct inomap * imap, int agno, boolean_t dir, struct inode *ip)
AG_UNLOCK(imap, ag); AG_UNLOCK(imap, ag);
if (rc != ENOSPC) if (rc != -ENOSPC)
return (rc); return (rc);
} }
/* no free disk inodes. /* no free disk inodes.
*/ */
return (ENOSPC); return -ENOSPC;
} }
...@@ -1798,8 +1798,8 @@ diAllocAny(struct inomap * imap, int agno, boolean_t dir, struct inode *ip) ...@@ -1798,8 +1798,8 @@ diAllocAny(struct inomap * imap, int agno, boolean_t dir, struct inode *ip)
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success. * 0 - success.
* ENOSPC - insufficient disk resources. * -ENOSPC - insufficient disk resources.
* EIO - i/o error. * -EIO - i/o error.
*/ */
static int diAllocIno(struct inomap * imap, int agno, struct inode *ip) static int diAllocIno(struct inomap * imap, int agno, struct inode *ip)
{ {
...@@ -1810,7 +1810,7 @@ static int diAllocIno(struct inomap * imap, int agno, struct inode *ip) ...@@ -1810,7 +1810,7 @@ static int diAllocIno(struct inomap * imap, int agno, struct inode *ip)
/* check if there are iags on the ag's free inode list. /* check if there are iags on the ag's free inode list.
*/ */
if ((iagno = imap->im_agctl[agno].inofree) < 0) if ((iagno = imap->im_agctl[agno].inofree) < 0)
return (ENOSPC); return -ENOSPC;
/* obtain read lock on imap inode */ /* obtain read lock on imap inode */
IREAD_LOCK(imap->im_ipimap); IREAD_LOCK(imap->im_ipimap);
...@@ -1832,7 +1832,7 @@ static int diAllocIno(struct inomap * imap, int agno, struct inode *ip) ...@@ -1832,7 +1832,7 @@ static int diAllocIno(struct inomap * imap, int agno, struct inode *ip)
jfs_err(" agno = %d, iagno = %d", agno, iagno); jfs_err(" agno = %d, iagno = %d", agno, iagno);
dump_mem("iag", iagp, 64); dump_mem("iag", iagp, 64);
updateSuper(ip->i_sb, FM_DIRTY); updateSuper(ip->i_sb, FM_DIRTY);
return EIO; return -EIO;
} }
/* scan the free inode summary map to find an extent /* scan the free inode summary map to find an extent
...@@ -1908,8 +1908,8 @@ static int diAllocIno(struct inomap * imap, int agno, struct inode *ip) ...@@ -1908,8 +1908,8 @@ static int diAllocIno(struct inomap * imap, int agno, struct inode *ip)
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success. * 0 - success.
* ENOSPC - insufficient disk resources. * -ENOSPC - insufficient disk resources.
* EIO - i/o error. * -EIO - i/o error.
*/ */
static int diAllocExt(struct inomap * imap, int agno, struct inode *ip) static int diAllocExt(struct inomap * imap, int agno, struct inode *ip)
{ {
...@@ -2013,8 +2013,8 @@ static int diAllocExt(struct inomap * imap, int agno, struct inode *ip) ...@@ -2013,8 +2013,8 @@ static int diAllocExt(struct inomap * imap, int agno, struct inode *ip)
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success. * 0 - success.
* ENOSPC - insufficient disk resources. * -ENOSPC - insufficient disk resources.
* EIO - i/o error. * -EIO - i/o error.
*/ */
static int diAllocBit(struct inomap * imap, struct iag * iagp, int ino) static int diAllocBit(struct inomap * imap, struct iag * iagp, int ino)
{ {
...@@ -2153,8 +2153,8 @@ static int diAllocBit(struct inomap * imap, struct iag * iagp, int ino) ...@@ -2153,8 +2153,8 @@ static int diAllocBit(struct inomap * imap, struct iag * iagp, int ino)
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success. * 0 - success.
* ENOSPC - insufficient disk resources. * -ENOSPC - insufficient disk resources.
* EIO - i/o error. * -EIO - i/o error.
*/ */
static int diNewExt(struct inomap * imap, struct iag * iagp, int extno) static int diNewExt(struct inomap * imap, struct iag * iagp, int extno)
{ {
...@@ -2267,7 +2267,7 @@ static int diNewExt(struct inomap * imap, struct iag * iagp, int extno) ...@@ -2267,7 +2267,7 @@ static int diNewExt(struct inomap * imap, struct iag * iagp, int extno)
*/ */
dmp = get_metapage(ipimap, blkno + i, PSIZE, 1); dmp = get_metapage(ipimap, blkno + i, PSIZE, 1);
if (dmp == NULL) { if (dmp == NULL) {
rc = EIO; rc = -EIO;
goto error_out; goto error_out;
} }
dp = (struct dinode *) dmp->data; dp = (struct dinode *) dmp->data;
...@@ -2413,8 +2413,8 @@ static int diNewExt(struct inomap * imap, struct iag * iagp, int extno) ...@@ -2413,8 +2413,8 @@ static int diNewExt(struct inomap * imap, struct iag * iagp, int extno)
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success. * 0 - success.
* ENOSPC - insufficient disk resources. * -ENOSPC - insufficient disk resources.
* EIO - i/o error. * -EIO - i/o error.
* *
* serialization: * serialization:
* AG lock held on entry/exit; * AG lock held on entry/exit;
...@@ -2485,7 +2485,7 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp) ...@@ -2485,7 +2485,7 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp)
/* release the inode map lock */ /* release the inode map lock */
IWRITE_UNLOCK(ipimap); IWRITE_UNLOCK(ipimap);
rc = ENOSPC; rc = -ENOSPC;
goto out; goto out;
} }
...@@ -2516,7 +2516,7 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp) ...@@ -2516,7 +2516,7 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp)
/* release the inode map lock */ /* release the inode map lock */
IWRITE_UNLOCK(ipimap); IWRITE_UNLOCK(ipimap);
rc = EIO; rc = -EIO;
goto out; goto out;
} }
iagp = (struct iag *) mp->data; iagp = (struct iag *) mp->data;
...@@ -2548,7 +2548,7 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp) ...@@ -2548,7 +2548,7 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp)
/* release the inode map lock */ /* release the inode map lock */
IWRITE_UNLOCK(ipimap); IWRITE_UNLOCK(ipimap);
rc = EIO; rc = -EIO;
goto out; goto out;
} }
...@@ -2614,7 +2614,7 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp) ...@@ -2614,7 +2614,7 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp)
/* read the iag */ /* read the iag */
if ((rc = diIAGRead(imap, iagno, &mp))) { if ((rc = diIAGRead(imap, iagno, &mp))) {
IREAD_UNLOCK(ipimap); IREAD_UNLOCK(ipimap);
rc = EIO; rc = -EIO;
goto out; goto out;
} }
iagp = (struct iag *) mp->data; iagp = (struct iag *) mp->data;
...@@ -2653,7 +2653,7 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp) ...@@ -2653,7 +2653,7 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp)
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success. * 0 - success.
* EIO - i/o error. * -EIO - i/o error.
*/ */
static int diIAGRead(struct inomap * imap, int iagno, struct metapage ** mpp) static int diIAGRead(struct inomap * imap, int iagno, struct metapage ** mpp)
{ {
...@@ -2666,7 +2666,7 @@ static int diIAGRead(struct inomap * imap, int iagno, struct metapage ** mpp) ...@@ -2666,7 +2666,7 @@ static int diIAGRead(struct inomap * imap, int iagno, struct metapage ** mpp)
/* read the iag. */ /* read the iag. */
*mpp = read_metapage(ipimap, blkno, PSIZE, 0); *mpp = read_metapage(ipimap, blkno, PSIZE, 0);
if (*mpp == NULL) { if (*mpp == NULL) {
return (EIO); return -EIO;
} }
return (0); return (0);
...@@ -2713,7 +2713,8 @@ static int diFindFree(u32 word, int start) ...@@ -2713,7 +2713,8 @@ static int diFindFree(u32 word, int start)
* is_free - If TRUE indicates inode should be marked freed, otherwise * is_free - If TRUE indicates inode should be marked freed, otherwise
* indicates inode should be marked allocated. * indicates inode should be marked allocated.
* *
* RETURNS: 0 for success * RETURN VALUES:
* 0 for success
*/ */
int int
diUpdatePMap(struct inode *ipimap, diUpdatePMap(struct inode *ipimap,
...@@ -3009,7 +3010,7 @@ static void duplicateIXtree(struct super_block *sb, s64 blkno, ...@@ -3009,7 +3010,7 @@ static void duplicateIXtree(struct super_block *sb, s64 blkno,
* *
* RETURN VALUES: * RETURN VALUES:
* 0 - success * 0 - success
* ENOMEM - insufficient memory * -ENOMEM - insufficient memory
*/ */
static int copy_from_dinode(struct dinode * dip, struct inode *ip) static int copy_from_dinode(struct dinode * dip, struct inode *ip)
{ {
......
/* /*
* Copyright (c) International Business Machines Corp., 2000-2002 * Copyright (c) International Business Machines Corp., 2000-2003
* Portions Copyright (c) Christoph Hellwig, 2001-2002 * Portions Copyright (c) Christoph Hellwig, 2001-2002
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -130,32 +130,34 @@ enum cflags { ...@@ -130,32 +130,34 @@ enum cflags {
* JFS-private superblock information. * JFS-private superblock information.
*/ */
struct jfs_sb_info { struct jfs_sb_info {
unsigned long mntflag; /* 4: aggregate attributes */ unsigned long mntflag; /* aggregate attributes */
struct inode *ipbmap; /* 4: block map inode */ struct inode *ipbmap; /* block map inode */
struct inode *ipaimap; /* 4: aggregate inode map inode */ struct inode *ipaimap; /* aggregate inode map inode */
struct inode *ipaimap2; /* 4: secondary aimap inode */ struct inode *ipaimap2; /* secondary aimap inode */
struct inode *ipimap; /* 4: aggregate inode map inode */ struct inode *ipimap; /* aggregate inode map inode */
struct jfs_log *log; /* 4: log */ struct jfs_log *log; /* log */
short bsize; /* 2: logical block size */ short bsize; /* logical block size */
short l2bsize; /* 2: log2 logical block size */ short l2bsize; /* log2 logical block size */
short nbperpage; /* 2: blocks per page */ short nbperpage; /* blocks per page */
short l2nbperpage; /* 2: log2 blocks per page */ short l2nbperpage; /* log2 blocks per page */
short l2niperblk; /* 2: log2 inodes per page */ short l2niperblk; /* log2 inodes per page */
u32 logdev; /* 2: external log device */ u32 logdev; /* external log device */
uint aggregate; /* volume identifier in log record */ uint aggregate; /* volume identifier in log record */
pxd_t logpxd; /* 8: pxd describing log */ pxd_t logpxd; /* pxd describing log */
pxd_t fsckpxd; /* 8: pxd describing fsck wkspc */ pxd_t fsckpxd; /* pxd describing fsck wkspc */
pxd_t ait2; /* 8: pxd describing AIT copy */ pxd_t ait2; /* pxd describing AIT copy */
char uuid[16]; /* 16: 128-bit uuid for volume */ char uuid[16]; /* 128-bit uuid for volume */
char loguuid[16]; /* 16: 128-bit uuid for log */ char loguuid[16]; /* 128-bit uuid for log */
/* Formerly in ipimap */ /* Formerly in ipimap */
uint gengen; /* 4: inode generation generator*/ uint gengen; /* inode generation generator*/
uint inostamp; /* 4: shows inode belongs to fileset*/ uint inostamp; /* shows inode belongs to fileset*/
/* Formerly in ipbmap */ /* Formerly in ipbmap */
struct bmap *bmap; /* 4: incore bmap descriptor */ struct bmap *bmap; /* incore bmap descriptor */
struct nls_table *nls_tab; /* 4: current codepage */ struct nls_table *nls_tab; /* current codepage */
uint state; /* 4: mount/recovery state */ uint state; /* mount/recovery state */
unsigned long flag; /* mount time flags */
uint p_state; /* state prior to going no integrity */
}; };
static inline struct jfs_inode_info *JFS_IP(struct inode *inode) static inline struct jfs_inode_info *JFS_IP(struct inode *inode)
......
/* /*
* Copyright (c) International Business Machines Corp., 2000-2002 * Copyright (c) International Business Machines Corp., 2000-2003
* Portions Copyright (c) Christoph Hellwig, 2001-2002 * Portions Copyright (c) Christoph Hellwig, 2001-2002
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -667,7 +667,7 @@ int lmGroupCommit(struct jfs_log * log, struct tblock * tblk) ...@@ -667,7 +667,7 @@ int lmGroupCommit(struct jfs_log * log, struct tblock * tblk)
/* group committed already ? */ /* group committed already ? */
if (tblk->flag & tblkGC_COMMITTED) { if (tblk->flag & tblkGC_COMMITTED) {
if (tblk->flag & tblkGC_ERROR) if (tblk->flag & tblkGC_ERROR)
rc = EIO; rc = -EIO;
LOGGC_UNLOCK(log); LOGGC_UNLOCK(log);
return rc; return rc;
...@@ -701,7 +701,7 @@ int lmGroupCommit(struct jfs_log * log, struct tblock * tblk) ...@@ -701,7 +701,7 @@ int lmGroupCommit(struct jfs_log * log, struct tblock * tblk)
if (tblk->flag & tblkGC_COMMITTED) { if (tblk->flag & tblkGC_COMMITTED) {
if (tblk->flag & tblkGC_ERROR) if (tblk->flag & tblkGC_ERROR)
rc = EIO; rc = -EIO;
LOGGC_UNLOCK(log); LOGGC_UNLOCK(log);
return rc; return rc;
...@@ -717,7 +717,7 @@ int lmGroupCommit(struct jfs_log * log, struct tblock * tblk) ...@@ -717,7 +717,7 @@ int lmGroupCommit(struct jfs_log * log, struct tblock * tblk)
/* removed from commit queue */ /* removed from commit queue */
if (tblk->flag & tblkGC_ERROR) if (tblk->flag & tblkGC_ERROR)
rc = EIO; rc = -EIO;
LOGGC_UNLOCK(log); LOGGC_UNLOCK(log);
return rc; return rc;
...@@ -1068,7 +1068,7 @@ int lmLogOpen(struct super_block *sb, struct jfs_log ** logptr) ...@@ -1068,7 +1068,7 @@ int lmLogOpen(struct super_block *sb, struct jfs_log ** logptr)
struct jfs_log *log; struct jfs_log *log;
if (!(log = kmalloc(sizeof(struct jfs_log), GFP_KERNEL))) if (!(log = kmalloc(sizeof(struct jfs_log), GFP_KERNEL)))
return ENOMEM; return -ENOMEM;
memset(log, 0, sizeof(struct jfs_log)); memset(log, 0, sizeof(struct jfs_log));
init_waitqueue_head(&log->syncwait); init_waitqueue_head(&log->syncwait);
...@@ -1113,7 +1113,6 @@ int lmLogOpen(struct super_block *sb, struct jfs_log ** logptr) ...@@ -1113,7 +1113,6 @@ int lmLogOpen(struct super_block *sb, struct jfs_log ** logptr)
} }
if ((rc = bd_claim(bdev, log))) { if ((rc = bd_claim(bdev, log))) {
rc = -rc;
goto close; goto close;
} }
...@@ -1169,7 +1168,7 @@ int lmLogOpen(struct super_block *sb, struct jfs_log ** logptr) ...@@ -1169,7 +1168,7 @@ int lmLogOpen(struct super_block *sb, struct jfs_log ** logptr)
* PARAMETER: log - log structure * PARAMETER: log - log structure
* *
* RETURN: 0 - if ok * RETURN: 0 - if ok
* EINVAL - bad log magic number or superblock dirty * -EINVAL - bad log magic number or superblock dirty
* error returned from logwait() * error returned from logwait()
* *
* serialization: single first open thread * serialization: single first open thread
...@@ -1209,21 +1208,21 @@ int lmLogInit(struct jfs_log * log) ...@@ -1209,21 +1208,21 @@ int lmLogInit(struct jfs_log * log)
if (logsuper->magic != cpu_to_le32(LOGMAGIC)) { if (logsuper->magic != cpu_to_le32(LOGMAGIC)) {
jfs_warn("*** Log Format Error ! ***"); jfs_warn("*** Log Format Error ! ***");
rc = EINVAL; rc = -EINVAL;
goto errout20; goto errout20;
} }
/* logredo() should have been run successfully. */ /* logredo() should have been run successfully. */
if (logsuper->state != cpu_to_le32(LOGREDONE)) { if (logsuper->state != cpu_to_le32(LOGREDONE)) {
jfs_warn("*** Log Is Dirty ! ***"); jfs_warn("*** Log Is Dirty ! ***");
rc = EINVAL; rc = -EINVAL;
goto errout20; goto errout20;
} }
/* initialize log inode from log superblock */ /* initialize log inode from log superblock */
if (test_bit(log_INLINELOG,&log->flag)) { if (test_bit(log_INLINELOG,&log->flag)) {
if (log->size != le32_to_cpu(logsuper->size)) { if (log->size != le32_to_cpu(logsuper->size)) {
rc = EINVAL; rc = -EINVAL;
goto errout20; goto errout20;
} }
jfs_info("lmLogInit: inline log:0x%p base:0x%Lx size:0x%x", jfs_info("lmLogInit: inline log:0x%p base:0x%Lx size:0x%x",
...@@ -1242,6 +1241,15 @@ int lmLogInit(struct jfs_log * log) ...@@ -1242,6 +1241,15 @@ int lmLogInit(struct jfs_log * log)
log->page = le32_to_cpu(logsuper->end) / LOGPSIZE; log->page = le32_to_cpu(logsuper->end) / LOGPSIZE;
log->eor = le32_to_cpu(logsuper->end) - (LOGPSIZE * log->page); log->eor = le32_to_cpu(logsuper->end) - (LOGPSIZE * log->page);
/* check for disabled journaling to disk */
if (JFS_SBI(log->sb)->flag & JFS_NOINTEGRITY) {
log->no_integrity = 1;
log->ni_page = log->page;
log->ni_eor = log->eor;
}
else
log->no_integrity = 0;
/* /*
* initialize for log append write mode * initialize for log append write mode
*/ */
...@@ -1525,6 +1533,14 @@ int lmLogShutdown(struct jfs_log * log) ...@@ -1525,6 +1533,14 @@ int lmLogShutdown(struct jfs_log * log)
lrd.type = cpu_to_le16(LOG_SYNCPT); lrd.type = cpu_to_le16(LOG_SYNCPT);
lrd.length = 0; lrd.length = 0;
lrd.log.syncpt.sync = 0; lrd.log.syncpt.sync = 0;
/* check for disabled journaling to disk */
if (JFS_SBI(log->sb)->flag & JFS_NOINTEGRITY) {
log->no_integrity = 0;
log->page = log->ni_page;
log->eor = log->ni_eor;
}
lsn = lmWriteRecord(log, NULL, &lrd, NULL); lsn = lmWriteRecord(log, NULL, &lrd, NULL);
bp = log->bp; bp = log->bp;
lp = (struct logpage *) bp->l_ldata; lp = (struct logpage *) bp->l_ldata;
...@@ -1610,7 +1626,7 @@ static int lmLogFileSystem(struct jfs_log * log, char *uuid, int activate) ...@@ -1610,7 +1626,7 @@ static int lmLogFileSystem(struct jfs_log * log, char *uuid, int activate)
if (i == MAX_ACTIVE) { if (i == MAX_ACTIVE) {
jfs_warn("Somebody stomped on the journal!"); jfs_warn("Somebody stomped on the journal!");
lbmFree(bpsuper); lbmFree(bpsuper);
return EIO; return -EIO;
} }
} }
...@@ -1698,7 +1714,7 @@ static int lbmLogInit(struct jfs_log * log) ...@@ -1698,7 +1714,7 @@ static int lbmLogInit(struct jfs_log * log)
error: error:
lbmLogShutdown(log); lbmLogShutdown(log);
return (ENOMEM); return -ENOMEM;
} }
...@@ -1986,10 +2002,18 @@ static void lbmStartIO(struct lbuf * bp) ...@@ -1986,10 +2002,18 @@ static void lbmStartIO(struct lbuf * bp)
bio->bi_end_io = lbmIODone; bio->bi_end_io = lbmIODone;
bio->bi_private = bp; bio->bi_private = bp;
submit_bio(WRITE, bio); /* check if journaling to disk has been disabled */
if (!log->no_integrity) {
INCREMENT(lmStat.submitted); submit_bio(WRITE, bio);
blk_run_queues(); INCREMENT(lmStat.submitted);
blk_run_queues();
}
else {
bio->bi_size = 0;
lbmIODone(bio, 0, 0); /* 2nd argument appears to not be used => 0
* 3rd argument appears to not be used => 0
*/
}
} }
...@@ -2007,7 +2031,7 @@ static int lbmIOWait(struct lbuf * bp, int flag) ...@@ -2007,7 +2031,7 @@ static int lbmIOWait(struct lbuf * bp, int flag)
LCACHE_SLEEP_COND(bp->l_ioevent, (bp->l_flag & lbmDONE), flags); LCACHE_SLEEP_COND(bp->l_ioevent, (bp->l_flag & lbmDONE), flags);
rc = (bp->l_flag & lbmERROR) ? EIO : 0; rc = (bp->l_flag & lbmERROR) ? -EIO : 0;
if (flag & lbmFREE) if (flag & lbmFREE)
lbmfree(bp); lbmfree(bp);
......
/* /*
* Copyright (c) International Business Machines Corp., 2000-2002 * Copyright (c) International Business Machines Corp., 2000-2003
* Portions Copyright (c) Christoph Hellwig, 2001-2002 * Portions Copyright (c) Christoph Hellwig, 2001-2002
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -417,6 +417,10 @@ struct jfs_log { ...@@ -417,6 +417,10 @@ struct jfs_log {
struct lbuf *wqueue; /* 4: log pageout queue */ struct lbuf *wqueue; /* 4: log pageout queue */
int count; /* 4: count */ int count; /* 4: count */
char uuid[16]; /* 16: 128-bit uuid of log device */ char uuid[16]; /* 16: 128-bit uuid of log device */
int no_integrity; /* 3: flag to disable journaling to disk */
int ni_page; /* 4: backup of page for nointegrity option */
int ni_eor; /* 4: backup of eor for nointegrity option */
}; };
/* /*
......
/* /*
* Copyright (c) International Business Machines Corp., 2000-2002 * Copyright (c) International Business Machines Corp., 2000-2003
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -72,11 +72,11 @@ static int logMOUNT(struct super_block *sb); ...@@ -72,11 +72,11 @@ static int logMOUNT(struct super_block *sb);
* *
* PARAMETER: sb - super block * PARAMETER: sb - super block
* *
* RETURN: EBUSY - device already mounted or open for write * RETURN: -EBUSY - device already mounted or open for write
* EBUSY - cvrdvp already mounted; * -EBUSY - cvrdvp already mounted;
* EBUSY - mount table full * -EBUSY - mount table full
* ENOTDIR - cvrdvp not directory on a device mount * -ENOTDIR- cvrdvp not directory on a device mount
* ENXIO - device open failure * -ENXIO - device open failure
*/ */
int jfs_mount(struct super_block *sb) int jfs_mount(struct super_block *sb)
{ {
...@@ -98,7 +98,7 @@ int jfs_mount(struct super_block *sb) ...@@ -98,7 +98,7 @@ int jfs_mount(struct super_block *sb)
ipaimap = diReadSpecial(sb, AGGREGATE_I, 0); ipaimap = diReadSpecial(sb, AGGREGATE_I, 0);
if (ipaimap == NULL) { if (ipaimap == NULL) {
jfs_err("jfs_mount: Faild to read AGGREGATE_I"); jfs_err("jfs_mount: Faild to read AGGREGATE_I");
rc = EIO; rc = -EIO;
goto errout20; goto errout20;
} }
sbi->ipaimap = ipaimap; sbi->ipaimap = ipaimap;
...@@ -118,7 +118,7 @@ int jfs_mount(struct super_block *sb) ...@@ -118,7 +118,7 @@ int jfs_mount(struct super_block *sb)
*/ */
ipbmap = diReadSpecial(sb, BMAP_I, 0); ipbmap = diReadSpecial(sb, BMAP_I, 0);
if (ipbmap == NULL) { if (ipbmap == NULL) {
rc = EIO; rc = -EIO;
goto errout22; goto errout22;
} }
...@@ -149,7 +149,7 @@ int jfs_mount(struct super_block *sb) ...@@ -149,7 +149,7 @@ int jfs_mount(struct super_block *sb)
ipaimap2 = diReadSpecial(sb, AGGREGATE_I, 1); ipaimap2 = diReadSpecial(sb, AGGREGATE_I, 1);
if (ipaimap2 == 0) { if (ipaimap2 == 0) {
jfs_err("jfs_mount: Faild to read AGGREGATE_I"); jfs_err("jfs_mount: Faild to read AGGREGATE_I");
rc = EIO; rc = -EIO;
goto errout35; goto errout35;
} }
sbi->ipaimap2 = ipaimap2; sbi->ipaimap2 = ipaimap2;
...@@ -178,7 +178,7 @@ int jfs_mount(struct super_block *sb) ...@@ -178,7 +178,7 @@ int jfs_mount(struct super_block *sb)
if (ipimap == NULL) { if (ipimap == NULL) {
jfs_err("jfs_mount: Failed to read FILESYSTEM_I"); jfs_err("jfs_mount: Failed to read FILESYSTEM_I");
/* open fileset secondary inode allocation map */ /* open fileset secondary inode allocation map */
rc = EIO; rc = -EIO;
goto errout40; goto errout40;
} }
jfs_info("jfs_mount: ipimap:0x%p", ipimap); jfs_info("jfs_mount: ipimap:0x%p", ipimap);
...@@ -327,8 +327,7 @@ static int chkSuper(struct super_block *sb) ...@@ -327,8 +327,7 @@ static int chkSuper(struct super_block *sb)
/* validate fs signature */ /* validate fs signature */
if (strncmp(j_sb->s_magic, JFS_MAGIC, 4) || if (strncmp(j_sb->s_magic, JFS_MAGIC, 4) ||
j_sb->s_version > cpu_to_le32(JFS_VERSION)) { j_sb->s_version > cpu_to_le32(JFS_VERSION)) {
//rc = EFORMAT; rc = -EINVAL;
rc = EINVAL;
goto out; goto out;
} }
...@@ -336,7 +335,7 @@ static int chkSuper(struct super_block *sb) ...@@ -336,7 +335,7 @@ static int chkSuper(struct super_block *sb)
#ifdef _JFS_4K #ifdef _JFS_4K
if (bsize != PSIZE) { if (bsize != PSIZE) {
jfs_err("Currently only 4K block size supported!"); jfs_err("Currently only 4K block size supported!");
rc = EINVAL; rc = -EINVAL;
goto out; goto out;
} }
#endif /* _JFS_4K */ #endif /* _JFS_4K */
...@@ -372,7 +371,7 @@ static int chkSuper(struct super_block *sb) ...@@ -372,7 +371,7 @@ static int chkSuper(struct super_block *sb)
if (j_sb->s_state != cpu_to_le32(FM_CLEAN) && if (j_sb->s_state != cpu_to_le32(FM_CLEAN) &&
!(sb->s_flags & MS_RDONLY)) { !(sb->s_flags & MS_RDONLY)) {
jfs_err("jfs_mount: Mount Failure: File System Dirty."); jfs_err("jfs_mount: Mount Failure: File System Dirty.");
rc = EINVAL; rc = -EINVAL;
goto out; goto out;
} }
...@@ -421,12 +420,20 @@ int updateSuper(struct super_block *sb, uint state) ...@@ -421,12 +420,20 @@ int updateSuper(struct super_block *sb, uint state)
struct buffer_head *bh; struct buffer_head *bh;
int rc; int rc;
/* if (sbi->flag & JFS_NOINTEGRITY) {
* Only fsck can fix dirty state if (state == FM_DIRTY) {
*/ sbi->p_state = state;
if (sbi->state == FM_DIRTY) return 0;
} else if (state == FM_MOUNT) {
sbi->p_state = sbi->state;
state = FM_DIRTY;
} else if (state == FM_CLEAN) {
state = sbi->p_state;
} else
jfs_err("updateSuper: bad state");
} else if (sbi->state == FM_DIRTY)
return 0; return 0;
if ((rc = readSuper(sb, &bh))) if ((rc = readSuper(sb, &bh)))
return rc; return rc;
......
/* /*
* Copyright (c) International Business Machines Corp., 2000-2002 * Copyright (c) International Business Machines Corp., 2000-2003
* Portions Copyright (c) Christoph Hellwig, 2001-2002 * Portions Copyright (c) Christoph Hellwig, 2001-2002
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -257,7 +257,7 @@ int txInit(void) ...@@ -257,7 +257,7 @@ int txInit(void)
size = sizeof(struct tblock) * nTxBlock; size = sizeof(struct tblock) * nTxBlock;
TxBlock = (struct tblock *) vmalloc(size); TxBlock = (struct tblock *) vmalloc(size);
if (TxBlock == NULL) if (TxBlock == NULL)
return ENOMEM; return -ENOMEM;
for (k = 1; k < nTxBlock - 1; k++) { for (k = 1; k < nTxBlock - 1; k++) {
TxBlock[k].next = k + 1; TxBlock[k].next = k + 1;
...@@ -283,7 +283,7 @@ int txInit(void) ...@@ -283,7 +283,7 @@ int txInit(void)
TxLock = (struct tlock *) vmalloc(size); TxLock = (struct tlock *) vmalloc(size);
if (TxLock == NULL) { if (TxLock == NULL) {
vfree(TxBlock); vfree(TxBlock);
return ENOMEM; return -ENOMEM;
} }
/* initialize tlock table */ /* initialize tlock table */
...@@ -1098,7 +1098,7 @@ int txCommit(tid_t tid, /* transaction identifier */ ...@@ -1098,7 +1098,7 @@ int txCommit(tid_t tid, /* transaction identifier */
struct inode **iplist, /* list of inode to commit */ struct inode **iplist, /* list of inode to commit */
int flag) int flag)
{ {
int rc = 0, rc1 = 0; int rc = 0;
struct commit cd; struct commit cd;
struct jfs_log *log; struct jfs_log *log;
struct tblock *tblk; struct tblock *tblk;
...@@ -1318,8 +1318,6 @@ int txCommit(tid_t tid, /* transaction identifier */ ...@@ -1318,8 +1318,6 @@ int txCommit(tid_t tid, /* transaction identifier */
out: out:
if (rc != 0) if (rc != 0)
txAbortCommit(&cd, rc); txAbortCommit(&cd, rc);
else
rc = rc1;
TheEnd: TheEnd:
jfs_info("txCommit: tid = %d, returning %d", tid, rc); jfs_info("txCommit: tid = %d, returning %d", tid, rc);
...@@ -2738,7 +2736,7 @@ void txLazyCommit(struct tblock * tblk) ...@@ -2738,7 +2736,7 @@ void txLazyCommit(struct tblock * tblk)
/* We must have gotten ahead of the user thread /* We must have gotten ahead of the user thread
*/ */
jfs_info("jfs_lazycommit: tblk 0x%p not unlocked", tblk); jfs_info("jfs_lazycommit: tblk 0x%p not unlocked", tblk);
schedule(); yield();
} }
jfs_info("txLazyCommit: processing tblk 0x%p", tblk); jfs_info("txLazyCommit: processing tblk 0x%p", tblk);
......
...@@ -68,8 +68,7 @@ int jfs_strtoUCS(wchar_t * to, ...@@ -68,8 +68,7 @@ int jfs_strtoUCS(wchar_t * to,
jfs_err("jfs_strtoUCS: char2uni returned %d.", charlen); jfs_err("jfs_strtoUCS: char2uni returned %d.", charlen);
jfs_err("charset = %s, char = 0x%x", jfs_err("charset = %s, char = 0x%x",
codepage->charset, (unsigned char) *from); codepage->charset, (unsigned char) *from);
to[i] = 0x003f; /* a question mark */ return charlen;
charlen = 1;
} }
} }
...@@ -89,16 +88,21 @@ int get_UCSname(struct component_name * uniName, struct dentry *dentry, ...@@ -89,16 +88,21 @@ int get_UCSname(struct component_name * uniName, struct dentry *dentry,
int length = dentry->d_name.len; int length = dentry->d_name.len;
if (length > JFS_NAME_MAX) if (length > JFS_NAME_MAX)
return ENAMETOOLONG; return -ENAMETOOLONG;
uniName->name = uniName->name =
kmalloc((length + 1) * sizeof(wchar_t), GFP_NOFS); kmalloc((length + 1) * sizeof(wchar_t), GFP_NOFS);
if (uniName->name == NULL) if (uniName->name == NULL)
return ENOSPC; return -ENOSPC;
uniName->namlen = jfs_strtoUCS(uniName->name, dentry->d_name.name, uniName->namlen = jfs_strtoUCS(uniName->name, dentry->d_name.name,
length, nls_tab); length, nls_tab);
if (uniName->namlen < 0) {
kfree(uniName->name);
return uniName->namlen;
}
return 0; return 0;
} }
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
BT_PUTPAGE(MP);\ BT_PUTPAGE(MP);\
updateSuper((IP)->i_sb, FM_DIRTY);\ updateSuper((IP)->i_sb, FM_DIRTY);\
MP = NULL;\ MP = NULL;\
RC = EIO;\ RC = -EIO;\
}\ }\
}\ }\
} }
...@@ -814,7 +814,7 @@ int xtInsert(tid_t tid, /* transaction id */ ...@@ -814,7 +814,7 @@ int xtInsert(tid_t tid, /* transaction id */
/* This test must follow XT_GETSEARCH since mp must be valid if /* This test must follow XT_GETSEARCH since mp must be valid if
* we branch to out: */ * we branch to out: */
if (cmp == 0) { if (cmp == 0) {
rc = EEXIST; rc = -EEXIST;
goto out; goto out;
} }
...@@ -1033,7 +1033,7 @@ xtSplitUp(tid_t tid, ...@@ -1033,7 +1033,7 @@ xtSplitUp(tid_t tid,
xtSplitRoot(tid, ip, split, &rmp) : xtSplitRoot(tid, ip, split, &rmp) :
xtSplitPage(tid, ip, split, &rmp, &rbn); xtSplitPage(tid, ip, split, &rmp, &rbn);
if (rc) if (rc)
return EIO; return -EIO;
XT_PUTPAGE(smp); XT_PUTPAGE(smp);
...@@ -1238,7 +1238,7 @@ xtSplitPage(tid_t tid, struct inode *ip, ...@@ -1238,7 +1238,7 @@ xtSplitPage(tid_t tid, struct inode *ip,
rbn = addressPXD(pxd); rbn = addressPXD(pxd);
rmp = get_metapage(ip, rbn, PSIZE, 1); rmp = get_metapage(ip, rbn, PSIZE, 1);
if (rmp == NULL) if (rmp == NULL)
return EIO; return -EIO;
jfs_info("xtSplitPage: ip:0x%p smp:0x%p rmp:0x%p", ip, smp, rmp); jfs_info("xtSplitPage: ip:0x%p smp:0x%p rmp:0x%p", ip, smp, rmp);
...@@ -1485,7 +1485,7 @@ xtSplitRoot(tid_t tid, ...@@ -1485,7 +1485,7 @@ xtSplitRoot(tid_t tid,
rbn = addressPXD(pxd); rbn = addressPXD(pxd);
rmp = get_metapage(ip, rbn, PSIZE, 1); rmp = get_metapage(ip, rbn, PSIZE, 1);
if (rmp == NULL) if (rmp == NULL)
return EIO; return -EIO;
jfs_info("xtSplitRoot: ip:0x%p rmp:0x%p", ip, rmp); jfs_info("xtSplitRoot: ip:0x%p rmp:0x%p", ip, rmp);
...@@ -2409,7 +2409,7 @@ int xtAppend(tid_t tid, /* transaction id */ ...@@ -2409,7 +2409,7 @@ int xtAppend(tid_t tid, /* transaction id */
XT_GETSEARCH(ip, btstack.top, bn, mp, p, index); XT_GETSEARCH(ip, btstack.top, bn, mp, p, index);
if (cmp == 0) { if (cmp == 0) {
rc = EEXIST; rc = -EEXIST;
goto out; goto out;
} }
//insert: //insert:
...@@ -2557,7 +2557,7 @@ int xtDelete(tid_t tid, struct inode *ip, s64 xoff, s32 xlen, int flag) ...@@ -2557,7 +2557,7 @@ int xtDelete(tid_t tid, struct inode *ip, s64 xoff, s32 xlen, int flag)
if (cmp) { if (cmp) {
/* unpin the leaf page */ /* unpin the leaf page */
XT_PUTPAGE(mp); XT_PUTPAGE(mp);
return ENOENT; return -ENOENT;
} }
/* /*
...@@ -2788,7 +2788,7 @@ xtRelocate(tid_t tid, struct inode * ip, xad_t * oxad, /* old XAD */ ...@@ -2788,7 +2788,7 @@ xtRelocate(tid_t tid, struct inode * ip, xad_t * oxad, /* old XAD */
/* validate extent offset */ /* validate extent offset */
offset = xoff << JFS_SBI(ip->i_sb)->l2bsize; offset = xoff << JFS_SBI(ip->i_sb)->l2bsize;
if (offset >= ip->i_size) if (offset >= ip->i_size)
return ESTALE; /* stale extent */ return -ESTALE; /* stale extent */
jfs_info("xtRelocate: xtype:%d xoff:0x%lx xlen:0x%x xaddr:0x%lx:0x%lx", jfs_info("xtRelocate: xtype:%d xoff:0x%lx xlen:0x%x xaddr:0x%lx:0x%lx",
xtype, (ulong) xoff, xlen, (ulong) oxaddr, (ulong) nxaddr); xtype, (ulong) xoff, xlen, (ulong) oxaddr, (ulong) nxaddr);
...@@ -2804,7 +2804,7 @@ xtRelocate(tid_t tid, struct inode * ip, xad_t * oxad, /* old XAD */ ...@@ -2804,7 +2804,7 @@ xtRelocate(tid_t tid, struct inode * ip, xad_t * oxad, /* old XAD */
return rc; return rc;
if (cmp) { if (cmp) {
XT_PUTPAGE(pmp); XT_PUTPAGE(pmp);
return ESTALE; return -ESTALE;
} }
/* retrieve search result */ /* retrieve search result */
...@@ -2814,7 +2814,7 @@ xtRelocate(tid_t tid, struct inode * ip, xad_t * oxad, /* old XAD */ ...@@ -2814,7 +2814,7 @@ xtRelocate(tid_t tid, struct inode * ip, xad_t * oxad, /* old XAD */
xad = &pp->xad[index]; xad = &pp->xad[index];
if (addressXAD(xad) != oxaddr || lengthXAD(xad) != xlen) { if (addressXAD(xad) != oxaddr || lengthXAD(xad) != xlen) {
XT_PUTPAGE(pmp); XT_PUTPAGE(pmp);
return ESTALE; return -ESTALE;
} }
} else { /* (xtype == XTPAGE) */ } else { /* (xtype == XTPAGE) */
...@@ -2824,7 +2824,7 @@ xtRelocate(tid_t tid, struct inode * ip, xad_t * oxad, /* old XAD */ ...@@ -2824,7 +2824,7 @@ xtRelocate(tid_t tid, struct inode * ip, xad_t * oxad, /* old XAD */
return rc; return rc;
if (cmp) { if (cmp) {
XT_PUTPAGE(pmp); XT_PUTPAGE(pmp);
return ESTALE; return -ESTALE;
} }
/* retrieve search result */ /* retrieve search result */
...@@ -3127,7 +3127,7 @@ static int xtSearchNode(struct inode *ip, xad_t * xad, /* required XAD entry */ ...@@ -3127,7 +3127,7 @@ static int xtSearchNode(struct inode *ip, xad_t * xad, /* required XAD entry */
if (rc) if (rc)
return rc; return rc;
if (p->header.flag & BT_LEAF) if (p->header.flag & BT_LEAF)
return ESTALE; return -ESTALE;
lim = le16_to_cpu(p->header.nextindex) - XTENTRYSTART; lim = le16_to_cpu(p->header.nextindex) - XTENTRYSTART;
...@@ -3439,7 +3439,7 @@ s64 xtTruncate(tid_t tid, struct inode *ip, s64 newsize, int flag) ...@@ -3439,7 +3439,7 @@ s64 xtTruncate(tid_t tid, struct inode *ip, s64 newsize, int flag)
getPage: getPage:
XT_GETPAGE(ip, bn, mp, PSIZE, p, rc); XT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
if (rc) if (rc)
return -rc; return rc;
/* process entries backward from last index */ /* process entries backward from last index */
index = le16_to_cpu(p->header.nextindex) - 1; index = le16_to_cpu(p->header.nextindex) - 1;
...@@ -3667,7 +3667,7 @@ s64 xtTruncate(tid_t tid, struct inode *ip, s64 newsize, int flag) ...@@ -3667,7 +3667,7 @@ s64 xtTruncate(tid_t tid, struct inode *ip, s64 newsize, int flag)
bn = parent->bn; bn = parent->bn;
XT_GETPAGE(ip, bn, mp, PSIZE, p, rc); XT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
if (rc) if (rc)
return -rc; return rc;
index = parent->index; index = parent->index;
...@@ -3924,7 +3924,7 @@ s64 xtTruncate_pmap(tid_t tid, struct inode *ip, s64 committed_size) ...@@ -3924,7 +3924,7 @@ s64 xtTruncate_pmap(tid_t tid, struct inode *ip, s64 committed_size)
xoff = (committed_size >> JFS_SBI(ip->i_sb)->l2bsize) - 1; xoff = (committed_size >> JFS_SBI(ip->i_sb)->l2bsize) - 1;
rc = xtSearch(ip, xoff, &cmp, &btstack, 0); rc = xtSearch(ip, xoff, &cmp, &btstack, 0);
if (rc) if (rc)
return -rc; return rc;
assert(cmp == 0); assert(cmp == 0);
XT_GETSEARCH(ip, btstack.top, bn, mp, p, index); XT_GETSEARCH(ip, btstack.top, bn, mp, p, index);
} else { } else {
...@@ -3941,7 +3941,7 @@ s64 xtTruncate_pmap(tid_t tid, struct inode *ip, s64 committed_size) ...@@ -3941,7 +3941,7 @@ s64 xtTruncate_pmap(tid_t tid, struct inode *ip, s64 committed_size)
getPage: getPage:
XT_GETPAGE(ip, bn, mp, PSIZE, p, rc); XT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
if (rc) if (rc)
return -rc; return rc;
/* process entries backward from last index */ /* process entries backward from last index */
index = le16_to_cpu(p->header.nextindex) - 1; index = le16_to_cpu(p->header.nextindex) - 1;
...@@ -3986,7 +3986,7 @@ s64 xtTruncate_pmap(tid_t tid, struct inode *ip, s64 committed_size) ...@@ -3986,7 +3986,7 @@ s64 xtTruncate_pmap(tid_t tid, struct inode *ip, s64 committed_size)
bn = parent->bn; bn = parent->bn;
XT_GETPAGE(ip, bn, mp, PSIZE, p, rc); XT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
if (rc) if (rc)
return -rc; return rc;
index = parent->index; index = parent->index;
...@@ -4311,7 +4311,7 @@ int xtGather(btree_t *t) ...@@ -4311,7 +4311,7 @@ int xtGather(btree_t *t)
bn = parent->bn; bn = parent->bn;
XT_GETPAGE(ip, bn, mp, PSIZE, p, rc); XT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
if (rc) if (rc)
return EIO; return -EIO;
/* first subroot page which /* first subroot page which
* covers all new allocated blocks * covers all new allocated blocks
......
...@@ -87,7 +87,7 @@ int jfs_create(struct inode *dip, struct dentry *dentry, int mode, ...@@ -87,7 +87,7 @@ int jfs_create(struct inode *dip, struct dentry *dentry, int mode,
*/ */
ip = ialloc(dip, mode); ip = ialloc(dip, mode);
if (ip == NULL) { if (ip == NULL) {
rc = ENOSPC; rc = -ENOSPC;
goto out2; goto out2;
} }
...@@ -160,8 +160,8 @@ int jfs_create(struct inode *dip, struct dentry *dentry, int mode, ...@@ -160,8 +160,8 @@ int jfs_create(struct inode *dip, struct dentry *dentry, int mode,
out1: out1:
jfs_info("jfs_create: rc:%d", -rc); jfs_info("jfs_create: rc:%d", rc);
return -rc; return rc;
} }
...@@ -195,7 +195,7 @@ int jfs_mkdir(struct inode *dip, struct dentry *dentry, int mode) ...@@ -195,7 +195,7 @@ int jfs_mkdir(struct inode *dip, struct dentry *dentry, int mode)
/* link count overflow on parent directory ? */ /* link count overflow on parent directory ? */
if (dip->i_nlink == JFS_LINK_MAX) { if (dip->i_nlink == JFS_LINK_MAX) {
rc = EMLINK; rc = -EMLINK;
goto out1; goto out1;
} }
...@@ -213,7 +213,7 @@ int jfs_mkdir(struct inode *dip, struct dentry *dentry, int mode) ...@@ -213,7 +213,7 @@ int jfs_mkdir(struct inode *dip, struct dentry *dentry, int mode)
*/ */
ip = ialloc(dip, S_IFDIR | mode); ip = ialloc(dip, S_IFDIR | mode);
if (ip == NULL) { if (ip == NULL) {
rc = ENOSPC; rc = -ENOSPC;
goto out2; goto out2;
} }
...@@ -290,8 +290,8 @@ int jfs_mkdir(struct inode *dip, struct dentry *dentry, int mode) ...@@ -290,8 +290,8 @@ int jfs_mkdir(struct inode *dip, struct dentry *dentry, int mode)
out1: out1:
jfs_info("jfs_mkdir: rc:%d", -rc); jfs_info("jfs_mkdir: rc:%d", rc);
return -rc; return rc;
} }
/* /*
...@@ -302,8 +302,8 @@ int jfs_mkdir(struct inode *dip, struct dentry *dentry, int mode) ...@@ -302,8 +302,8 @@ int jfs_mkdir(struct inode *dip, struct dentry *dentry, int mode)
* PARAMETER: dip - parent inode * PARAMETER: dip - parent inode
* dentry - child directory dentry * dentry - child directory dentry
* *
* RETURN: EINVAL - if name is . or .. * RETURN: -EINVAL - if name is . or ..
* EINVAL - if . or .. exist but are invalid. * -EINVAL - if . or .. exist but are invalid.
* errors from subroutines * errors from subroutines
* *
* note: * note:
...@@ -327,7 +327,7 @@ int jfs_rmdir(struct inode *dip, struct dentry *dentry) ...@@ -327,7 +327,7 @@ int jfs_rmdir(struct inode *dip, struct dentry *dentry)
/* directory must be empty to be removed */ /* directory must be empty to be removed */
if (!dtEmpty(ip)) { if (!dtEmpty(ip)) {
rc = ENOTEMPTY; rc = -ENOTEMPTY;
goto out; goto out;
} }
...@@ -413,7 +413,7 @@ int jfs_rmdir(struct inode *dip, struct dentry *dentry) ...@@ -413,7 +413,7 @@ int jfs_rmdir(struct inode *dip, struct dentry *dentry)
out: out:
jfs_info("jfs_rmdir: rc:%d", rc); jfs_info("jfs_rmdir: rc:%d", rc);
return -rc; return rc;
} }
/* /*
...@@ -499,7 +499,7 @@ int jfs_unlink(struct inode *dip, struct dentry *dentry) ...@@ -499,7 +499,7 @@ int jfs_unlink(struct inode *dip, struct dentry *dentry)
up(&JFS_IP(dip)->commit_sem); up(&JFS_IP(dip)->commit_sem);
up(&JFS_IP(ip)->commit_sem); up(&JFS_IP(ip)->commit_sem);
IWRITE_UNLOCK(ip); IWRITE_UNLOCK(ip);
rc = -new_size; /* We return -rc */ rc = new_size;
goto out1; goto out1;
} }
tblk = tid_to_tblock(tid); tblk = tid_to_tblock(tid);
...@@ -561,8 +561,8 @@ int jfs_unlink(struct inode *dip, struct dentry *dentry) ...@@ -561,8 +561,8 @@ int jfs_unlink(struct inode *dip, struct dentry *dentry)
out1: out1:
free_UCSname(&dname); free_UCSname(&dname);
out: out:
jfs_info("jfs_unlink: rc:%d", -rc); jfs_info("jfs_unlink: rc:%d", rc);
return -rc; return rc;
} }
/* /*
...@@ -587,7 +587,7 @@ int jfs_unlink(struct inode *dip, struct dentry *dentry) ...@@ -587,7 +587,7 @@ int jfs_unlink(struct inode *dip, struct dentry *dentry)
* PARAMETERS: cd - pointer to commit data structure. * PARAMETERS: cd - pointer to commit data structure.
* current inode is the one to truncate. * current inode is the one to truncate.
* *
* RETURN : Errors from subroutines * RETURN: Errors from subroutines
*/ */
s64 commitZeroLink(tid_t tid, struct inode *ip) s64 commitZeroLink(tid_t tid, struct inode *ip)
{ {
...@@ -777,7 +777,7 @@ int jfs_link(struct dentry *old_dentry, ...@@ -777,7 +777,7 @@ int jfs_link(struct dentry *old_dentry,
down(&JFS_IP(ip)->commit_sem); down(&JFS_IP(ip)->commit_sem);
if (ip->i_nlink == JFS_LINK_MAX) { if (ip->i_nlink == JFS_LINK_MAX) {
rc = EMLINK; rc = -EMLINK;
goto out; goto out;
} }
...@@ -815,7 +815,7 @@ int jfs_link(struct dentry *old_dentry, ...@@ -815,7 +815,7 @@ int jfs_link(struct dentry *old_dentry,
up(&JFS_IP(ip)->commit_sem); up(&JFS_IP(ip)->commit_sem);
jfs_info("jfs_link: rc:%d", rc); jfs_info("jfs_link: rc:%d", rc);
return -rc; return rc;
} }
/* /*
...@@ -873,7 +873,7 @@ int jfs_symlink(struct inode *dip, struct dentry *dentry, const char *name) ...@@ -873,7 +873,7 @@ int jfs_symlink(struct inode *dip, struct dentry *dentry, const char *name)
*/ */
ip = ialloc(dip, S_IFLNK | 0777); ip = ialloc(dip, S_IFLNK | 0777);
if (ip == NULL) { if (ip == NULL) {
rc = ENOSPC; rc = -ENOSPC;
goto out2; goto out2;
} }
...@@ -965,7 +965,7 @@ int jfs_symlink(struct inode *dip, struct dentry *dentry, const char *name) ...@@ -965,7 +965,7 @@ int jfs_symlink(struct inode *dip, struct dentry *dentry, const char *name)
if (mp == NULL) { if (mp == NULL) {
dtDelete(tid, dip, &dname, &ino, dtDelete(tid, dip, &dname, &ino,
JFS_REMOVE); JFS_REMOVE);
rc = EIO; rc = -EIO;
goto out3; goto out3;
} }
memcpy(mp->data, name, copy_size); memcpy(mp->data, name, copy_size);
...@@ -983,7 +983,7 @@ int jfs_symlink(struct inode *dip, struct dentry *dentry, const char *name) ...@@ -983,7 +983,7 @@ int jfs_symlink(struct inode *dip, struct dentry *dentry, const char *name)
ip->i_blocks = LBLK2PBLK(sb, xlen); ip->i_blocks = LBLK2PBLK(sb, xlen);
} else { } else {
dtDelete(tid, dip, &dname, &ino, JFS_REMOVE); dtDelete(tid, dip, &dname, &ino, JFS_REMOVE);
rc = ENOSPC; rc = -ENOSPC;
goto out3; goto out3;
} }
} }
...@@ -1030,8 +1030,8 @@ int jfs_symlink(struct inode *dip, struct dentry *dentry, const char *name) ...@@ -1030,8 +1030,8 @@ int jfs_symlink(struct inode *dip, struct dentry *dentry, const char *name)
#endif #endif
out1: out1:
jfs_info("jfs_symlink: rc:%d", -rc); jfs_info("jfs_symlink: rc:%d", rc);
return -rc; return rc;
} }
...@@ -1080,7 +1080,7 @@ int jfs_rename(struct inode *old_dir, struct dentry *old_dentry, ...@@ -1080,7 +1080,7 @@ int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
*/ */
rc = dtSearch(old_dir, &old_dname, &ino, &btstack, JFS_LOOKUP); rc = dtSearch(old_dir, &old_dname, &ino, &btstack, JFS_LOOKUP);
if (rc || (ino != old_ip->i_ino)) { if (rc || (ino != old_ip->i_ino)) {
rc = ENOENT; rc = -ENOENT;
goto out3; goto out3;
} }
...@@ -1090,26 +1090,26 @@ int jfs_rename(struct inode *old_dir, struct dentry *old_dentry, ...@@ -1090,26 +1090,26 @@ int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
rc = dtSearch(new_dir, &new_dname, &ino, &btstack, JFS_LOOKUP); rc = dtSearch(new_dir, &new_dname, &ino, &btstack, JFS_LOOKUP);
if (rc == 0) { if (rc == 0) {
if ((new_ip == 0) || (ino != new_ip->i_ino)) { if ((new_ip == 0) || (ino != new_ip->i_ino)) {
rc = ESTALE; rc = -ESTALE;
goto out3; goto out3;
} }
} else if (rc != ENOENT) } else if (rc != -ENOENT)
goto out3; goto out3;
else if (new_ip) { else if (new_ip) {
/* no entry exists, but one was expected */ /* no entry exists, but one was expected */
rc = ESTALE; rc = -ESTALE;
goto out3; goto out3;
} }
if (S_ISDIR(old_ip->i_mode)) { if (S_ISDIR(old_ip->i_mode)) {
if (new_ip) { if (new_ip) {
if (!dtEmpty(new_ip)) { if (!dtEmpty(new_ip)) {
rc = ENOTEMPTY; rc = -ENOTEMPTY;
goto out3; goto out3;
} }
} else if ((new_dir != old_dir) && } else if ((new_dir != old_dir) &&
(new_dir->i_nlink == JFS_LINK_MAX)) { (new_dir->i_nlink == JFS_LINK_MAX)) {
rc = EMLINK; rc = -EMLINK;
goto out3; goto out3;
} }
} else if (new_ip) } else if (new_ip)
...@@ -1147,7 +1147,7 @@ int jfs_rename(struct inode *old_dir, struct dentry *old_dentry, ...@@ -1147,7 +1147,7 @@ int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
/* free block resources */ /* free block resources */
if ((new_size = commitZeroLink(tid, new_ip)) < 0) { if ((new_size = commitZeroLink(tid, new_ip)) < 0) {
txAbort(tid, 1); /* Marks FS Dirty */ txAbort(tid, 1); /* Marks FS Dirty */
rc = -new_size; /* We return -rc */ rc = new_size;
goto out4; goto out4;
} }
tblk = tid_to_tblock(tid); tblk = tid_to_tblock(tid);
...@@ -1264,7 +1264,7 @@ int jfs_rename(struct inode *old_dir, struct dentry *old_dentry, ...@@ -1264,7 +1264,7 @@ int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
new_size = xtTruncate_pmap(tid, new_ip, new_size); new_size = xtTruncate_pmap(tid, new_ip, new_size);
if (new_size < 0) { if (new_size < 0) {
txAbort(tid, 1); txAbort(tid, 1);
rc = -new_size; /* We return -rc */ rc = new_size;
} else } else
rc = txCommit(tid, 1, &new_ip, COMMIT_SYNC); rc = txCommit(tid, 1, &new_ip, COMMIT_SYNC);
txEnd(tid); txEnd(tid);
...@@ -1291,7 +1291,7 @@ int jfs_rename(struct inode *old_dir, struct dentry *old_dentry, ...@@ -1291,7 +1291,7 @@ int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
} }
jfs_info("jfs_rename: returning %d", rc); jfs_info("jfs_rename: returning %d", rc);
return -rc; return rc;
} }
...@@ -1318,7 +1318,7 @@ int jfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev) ...@@ -1318,7 +1318,7 @@ int jfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
ip = ialloc(dir, mode); ip = ialloc(dir, mode);
if (ip == NULL) { if (ip == NULL) {
rc = ENOSPC; rc = -ENOSPC;
goto out1; goto out1;
} }
...@@ -1372,7 +1372,7 @@ int jfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev) ...@@ -1372,7 +1372,7 @@ int jfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
out: out:
jfs_info("jfs_mknod: returning %d", rc); jfs_info("jfs_mknod: returning %d", rc);
return -rc; return rc;
} }
static struct dentry *jfs_lookup(struct inode *dip, struct dentry *dentry, struct nameidata *nd) static struct dentry *jfs_lookup(struct inode *dip, struct dentry *dentry, struct nameidata *nd)
...@@ -1395,15 +1395,15 @@ static struct dentry *jfs_lookup(struct inode *dip, struct dentry *dentry, struc ...@@ -1395,15 +1395,15 @@ static struct dentry *jfs_lookup(struct inode *dip, struct dentry *dentry, struc
else { else {
if ((rc = if ((rc =
get_UCSname(&key, dentry, JFS_SBI(dip->i_sb)->nls_tab))) get_UCSname(&key, dentry, JFS_SBI(dip->i_sb)->nls_tab)))
return ERR_PTR(-rc); return ERR_PTR(rc);
rc = dtSearch(dip, &key, &inum, &btstack, JFS_LOOKUP); rc = dtSearch(dip, &key, &inum, &btstack, JFS_LOOKUP);
free_UCSname(&key); free_UCSname(&key);
if (rc == ENOENT) { if (rc == -ENOENT) {
d_add(dentry, NULL); d_add(dentry, NULL);
return ERR_PTR(0); return ERR_PTR(0);
} else if (rc) { } else if (rc) {
jfs_err("jfs_lookup: dtSearch returned %d", rc); jfs_err("jfs_lookup: dtSearch returned %d", rc);
return ERR_PTR(-rc); return ERR_PTR(rc);
} }
} }
......
...@@ -182,7 +182,7 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize) ...@@ -182,7 +182,7 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize)
/* file system cannot be shrinked */ /* file system cannot be shrinked */
if (newFSSize < bmp->db_mapsize) { if (newFSSize < bmp->db_mapsize) {
rc = EINVAL; rc = -EINVAL;
goto out; goto out;
} }
...@@ -315,7 +315,7 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize) ...@@ -315,7 +315,7 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize)
if (mapSize > t64) { if (mapSize > t64) {
printk(KERN_ERR "jfs_extendfs: mapSize (0x%Lx) > t64 (0x%Lx)\n", printk(KERN_ERR "jfs_extendfs: mapSize (0x%Lx) > t64 (0x%Lx)\n",
(long long) mapSize, (long long) t64); (long long) mapSize, (long long) t64);
rc = EIO; rc = -EIO;
goto error_out; goto error_out;
} }
nblocks = min(t64 - mapSize, XSize); nblocks = min(t64 - mapSize, XSize);
......
/* /*
* Copyright (c) International Business Machines Corp., 2000-2002 * Copyright (c) International Business Machines Corp., 2000-2003
* Portions Copyright (c) Christoph Hellwig, 2001-2002 * Portions Copyright (c) Christoph Hellwig, 2001-2002
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -164,7 +164,8 @@ static void jfs_put_super(struct super_block *sb) ...@@ -164,7 +164,8 @@ static void jfs_put_super(struct super_block *sb)
kfree(sbi); kfree(sbi);
} }
static int parse_options(char *options, struct super_block *sb, s64 *newLVSize) static int parse_options(char *options, struct super_block *sb, s64 *newLVSize,
int *flag)
{ {
void *nls_map = NULL; void *nls_map = NULL;
char *this_char; char *this_char;
...@@ -180,7 +181,11 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize) ...@@ -180,7 +181,11 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize)
continue; continue;
if ((value = strchr(this_char, '=')) != NULL) if ((value = strchr(this_char, '=')) != NULL)
*value++ = 0; *value++ = 0;
if (!strcmp(this_char, "iocharset")) { if (!strcmp(this_char, "integrity")) {
*flag &= ~JFS_NOINTEGRITY;
} else if (!strcmp(this_char, "nointegrity")) {
*flag |= JFS_NOINTEGRITY;
} else if (!strcmp(this_char, "iocharset")) {
if (!value || !*value) if (!value || !*value)
goto needs_arg; goto needs_arg;
if (nls_map) /* specified iocharset twice! */ if (nls_map) /* specified iocharset twice! */
...@@ -231,8 +236,9 @@ int jfs_remount(struct super_block *sb, int *flags, char *data) ...@@ -231,8 +236,9 @@ int jfs_remount(struct super_block *sb, int *flags, char *data)
{ {
s64 newLVSize = 0; s64 newLVSize = 0;
int rc = 0; int rc = 0;
int flag = JFS_SBI(sb)->flag;
if (!parse_options(data, sb, &newLVSize)) { if (!parse_options(data, sb, &newLVSize, &flag)) {
return -EINVAL; return -EINVAL;
} }
if (newLVSize) { if (newLVSize) {
...@@ -246,10 +252,24 @@ int jfs_remount(struct super_block *sb, int *flags, char *data) ...@@ -246,10 +252,24 @@ int jfs_remount(struct super_block *sb, int *flags, char *data)
return rc; return rc;
} }
if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY)) if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY)) {
JFS_SBI(sb)->flag = flag;
return jfs_mount_rw(sb, 1); return jfs_mount_rw(sb, 1);
else if ((!(sb->s_flags & MS_RDONLY)) && (*flags & MS_RDONLY)) }
return jfs_umount_rw(sb); if ((!(sb->s_flags & MS_RDONLY)) && (*flags & MS_RDONLY)) {
rc = jfs_umount_rw(sb);
JFS_SBI(sb)->flag = flag;
return rc;
}
if ((JFS_SBI(sb)->flag & JFS_NOINTEGRITY) != (flag & JFS_NOINTEGRITY))
if (!(sb->s_flags & MS_RDONLY)) {
rc = jfs_umount_rw(sb);
if (rc)
return rc;
JFS_SBI(sb)->flag = flag;
return jfs_mount_rw(sb, 1);
}
JFS_SBI(sb)->flag = flag;
return 0; return 0;
} }
...@@ -260,6 +280,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -260,6 +280,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
struct inode *inode; struct inode *inode;
int rc; int rc;
s64 newLVSize = 0; s64 newLVSize = 0;
int flag;
jfs_info("In jfs_read_super: s_flags=0x%lx", sb->s_flags); jfs_info("In jfs_read_super: s_flags=0x%lx", sb->s_flags);
...@@ -269,10 +290,12 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -269,10 +290,12 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
memset(sbi, 0, sizeof (struct jfs_sb_info)); memset(sbi, 0, sizeof (struct jfs_sb_info));
sb->s_fs_info = sbi; sb->s_fs_info = sbi;
if (!parse_options((char *) data, sb, &newLVSize)) { flag = 0;
if (!parse_options((char *) data, sb, &newLVSize, &flag)) {
kfree(sbi); kfree(sbi);
return -EINVAL; return -EINVAL;
} }
sbi->flag = flag;
if (newLVSize) { if (newLVSize) {
printk(KERN_ERR "resize option for remount only\n"); printk(KERN_ERR "resize option for remount only\n");
...@@ -519,7 +542,7 @@ static int __init init_jfs_fs(void) ...@@ -519,7 +542,7 @@ static int __init init_jfs_fs(void)
metapage_exit(); metapage_exit();
free_slab: free_slab:
kmem_cache_destroy(jfs_inode_cachep); kmem_cache_destroy(jfs_inode_cachep);
return -rc; return rc;
} }
static void __exit exit_jfs_fs(void) static void __exit exit_jfs_fs(void)
......
...@@ -183,7 +183,7 @@ static int ea_write_inline(struct inode *ip, struct jfs_ea_list *ealist, ...@@ -183,7 +183,7 @@ static int ea_write_inline(struct inode *ip, struct jfs_ea_list *ealist,
* used for an inline EA. * used for an inline EA.
*/ */
if (!(ji->mode2 & INLINEEA) && !(ji->ea.flag & DXD_INLINE)) if (!(ji->mode2 & INLINEEA) && !(ji->ea.flag & DXD_INLINE))
return -1; return -EPERM;
DXDsize(ea, size); DXDsize(ea, size);
DXDlength(ea, 0); DXDlength(ea, 0);
...@@ -252,7 +252,7 @@ static int ea_write(struct inode *ip, struct jfs_ea_list *ealist, int size, ...@@ -252,7 +252,7 @@ static int ea_write(struct inode *ip, struct jfs_ea_list *ealist, int size,
rc = dbAlloc(ip, INOHINT(ip), nblocks, &blkno); rc = dbAlloc(ip, INOHINT(ip), nblocks, &blkno);
if (rc) if (rc)
return -rc; return rc;
/* /*
* Now have nblocks worth of storage to stuff into the FEALIST. * Now have nblocks worth of storage to stuff into the FEALIST.
...@@ -513,7 +513,7 @@ static int ea_get(struct inode *inode, struct ea_buffer *ea_buf, int min_size) ...@@ -513,7 +513,7 @@ static int ea_get(struct inode *inode, struct ea_buffer *ea_buf, int min_size)
rc = dbAlloc(inode, INOHINT(inode), (s64) blocks_needed, rc = dbAlloc(inode, INOHINT(inode), (s64) blocks_needed,
&blkno); &blkno);
if (rc) if (rc)
return -rc; return rc;
DXDlength(&ea_buf->new_ea, blocks_needed); DXDlength(&ea_buf->new_ea, blocks_needed);
DXDaddress(&ea_buf->new_ea, blkno); DXDaddress(&ea_buf->new_ea, blkno);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment