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
read-write. The resize keyword with no value will grow
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:
Plans for our near term development items
......
......@@ -259,7 +259,7 @@ jfs_get_blocks(struct inode *ip, sector_t lblock, unsigned long max_blocks,
else
IREAD_UNLOCK(ip);
}
return -rc;
return rc;
}
static int jfs_get_block(struct inode *ip, sector_t lblock,
......
......@@ -81,7 +81,7 @@ struct btpage {
} else {\
P = NULL;\
jfs_err("bread failed!");\
RC = EIO;\
RC = -EIO;\
}\
}\
}
......
This diff is collapsed.
......@@ -134,7 +134,7 @@ struct dtsplit {
BT_PUTPAGE(MP);\
updateSuper((IP)->i_sb, FM_DIRTY);\
MP = NULL;\
RC = EIO;\
RC = -EIO;\
}\
}\
}
......@@ -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,
&xaddr, 0))) {
jfs_warn("add_index: xtInsert failed!");
return -1;
return -EPERM;
}
ip->i_size = PSIZE;
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)
if ((mp = get_index_page(ip, 0)) == 0) {
jfs_err("add_index: get_metapage failed!");
xtTruncate(tid, ip, 0, COMMIT_PWMAP);
return -1;
return -EPERM;
}
tlck = txLock(tid, ip, mp, tlckDATA);
llck = (struct linelock *) & tlck->lock;
......@@ -447,7 +447,7 @@ static u32 add_index(tid_t tid, struct inode *ip, s64 bn, int slot)
&xaddr, 0))) {
jfs_warn("add_index: xtInsert failed!");
jfs_ip->next_index--;
return -1;
return -EPERM;
}
ip->i_size += PSIZE;
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)
if (mp == 0) {
jfs_err("add_index: get/read_metapage failed!");
return -1;
return -EPERM;
}
lock_index(tid, ip, mp, index);
......@@ -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),
GFP_NOFS);
if (ciKey.name == 0) {
rc = ENOMEM;
rc = -ENOMEM;
goto dtSearch_Exit2;
}
......@@ -674,7 +674,7 @@ int dtSearch(struct inode *ip, struct component_name * key, ino_t * data,
*/
if (flag == JFS_CREATE) {
*data = inumber;
rc = EEXIST;
rc = -EEXIST;
goto out;
}
......@@ -684,7 +684,7 @@ int dtSearch(struct inode *ip, struct component_name * key, ino_t * data,
if ((flag == JFS_REMOVE ||
flag == JFS_RENAME) &&
*data != inumber) {
rc = ESTALE;
rc = -ESTALE;
goto out;
}
......@@ -732,7 +732,7 @@ int dtSearch(struct inode *ip, struct component_name * key, ino_t * data,
*/
if (flag == JFS_LOOKUP || flag == JFS_REMOVE ||
flag == JFS_RENAME) {
rc = ENOENT;
rc = -ENOENT;
goto out;
}
......@@ -770,7 +770,7 @@ int dtSearch(struct inode *ip, struct component_name * key, ino_t * data,
*/
jfs_err("stack overrun in dtSearch!");
updateSuper(sb, FM_DIRTY);
rc = EIO;
rc = -EIO;
goto out;
}
btstack->nsplit++;
......@@ -840,7 +840,7 @@ int dtInsert(tid_t tid, struct inode *ip,
if (DO_INDEX(ip)) {
if (JFS_IP(ip)->next_index == DIREND) {
DT_PUTPAGE(mp);
return EMLINK;
return -EMLINK;
}
n = NDTLEAF(name->namlen);
data.leaf.tid = tid;
......@@ -953,7 +953,7 @@ static int dtSplitUp(tid_t tid,
GFP_NOFS);
if (key.name == 0) {
DT_PUTPAGE(smp);
rc = ENOMEM;
rc = -ENOMEM;
goto dtSplitUp_Exit;
}
......@@ -1579,7 +1579,7 @@ static int dtSplitPage(tid_t tid, struct inode *ip, struct dtsplit * split,
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,
* descend down to leftmost child page
*/
if (p->header.flag & BT_LEAF)
return ESTALE;
return -ESTALE;
/* get the leftmost entry */
stbl = DT_GETSTBL(p);
......@@ -2666,7 +2666,7 @@ static int dtSearchNode(struct inode *ip, s64 lmxaddr, pxd_t * kpxd,
bn = le64_to_cpu(p->header.next);
else {
DT_PUTPAGE(mp);
return ESTALE;
return -ESTALE;
}
/* unpin current page */
......@@ -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));
if (dtlck->index >= dtlck->maxcnt)
dtlck = (struct dt_lock *) txLinelock(dtlck);
lv = dtlck->lv;
lv = &dtlck->lv[dtlck->index];
lv->offset = stbl[i];
lv->length = 1;
dtlck->index++;
......@@ -3068,7 +3068,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
}
if ((rc = dtReadFirst(ip, &btstack)))
return -rc;
return rc;
DT_GETSEARCH(ip, btstack.top, bn, mp, p, index);
}
......@@ -3268,7 +3268,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
DT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
if (rc) {
free_page(dirent_buf);
return -rc;
return rc;
}
}
......@@ -4434,8 +4434,8 @@ static void dtLinelockFreelist(dtpage_t * p, /* directory page */
* flag - JFS_RENAME
*
* RETURNS:
* ESTALE - If entry found does not match orig_ino passed in
* ENOENT - If no entry can be found to match key
* -ESTALE - If entry found does not match orig_ino passed in
* -ENOENT - If no entry can be found to match key
* 0 - If successfully modified entry
*/
int dtModify(tid_t tid, struct inode *ip,
......
......@@ -83,8 +83,8 @@ extern int jfs_commit_inode(struct inode *, int);
*
* RETURN VALUES:
* 0 - success
* EIO - i/o error.
* ENOSPC - insufficient disk resources.
* -EIO - i/o error.
* -ENOSPC - insufficient disk resources.
*/
int
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:
* 0 - success
* EIO - i/o error.
* ENOSPC - insufficient disk resources.
* -EIO - i/o error.
* -ENOSPC - insufficient disk resources.
*/
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:
* 0 - success
* EIO - i/o error.
* -EIO - i/o error.
*/
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:
* 0 - success
* EIO - i/o error.
* ENOSPC - insufficient disk resources.
* -EIO - i/o error.
* -ENOSPC - insufficient disk resources.
*/
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);
up(&JFS_IP(ip)->commit_sem);
return (rc);
return rc;
}
......@@ -453,8 +453,8 @@ int extRecord(struct inode *ip, xad_t * xp)
*
* RETURN VALUES:
* 0 - success
* EIO - i/o error.
* ENOSPC - insufficient disk resources.
* -EIO - i/o error.
* -ENOSPC - insufficient disk resources.
*/
int extFill(struct inode *ip, xad_t * xp)
{
......@@ -505,8 +505,8 @@ int extFill(struct inode *ip, xad_t * xp)
*
* RETURN VALUES:
* 0 - success
* EIO - i/o error.
* ENOSPC - insufficient disk resources.
* -EIO - i/o error.
* -ENOSPC - insufficient disk resources.
*/
static int
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,
* stop and return this error.
*/
if (rc != ENOSPC)
if (rc != -ENOSPC)
return (rc);
/* decrease the allocation request size */
......@@ -596,8 +596,8 @@ extBalloc(struct inode *ip, s64 hint, s64 * nblocks, s64 * blkno)
*
* RETURN VALUES:
* 0 - success
* EIO - i/o error.
* ENOSPC - insufficient disk resources.
* -EIO - i/o error.
* -ENOSPC - insufficient disk resources.
*/
static int
extBrealloc(struct inode *ip,
......@@ -610,7 +610,7 @@ extBrealloc(struct inode *ip,
*newblkno = blkno;
return (0);
} else {
if (rc != ENOSPC)
if (rc != -ENOSPC)
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
* it under the terms of the GNU General Public License as published by
......@@ -29,6 +29,9 @@
/*
* file system option (superblock flag)
*/
/* mount time flag to disable journaling to disk */
#define JFS_NOINTEGRITY 0x00000010
/* platform option (conditional compilation) */
#define JFS_AIX 0x80000000 /* AIX support */
/* POSIX name/directory support */
......
This diff is collapsed.
/*
* Copyright (c) International Business Machines Corp., 2000-2002
* Copyright (c) International Business Machines Corp., 2000-2003
* Portions Copyright (c) Christoph Hellwig, 2001-2002
*
* This program is free software; you can redistribute it and/or modify
......@@ -130,32 +130,34 @@ enum cflags {
* JFS-private superblock information.
*/
struct jfs_sb_info {
unsigned long mntflag; /* 4: aggregate attributes */
struct inode *ipbmap; /* 4: block map inode */
struct inode *ipaimap; /* 4: aggregate inode map inode */
struct inode *ipaimap2; /* 4: secondary aimap inode */
struct inode *ipimap; /* 4: aggregate inode map inode */
struct jfs_log *log; /* 4: log */
short bsize; /* 2: logical block size */
short l2bsize; /* 2: log2 logical block size */
short nbperpage; /* 2: blocks per page */
short l2nbperpage; /* 2: log2 blocks per page */
short l2niperblk; /* 2: log2 inodes per page */
u32 logdev; /* 2: external log device */
unsigned long mntflag; /* aggregate attributes */
struct inode *ipbmap; /* block map inode */
struct inode *ipaimap; /* aggregate inode map inode */
struct inode *ipaimap2; /* secondary aimap inode */
struct inode *ipimap; /* aggregate inode map inode */
struct jfs_log *log; /* log */
short bsize; /* logical block size */
short l2bsize; /* log2 logical block size */
short nbperpage; /* blocks per page */
short l2nbperpage; /* log2 blocks per page */
short l2niperblk; /* log2 inodes per page */
u32 logdev; /* external log device */
uint aggregate; /* volume identifier in log record */
pxd_t logpxd; /* 8: pxd describing log */
pxd_t fsckpxd; /* 8: pxd describing fsck wkspc */
pxd_t ait2; /* 8: pxd describing AIT copy */
char uuid[16]; /* 16: 128-bit uuid for volume */
char loguuid[16]; /* 16: 128-bit uuid for log */
pxd_t logpxd; /* pxd describing log */
pxd_t fsckpxd; /* pxd describing fsck wkspc */
pxd_t ait2; /* pxd describing AIT copy */
char uuid[16]; /* 128-bit uuid for volume */
char loguuid[16]; /* 128-bit uuid for log */
/* Formerly in ipimap */
uint gengen; /* 4: inode generation generator*/
uint inostamp; /* 4: shows inode belongs to fileset*/
uint gengen; /* inode generation generator*/
uint inostamp; /* shows inode belongs to fileset*/
/* Formerly in ipbmap */
struct bmap *bmap; /* 4: incore bmap descriptor */
struct nls_table *nls_tab; /* 4: current codepage */
uint state; /* 4: mount/recovery state */
struct bmap *bmap; /* incore bmap descriptor */
struct nls_table *nls_tab; /* current codepage */
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)
......
/*
* Copyright (c) International Business Machines Corp., 2000-2002
* Copyright (c) International Business Machines Corp., 2000-2003
* Portions Copyright (c) Christoph Hellwig, 2001-2002
*
* 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)
/* group committed already ? */
if (tblk->flag & tblkGC_COMMITTED) {
if (tblk->flag & tblkGC_ERROR)
rc = EIO;
rc = -EIO;
LOGGC_UNLOCK(log);
return rc;
......@@ -701,7 +701,7 @@ int lmGroupCommit(struct jfs_log * log, struct tblock * tblk)
if (tblk->flag & tblkGC_COMMITTED) {
if (tblk->flag & tblkGC_ERROR)
rc = EIO;
rc = -EIO;
LOGGC_UNLOCK(log);
return rc;
......@@ -717,7 +717,7 @@ int lmGroupCommit(struct jfs_log * log, struct tblock * tblk)
/* removed from commit queue */
if (tblk->flag & tblkGC_ERROR)
rc = EIO;
rc = -EIO;
LOGGC_UNLOCK(log);
return rc;
......@@ -1068,7 +1068,7 @@ int lmLogOpen(struct super_block *sb, struct jfs_log ** logptr)
struct jfs_log *log;
if (!(log = kmalloc(sizeof(struct jfs_log), GFP_KERNEL)))
return ENOMEM;
return -ENOMEM;
memset(log, 0, sizeof(struct jfs_log));
init_waitqueue_head(&log->syncwait);
......@@ -1113,7 +1113,6 @@ int lmLogOpen(struct super_block *sb, struct jfs_log ** logptr)
}
if ((rc = bd_claim(bdev, log))) {
rc = -rc;
goto close;
}
......@@ -1169,7 +1168,7 @@ int lmLogOpen(struct super_block *sb, struct jfs_log ** logptr)
* PARAMETER: log - log structure
*
* RETURN: 0 - if ok
* EINVAL - bad log magic number or superblock dirty
* -EINVAL - bad log magic number or superblock dirty
* error returned from logwait()
*
* serialization: single first open thread
......@@ -1209,21 +1208,21 @@ int lmLogInit(struct jfs_log * log)
if (logsuper->magic != cpu_to_le32(LOGMAGIC)) {
jfs_warn("*** Log Format Error ! ***");
rc = EINVAL;
rc = -EINVAL;
goto errout20;
}
/* logredo() should have been run successfully. */
if (logsuper->state != cpu_to_le32(LOGREDONE)) {
jfs_warn("*** Log Is Dirty ! ***");
rc = EINVAL;
rc = -EINVAL;
goto errout20;
}
/* initialize log inode from log superblock */
if (test_bit(log_INLINELOG,&log->flag)) {
if (log->size != le32_to_cpu(logsuper->size)) {
rc = EINVAL;
rc = -EINVAL;
goto errout20;
}
jfs_info("lmLogInit: inline log:0x%p base:0x%Lx size:0x%x",
......@@ -1242,6 +1241,15 @@ int lmLogInit(struct jfs_log * log)
log->page = le32_to_cpu(logsuper->end) / LOGPSIZE;
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
*/
......@@ -1525,6 +1533,14 @@ int lmLogShutdown(struct jfs_log * log)
lrd.type = cpu_to_le16(LOG_SYNCPT);
lrd.length = 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);
bp = log->bp;
lp = (struct logpage *) bp->l_ldata;
......@@ -1610,7 +1626,7 @@ static int lmLogFileSystem(struct jfs_log * log, char *uuid, int activate)
if (i == MAX_ACTIVE) {
jfs_warn("Somebody stomped on the journal!");
lbmFree(bpsuper);
return EIO;
return -EIO;
}
}
......@@ -1698,7 +1714,7 @@ static int lbmLogInit(struct jfs_log * log)
error:
lbmLogShutdown(log);
return (ENOMEM);
return -ENOMEM;
}
......@@ -1986,10 +2002,18 @@ static void lbmStartIO(struct lbuf * bp)
bio->bi_end_io = lbmIODone;
bio->bi_private = bp;
/* check if journaling to disk has been disabled */
if (!log->no_integrity) {
submit_bio(WRITE, bio);
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)
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)
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
*
* This program is free software; you can redistribute it and/or modify
......@@ -417,6 +417,10 @@ struct jfs_log {
struct lbuf *wqueue; /* 4: log pageout queue */
int count; /* 4: count */
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
* it under the terms of the GNU General Public License as published by
......@@ -72,11 +72,11 @@ static int logMOUNT(struct super_block *sb);
*
* PARAMETER: sb - super block
*
* RETURN: EBUSY - device already mounted or open for write
* EBUSY - cvrdvp already mounted;
* EBUSY - mount table full
* ENOTDIR - cvrdvp not directory on a device mount
* ENXIO - device open failure
* RETURN: -EBUSY - device already mounted or open for write
* -EBUSY - cvrdvp already mounted;
* -EBUSY - mount table full
* -ENOTDIR- cvrdvp not directory on a device mount
* -ENXIO - device open failure
*/
int jfs_mount(struct super_block *sb)
{
......@@ -98,7 +98,7 @@ int jfs_mount(struct super_block *sb)
ipaimap = diReadSpecial(sb, AGGREGATE_I, 0);
if (ipaimap == NULL) {
jfs_err("jfs_mount: Faild to read AGGREGATE_I");
rc = EIO;
rc = -EIO;
goto errout20;
}
sbi->ipaimap = ipaimap;
......@@ -118,7 +118,7 @@ int jfs_mount(struct super_block *sb)
*/
ipbmap = diReadSpecial(sb, BMAP_I, 0);
if (ipbmap == NULL) {
rc = EIO;
rc = -EIO;
goto errout22;
}
......@@ -149,7 +149,7 @@ int jfs_mount(struct super_block *sb)
ipaimap2 = diReadSpecial(sb, AGGREGATE_I, 1);
if (ipaimap2 == 0) {
jfs_err("jfs_mount: Faild to read AGGREGATE_I");
rc = EIO;
rc = -EIO;
goto errout35;
}
sbi->ipaimap2 = ipaimap2;
......@@ -178,7 +178,7 @@ int jfs_mount(struct super_block *sb)
if (ipimap == NULL) {
jfs_err("jfs_mount: Failed to read FILESYSTEM_I");
/* open fileset secondary inode allocation map */
rc = EIO;
rc = -EIO;
goto errout40;
}
jfs_info("jfs_mount: ipimap:0x%p", ipimap);
......@@ -327,8 +327,7 @@ static int chkSuper(struct super_block *sb)
/* validate fs signature */
if (strncmp(j_sb->s_magic, JFS_MAGIC, 4) ||
j_sb->s_version > cpu_to_le32(JFS_VERSION)) {
//rc = EFORMAT;
rc = EINVAL;
rc = -EINVAL;
goto out;
}
......@@ -336,7 +335,7 @@ static int chkSuper(struct super_block *sb)
#ifdef _JFS_4K
if (bsize != PSIZE) {
jfs_err("Currently only 4K block size supported!");
rc = EINVAL;
rc = -EINVAL;
goto out;
}
#endif /* _JFS_4K */
......@@ -372,7 +371,7 @@ static int chkSuper(struct super_block *sb)
if (j_sb->s_state != cpu_to_le32(FM_CLEAN) &&
!(sb->s_flags & MS_RDONLY)) {
jfs_err("jfs_mount: Mount Failure: File System Dirty.");
rc = EINVAL;
rc = -EINVAL;
goto out;
}
......@@ -421,10 +420,18 @@ int updateSuper(struct super_block *sb, uint state)
struct buffer_head *bh;
int rc;
/*
* Only fsck can fix dirty state
*/
if (sbi->state == FM_DIRTY)
if (sbi->flag & JFS_NOINTEGRITY) {
if (state == FM_DIRTY) {
sbi->p_state = state;
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;
if ((rc = readSuper(sb, &bh)))
......
/*
* Copyright (c) International Business Machines Corp., 2000-2002
* Copyright (c) International Business Machines Corp., 2000-2003
* Portions Copyright (c) Christoph Hellwig, 2001-2002
*
* This program is free software; you can redistribute it and/or modify
......@@ -257,7 +257,7 @@ int txInit(void)
size = sizeof(struct tblock) * nTxBlock;
TxBlock = (struct tblock *) vmalloc(size);
if (TxBlock == NULL)
return ENOMEM;
return -ENOMEM;
for (k = 1; k < nTxBlock - 1; k++) {
TxBlock[k].next = k + 1;
......@@ -283,7 +283,7 @@ int txInit(void)
TxLock = (struct tlock *) vmalloc(size);
if (TxLock == NULL) {
vfree(TxBlock);
return ENOMEM;
return -ENOMEM;
}
/* initialize tlock table */
......@@ -1098,7 +1098,7 @@ int txCommit(tid_t tid, /* transaction identifier */
struct inode **iplist, /* list of inode to commit */
int flag)
{
int rc = 0, rc1 = 0;
int rc = 0;
struct commit cd;
struct jfs_log *log;
struct tblock *tblk;
......@@ -1318,8 +1318,6 @@ int txCommit(tid_t tid, /* transaction identifier */
out:
if (rc != 0)
txAbortCommit(&cd, rc);
else
rc = rc1;
TheEnd:
jfs_info("txCommit: tid = %d, returning %d", tid, rc);
......@@ -2738,7 +2736,7 @@ void txLazyCommit(struct tblock * tblk)
/* We must have gotten ahead of the user thread
*/
jfs_info("jfs_lazycommit: tblk 0x%p not unlocked", tblk);
schedule();
yield();
}
jfs_info("txLazyCommit: processing tblk 0x%p", tblk);
......
......@@ -68,8 +68,7 @@ int jfs_strtoUCS(wchar_t * to,
jfs_err("jfs_strtoUCS: char2uni returned %d.", charlen);
jfs_err("charset = %s, char = 0x%x",
codepage->charset, (unsigned char) *from);
to[i] = 0x003f; /* a question mark */
charlen = 1;
return charlen;
}
}
......@@ -89,16 +88,21 @@ int get_UCSname(struct component_name * uniName, struct dentry *dentry,
int length = dentry->d_name.len;
if (length > JFS_NAME_MAX)
return ENAMETOOLONG;
return -ENAMETOOLONG;
uniName->name =
kmalloc((length + 1) * sizeof(wchar_t), GFP_NOFS);
if (uniName->name == NULL)
return ENOSPC;
return -ENOSPC;
uniName->namlen = jfs_strtoUCS(uniName->name, dentry->d_name.name,
length, nls_tab);
if (uniName->namlen < 0) {
kfree(uniName->name);
return uniName->namlen;
}
return 0;
}
......@@ -73,7 +73,7 @@
BT_PUTPAGE(MP);\
updateSuper((IP)->i_sb, FM_DIRTY);\
MP = NULL;\
RC = EIO;\
RC = -EIO;\
}\
}\
}
......@@ -814,7 +814,7 @@ int xtInsert(tid_t tid, /* transaction id */
/* This test must follow XT_GETSEARCH since mp must be valid if
* we branch to out: */
if (cmp == 0) {
rc = EEXIST;
rc = -EEXIST;
goto out;
}
......@@ -1033,7 +1033,7 @@ xtSplitUp(tid_t tid,
xtSplitRoot(tid, ip, split, &rmp) :
xtSplitPage(tid, ip, split, &rmp, &rbn);
if (rc)
return EIO;
return -EIO;
XT_PUTPAGE(smp);
......@@ -1238,7 +1238,7 @@ xtSplitPage(tid_t tid, struct inode *ip,
rbn = addressPXD(pxd);
rmp = get_metapage(ip, rbn, PSIZE, 1);
if (rmp == NULL)
return EIO;
return -EIO;
jfs_info("xtSplitPage: ip:0x%p smp:0x%p rmp:0x%p", ip, smp, rmp);
......@@ -1485,7 +1485,7 @@ xtSplitRoot(tid_t tid,
rbn = addressPXD(pxd);
rmp = get_metapage(ip, rbn, PSIZE, 1);
if (rmp == NULL)
return EIO;
return -EIO;
jfs_info("xtSplitRoot: ip:0x%p rmp:0x%p", ip, rmp);
......@@ -2409,7 +2409,7 @@ int xtAppend(tid_t tid, /* transaction id */
XT_GETSEARCH(ip, btstack.top, bn, mp, p, index);
if (cmp == 0) {
rc = EEXIST;
rc = -EEXIST;
goto out;
}
//insert:
......@@ -2557,7 +2557,7 @@ int xtDelete(tid_t tid, struct inode *ip, s64 xoff, s32 xlen, int flag)
if (cmp) {
/* unpin the leaf page */
XT_PUTPAGE(mp);
return ENOENT;
return -ENOENT;
}
/*
......@@ -2788,7 +2788,7 @@ xtRelocate(tid_t tid, struct inode * ip, xad_t * oxad, /* old XAD */
/* validate extent offset */
offset = xoff << JFS_SBI(ip->i_sb)->l2bsize;
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",
xtype, (ulong) xoff, xlen, (ulong) oxaddr, (ulong) nxaddr);
......@@ -2804,7 +2804,7 @@ xtRelocate(tid_t tid, struct inode * ip, xad_t * oxad, /* old XAD */
return rc;
if (cmp) {
XT_PUTPAGE(pmp);
return ESTALE;
return -ESTALE;
}
/* retrieve search result */
......@@ -2814,7 +2814,7 @@ xtRelocate(tid_t tid, struct inode * ip, xad_t * oxad, /* old XAD */
xad = &pp->xad[index];
if (addressXAD(xad) != oxaddr || lengthXAD(xad) != xlen) {
XT_PUTPAGE(pmp);
return ESTALE;
return -ESTALE;
}
} else { /* (xtype == XTPAGE) */
......@@ -2824,7 +2824,7 @@ xtRelocate(tid_t tid, struct inode * ip, xad_t * oxad, /* old XAD */
return rc;
if (cmp) {
XT_PUTPAGE(pmp);
return ESTALE;
return -ESTALE;
}
/* retrieve search result */
......@@ -3127,7 +3127,7 @@ static int xtSearchNode(struct inode *ip, xad_t * xad, /* required XAD entry */
if (rc)
return rc;
if (p->header.flag & BT_LEAF)
return ESTALE;
return -ESTALE;
lim = le16_to_cpu(p->header.nextindex) - XTENTRYSTART;
......@@ -3439,7 +3439,7 @@ s64 xtTruncate(tid_t tid, struct inode *ip, s64 newsize, int flag)
getPage:
XT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
if (rc)
return -rc;
return rc;
/* process entries backward from last index */
index = le16_to_cpu(p->header.nextindex) - 1;
......@@ -3667,7 +3667,7 @@ s64 xtTruncate(tid_t tid, struct inode *ip, s64 newsize, int flag)
bn = parent->bn;
XT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
if (rc)
return -rc;
return rc;
index = parent->index;
......@@ -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;
rc = xtSearch(ip, xoff, &cmp, &btstack, 0);
if (rc)
return -rc;
return rc;
assert(cmp == 0);
XT_GETSEARCH(ip, btstack.top, bn, mp, p, index);
} else {
......@@ -3941,7 +3941,7 @@ s64 xtTruncate_pmap(tid_t tid, struct inode *ip, s64 committed_size)
getPage:
XT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
if (rc)
return -rc;
return rc;
/* process entries backward from last index */
index = le16_to_cpu(p->header.nextindex) - 1;
......@@ -3986,7 +3986,7 @@ s64 xtTruncate_pmap(tid_t tid, struct inode *ip, s64 committed_size)
bn = parent->bn;
XT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
if (rc)
return -rc;
return rc;
index = parent->index;
......@@ -4311,7 +4311,7 @@ int xtGather(btree_t *t)
bn = parent->bn;
XT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
if (rc)
return EIO;
return -EIO;
/* first subroot page which
* covers all new allocated blocks
......
......@@ -87,7 +87,7 @@ int jfs_create(struct inode *dip, struct dentry *dentry, int mode,
*/
ip = ialloc(dip, mode);
if (ip == NULL) {
rc = ENOSPC;
rc = -ENOSPC;
goto out2;
}
......@@ -160,8 +160,8 @@ int jfs_create(struct inode *dip, struct dentry *dentry, int mode,
out1:
jfs_info("jfs_create: rc:%d", -rc);
return -rc;
jfs_info("jfs_create: rc:%d", rc);
return rc;
}
......@@ -195,7 +195,7 @@ int jfs_mkdir(struct inode *dip, struct dentry *dentry, int mode)
/* link count overflow on parent directory ? */
if (dip->i_nlink == JFS_LINK_MAX) {
rc = EMLINK;
rc = -EMLINK;
goto out1;
}
......@@ -213,7 +213,7 @@ int jfs_mkdir(struct inode *dip, struct dentry *dentry, int mode)
*/
ip = ialloc(dip, S_IFDIR | mode);
if (ip == NULL) {
rc = ENOSPC;
rc = -ENOSPC;
goto out2;
}
......@@ -290,8 +290,8 @@ int jfs_mkdir(struct inode *dip, struct dentry *dentry, int mode)
out1:
jfs_info("jfs_mkdir: rc:%d", -rc);
return -rc;
jfs_info("jfs_mkdir: rc:%d", rc);
return rc;
}
/*
......@@ -302,8 +302,8 @@ int jfs_mkdir(struct inode *dip, struct dentry *dentry, int mode)
* PARAMETER: dip - parent inode
* dentry - child directory dentry
*
* RETURN: EINVAL - if name is . or ..
* EINVAL - if . or .. exist but are invalid.
* RETURN: -EINVAL - if name is . or ..
* -EINVAL - if . or .. exist but are invalid.
* errors from subroutines
*
* note:
......@@ -327,7 +327,7 @@ int jfs_rmdir(struct inode *dip, struct dentry *dentry)
/* directory must be empty to be removed */
if (!dtEmpty(ip)) {
rc = ENOTEMPTY;
rc = -ENOTEMPTY;
goto out;
}
......@@ -413,7 +413,7 @@ int jfs_rmdir(struct inode *dip, struct dentry *dentry)
out:
jfs_info("jfs_rmdir: rc:%d", rc);
return -rc;
return rc;
}
/*
......@@ -499,7 +499,7 @@ int jfs_unlink(struct inode *dip, struct dentry *dentry)
up(&JFS_IP(dip)->commit_sem);
up(&JFS_IP(ip)->commit_sem);
IWRITE_UNLOCK(ip);
rc = -new_size; /* We return -rc */
rc = new_size;
goto out1;
}
tblk = tid_to_tblock(tid);
......@@ -561,8 +561,8 @@ int jfs_unlink(struct inode *dip, struct dentry *dentry)
out1:
free_UCSname(&dname);
out:
jfs_info("jfs_unlink: rc:%d", -rc);
return -rc;
jfs_info("jfs_unlink: rc:%d", rc);
return rc;
}
/*
......@@ -587,7 +587,7 @@ int jfs_unlink(struct inode *dip, struct dentry *dentry)
* PARAMETERS: cd - pointer to commit data structure.
* current inode is the one to truncate.
*
* RETURN : Errors from subroutines
* RETURN: Errors from subroutines
*/
s64 commitZeroLink(tid_t tid, struct inode *ip)
{
......@@ -777,7 +777,7 @@ int jfs_link(struct dentry *old_dentry,
down(&JFS_IP(ip)->commit_sem);
if (ip->i_nlink == JFS_LINK_MAX) {
rc = EMLINK;
rc = -EMLINK;
goto out;
}
......@@ -815,7 +815,7 @@ int jfs_link(struct dentry *old_dentry,
up(&JFS_IP(ip)->commit_sem);
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)
*/
ip = ialloc(dip, S_IFLNK | 0777);
if (ip == NULL) {
rc = ENOSPC;
rc = -ENOSPC;
goto out2;
}
......@@ -965,7 +965,7 @@ int jfs_symlink(struct inode *dip, struct dentry *dentry, const char *name)
if (mp == NULL) {
dtDelete(tid, dip, &dname, &ino,
JFS_REMOVE);
rc = EIO;
rc = -EIO;
goto out3;
}
memcpy(mp->data, name, copy_size);
......@@ -983,7 +983,7 @@ int jfs_symlink(struct inode *dip, struct dentry *dentry, const char *name)
ip->i_blocks = LBLK2PBLK(sb, xlen);
} else {
dtDelete(tid, dip, &dname, &ino, JFS_REMOVE);
rc = ENOSPC;
rc = -ENOSPC;
goto out3;
}
}
......@@ -1030,8 +1030,8 @@ int jfs_symlink(struct inode *dip, struct dentry *dentry, const char *name)
#endif
out1:
jfs_info("jfs_symlink: rc:%d", -rc);
return -rc;
jfs_info("jfs_symlink: rc:%d", rc);
return rc;
}
......@@ -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);
if (rc || (ino != old_ip->i_ino)) {
rc = ENOENT;
rc = -ENOENT;
goto out3;
}
......@@ -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);
if (rc == 0) {
if ((new_ip == 0) || (ino != new_ip->i_ino)) {
rc = ESTALE;
rc = -ESTALE;
goto out3;
}
} else if (rc != ENOENT)
} else if (rc != -ENOENT)
goto out3;
else if (new_ip) {
/* no entry exists, but one was expected */
rc = ESTALE;
rc = -ESTALE;
goto out3;
}
if (S_ISDIR(old_ip->i_mode)) {
if (new_ip) {
if (!dtEmpty(new_ip)) {
rc = ENOTEMPTY;
rc = -ENOTEMPTY;
goto out3;
}
} else if ((new_dir != old_dir) &&
(new_dir->i_nlink == JFS_LINK_MAX)) {
rc = EMLINK;
rc = -EMLINK;
goto out3;
}
} else if (new_ip)
......@@ -1147,7 +1147,7 @@ int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
/* free block resources */
if ((new_size = commitZeroLink(tid, new_ip)) < 0) {
txAbort(tid, 1); /* Marks FS Dirty */
rc = -new_size; /* We return -rc */
rc = new_size;
goto out4;
}
tblk = tid_to_tblock(tid);
......@@ -1264,7 +1264,7 @@ int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
new_size = xtTruncate_pmap(tid, new_ip, new_size);
if (new_size < 0) {
txAbort(tid, 1);
rc = -new_size; /* We return -rc */
rc = new_size;
} else
rc = txCommit(tid, 1, &new_ip, COMMIT_SYNC);
txEnd(tid);
......@@ -1291,7 +1291,7 @@ int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
}
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)
ip = ialloc(dir, mode);
if (ip == NULL) {
rc = ENOSPC;
rc = -ENOSPC;
goto out1;
}
......@@ -1372,7 +1372,7 @@ int jfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
out:
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)
......@@ -1395,15 +1395,15 @@ static struct dentry *jfs_lookup(struct inode *dip, struct dentry *dentry, struc
else {
if ((rc =
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);
free_UCSname(&key);
if (rc == ENOENT) {
if (rc == -ENOENT) {
d_add(dentry, NULL);
return ERR_PTR(0);
} else if (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)
/* file system cannot be shrinked */
if (newFSSize < bmp->db_mapsize) {
rc = EINVAL;
rc = -EINVAL;
goto out;
}
......@@ -315,7 +315,7 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize)
if (mapSize > t64) {
printk(KERN_ERR "jfs_extendfs: mapSize (0x%Lx) > t64 (0x%Lx)\n",
(long long) mapSize, (long long) t64);
rc = EIO;
rc = -EIO;
goto error_out;
}
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
*
* 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)
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;
char *this_char;
......@@ -180,7 +181,11 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize)
continue;
if ((value = strchr(this_char, '=')) != NULL)
*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)
goto needs_arg;
if (nls_map) /* specified iocharset twice! */
......@@ -231,8 +236,9 @@ int jfs_remount(struct super_block *sb, int *flags, char *data)
{
s64 newLVSize = 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;
}
if (newLVSize) {
......@@ -246,10 +252,24 @@ int jfs_remount(struct super_block *sb, int *flags, char *data)
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);
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;
}
......@@ -260,6 +280,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
struct inode *inode;
int rc;
s64 newLVSize = 0;
int flag;
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)
memset(sbi, 0, sizeof (struct jfs_sb_info));
sb->s_fs_info = sbi;
if (!parse_options((char *) data, sb, &newLVSize)) {
flag = 0;
if (!parse_options((char *) data, sb, &newLVSize, &flag)) {
kfree(sbi);
return -EINVAL;
}
sbi->flag = flag;
if (newLVSize) {
printk(KERN_ERR "resize option for remount only\n");
......@@ -519,7 +542,7 @@ static int __init init_jfs_fs(void)
metapage_exit();
free_slab:
kmem_cache_destroy(jfs_inode_cachep);
return -rc;
return rc;
}
static void __exit exit_jfs_fs(void)
......
......@@ -183,7 +183,7 @@ static int ea_write_inline(struct inode *ip, struct jfs_ea_list *ealist,
* used for an inline EA.
*/
if (!(ji->mode2 & INLINEEA) && !(ji->ea.flag & DXD_INLINE))
return -1;
return -EPERM;
DXDsize(ea, size);
DXDlength(ea, 0);
......@@ -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);
if (rc)
return -rc;
return rc;
/*
* 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)
rc = dbAlloc(inode, INOHINT(inode), (s64) blocks_needed,
&blkno);
if (rc)
return -rc;
return rc;
DXDlength(&ea_buf->new_ea, blocks_needed);
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