Commit e61eb888 authored by Linus Torvalds's avatar Linus Torvalds

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

into home.transmeta.com:/home/torvalds/v2.5/linux
parents 99db2bb5 229824ad
......@@ -24,9 +24,6 @@
#include "jfs_debug.h"
extern int generic_file_open(struct inode *, struct file *);
extern loff_t generic_file_llseek(struct file *, loff_t, int origin);
extern int jfs_commit_inode(struct inode *, int);
int jfs_fsync(struct file *file, struct dentry *dentry, int datasync)
......@@ -114,11 +111,3 @@ struct file_operations jfs_file_operations = {
.sendfile = generic_file_sendfile,
.fsync = jfs_fsync,
};
struct inode_operations jfs_special_inode_operations = {
.setxattr = jfs_setxattr,
.getxattr = jfs_getxattr,
.listxattr = jfs_listxattr,
.removexattr = jfs_removexattr,
};
......@@ -31,7 +31,6 @@
extern struct inode_operations jfs_dir_inode_operations;
extern struct inode_operations jfs_file_inode_operations;
extern struct inode_operations jfs_symlink_inode_operations;
extern struct inode_operations jfs_special_inode_operations;
extern struct file_operations jfs_dir_operations;
extern struct file_operations jfs_file_operations;
struct address_space_operations jfs_aops;
......@@ -66,7 +65,7 @@ struct inode *jfs_iget(struct super_block *sb, ino_t ino)
} else
inode->i_op = &jfs_symlink_inode_operations;
} else {
inode->i_op = &jfs_special_inode_operations;
inode->i_op = &jfs_file_inode_operations;
init_special_inode(inode, inode->i_mode,
kdev_t_to_nr(inode->i_rdev));
}
......
......@@ -101,7 +101,6 @@
*/
#include <linux/fs.h>
#include <linux/smp_lock.h>
#include "jfs_incore.h"
#include "jfs_superblock.h"
#include "jfs_filsys.h"
......
/*
* Copyright (c) International Business Machines Corp., 2000-2001
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
* the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _H_JFS_EXTENDFS
#define _H_JFS_EXTENDFS
/*
* extendfs parameter list
*/
typedef struct {
u32 flag; /* 4: */
u8 dev; /* 1: */
u8 pad[3]; /* 3: */
s64 LVSize; /* 8: LV size in LV block */
s64 FSSize; /* 8: FS size in LV block */
s32 LogSize; /* 4: inlinelog size in LV block */
} extendfs_t; /* (28) */
/* plist flag */
#define EXTENDFS_QUERY 0x00000001
#endif /* _H_JFS_EXTENDFS */
......@@ -26,8 +26,9 @@
* forward references
*/
static int extBalloc(struct inode *, s64, s64 *, s64 *);
#ifdef _NOTYET
static int extBrealloc(struct inode *, s64, s64, s64 *, s64 *);
int extRecord(struct inode *, xad_t *);
#endif
static s64 extRoundDown(s64 nb);
/*
......@@ -191,6 +192,7 @@ extAlloc(struct inode *ip, s64 xlen, s64 pno, xad_t * xp, boolean_t abnr)
}
#ifdef _NOTYET
/*
* NAME: extRealloc()
*
......@@ -335,6 +337,7 @@ int extRealloc(struct inode *ip, s64 nxlen, xad_t * xp, boolean_t abnr)
up(&JFS_IP(ip)->commit_sem);
return (rc);
}
#endif /* _NOTYET */
/*
......@@ -440,6 +443,7 @@ int extRecord(struct inode *ip, xad_t * xp)
}
#ifdef _NOTYET
/*
* NAME: extFill()
*
......@@ -473,6 +477,7 @@ int extFill(struct inode *ip, xad_t * xp)
return (0);
}
#endif /* _NOTYET */
/*
......@@ -548,6 +553,7 @@ extBalloc(struct inode *ip, s64 hint, s64 * nblocks, s64 * blkno)
}
#ifdef _NOTYET
/*
* NAME: extBrealloc()
*
......@@ -601,6 +607,7 @@ extBrealloc(struct inode *ip,
*/
return (extBalloc(ip, blkno, newnblks, newblkno));
}
#endif /* _NOTYET */
/*
......
......@@ -42,6 +42,8 @@
*/
#include <linux/fs.h>
#include <linux/buffer_head.h>
#include "jfs_incore.h"
#include "jfs_filsys.h"
#include "jfs_dinode.h"
......@@ -1175,7 +1177,7 @@ int diFree(struct inode *ip)
* invalidate any page of the inode extent freed from buffer cache;
*/
freepxd = iagp->inoext[extno];
invalidate_pxd_metapages(JFS_SBI(ip->i_sb)->direct_inode, freepxd);
invalidate_pxd_metapages(ip->i_sb->s_bdev->bd_inode, freepxd);
/*
* update iag list(s) (careful update step 2)
......@@ -2963,26 +2965,30 @@ printf("diExtendFS: iag:%d agstart:%Ld agno:%d\n", i, agstart, n);
*
* note: shadow page with regular inode (rel.2);
*/
static void
duplicateIXtree(struct super_block *sb, s64 blkno, int xlen, s64 * xaddr)
static void duplicateIXtree(struct super_block *sb, s64 blkno,
int xlen, s64 *xaddr)
{
int rc;
tid_t tid;
struct inode *ip;
metapage_t *mpsuper;
struct jfs_superblock *j_sb;
struct buffer_head *bh;
struct inode *ip;
tid_t tid;
int rc;
/* if AIT2 ipmap2 is bad, do not try to update it */
if (JFS_SBI(sb)->mntflag & JFS_BAD_SAIT) /* s_flag */
return;
ip = diReadSpecial(sb, FILESYSTEM_I, 1);
if (ip == 0) {
if (ip == NULL) {
JFS_SBI(sb)->mntflag |= JFS_BAD_SAIT;
if ((rc = readSuper(sb, &mpsuper)))
if ((rc = readSuper(sb, &bh)))
return;
j_sb = (struct jfs_superblock *) (mpsuper->data);
j_sb = (struct jfs_superblock *)bh->b_data;
j_sb->s_flag |= JFS_BAD_SAIT;
write_metapage(mpsuper);
mark_buffer_dirty(bh);
ll_rw_block(WRITE, 1, &bh);
wait_on_buffer(bh);
brelse(bh);
return;
}
......
......@@ -152,8 +152,6 @@ struct jfs_sb_info {
/* Formerly in ipbmap */
struct bmap *bmap; /* 4: incore bmap descriptor */
struct nls_table *nls_tab; /* 4: current codepage */
struct inode *direct_inode; /* 4: inode for physical I/O */
struct address_space *direct_mapping; /* 4: mapping for physical I/O */
uint state; /* 4: mount/recovery state */
};
......
......@@ -960,17 +960,19 @@ int lmLogSync(log_t * log, int nosyncwait)
* reset syncpt = sync
*/
if (log->sync != log->syncpt) {
struct jfs_sb_info *sbi = JFS_SBI(log->sb);
struct super_block *sb = log->sb;
struct jfs_sb_info *sbi = JFS_SBI(sb);
/*
* We need to make sure all of the "written" metapages
* actually make it to disk
*/
filemap_fdatawrite(sbi->ipbmap->i_mapping);
filemap_fdatawrite(sbi->ipimap->i_mapping);
filemap_fdatawrite(sbi->direct_inode->i_mapping);
filemap_fdatawrite(sb->s_bdev->bd_inode->i_mapping);
filemap_fdatawait(sbi->ipbmap->i_mapping);
filemap_fdatawait(sbi->ipimap->i_mapping);
filemap_fdatawait(sbi->direct_inode->i_mapping);
filemap_fdatawait(sb->s_bdev->bd_inode->i_mapping);
lrd.logtid = 0;
lrd.backchain = 0;
......@@ -1985,6 +1987,7 @@ static void lbmIODone(struct bio *bio)
jERROR(1, ("lbmIODone: I/O error in JFS log\n"));
}
bio_put(bio);
/*
......@@ -2102,7 +2105,6 @@ static void lbmIODone(struct bio *bio)
LCACHE_UNLOCK(flags); /* unlock+enable */
}
return;
}
int jfsIOWait(void *arg)
......
......@@ -27,16 +27,13 @@
#include "jfs_txnmgr.h"
#include "jfs_debug.h"
extern struct task_struct *jfsCommitTask;
static spinlock_t meta_lock = SPIN_LOCK_UNLOCKED;
static wait_queue_head_t meta_wait;
#ifdef CONFIG_JFS_STATISTICS
struct {
uint pagealloc; /* # of page allocations */
uint pagefree; /* # of page frees */
uint lockwait; /* # of sleeping lock_metapage() calls */
uint allocwait; /* # of sleeping alloc_metapage() calls */
} mpStat;
#endif
......@@ -134,11 +131,6 @@ static void mp_mempool_free(void *element, void *pool_data)
int __init metapage_init(void)
{
/*
* Initialize wait queue
*/
init_waitqueue_head(&meta_wait);
/*
* Allocate the metapage structures
*/
......@@ -225,51 +217,6 @@ static void remove_from_hash(metapage_t * mp, metapage_t ** hash_ptr)
mp->hash_next->hash_prev = mp->hash_prev;
}
/*
* Direct address space operations
*/
static int direct_get_block(struct inode *ip, sector_t lblock,
struct buffer_head *bh_result, int create)
{
if (create)
set_buffer_new(bh_result);
map_bh(bh_result, ip->i_sb, lblock);
return 0;
}
static int direct_writepage(struct page *page)
{
return block_write_full_page(page, direct_get_block);
}
static int direct_readpage(struct file *fp, struct page *page)
{
return block_read_full_page(page, direct_get_block);
}
static int direct_prepare_write(struct file *file, struct page *page,
unsigned from, unsigned to)
{
return block_prepare_write(page, from, to, direct_get_block);
}
static int direct_bmap(struct address_space *mapping, long block)
{
return generic_block_bmap(mapping, block, direct_get_block);
}
struct address_space_operations direct_aops = {
.readpage = direct_readpage,
.writepage = direct_writepage,
.sync_page = block_sync_page,
.prepare_write = direct_prepare_write,
.commit_write = generic_commit_write,
.bmap = direct_bmap,
};
metapage_t *__get_metapage(struct inode *inode,
unsigned long lblock, unsigned int size,
int absolute, unsigned long new)
......@@ -286,14 +233,12 @@ metapage_t *__get_metapage(struct inode *inode,
inode, lblock));
if (absolute)
mapping = JFS_SBI(inode->i_sb)->direct_mapping;
mapping = inode->i_sb->s_bdev->bd_inode->i_mapping;
else
mapping = inode->i_mapping;
spin_lock(&meta_lock);
hash_ptr = meta_hash(mapping, lblock);
mp = search_hash(hash_ptr, mapping, lblock);
if (mp) {
page_found:
......@@ -309,7 +254,7 @@ metapage_t *__get_metapage(struct inode *inode,
lock_metapage(mp);
spin_unlock(&meta_lock);
} else {
l2bsize = inode->i_sb->s_blocksize_bits;
l2bsize = inode->i_blkbits;
l2BlocksPerPage = PAGE_CACHE_SHIFT - l2bsize;
page_index = lblock >> l2BlocksPerPage;
page_offset = (lblock - (page_index << l2BlocksPerPage)) <<
......@@ -431,12 +376,11 @@ void hold_metapage(metapage_t * mp, int force)
static void __write_metapage(metapage_t * mp)
{
struct inode *ip = (struct inode *) mp->mapping->host;
int l2bsize = mp->mapping->host->i_blkbits;
int l2BlocksPerPage = PAGE_CACHE_SHIFT - l2bsize;
unsigned long page_index;
unsigned long page_offset;
int rc;
int l2bsize = ip->i_sb->s_blocksize_bits;
int l2BlocksPerPage = PAGE_CACHE_SHIFT - l2bsize;
jFYI(1, ("__write_metapage: mp = 0x%p\n", mp));
......@@ -561,7 +505,7 @@ void __invalidate_metapages(struct inode *ip, s64 addr, int len)
{
metapage_t **hash_ptr;
unsigned long lblock;
int l2BlocksPerPage = PAGE_CACHE_SHIFT - ip->i_sb->s_blocksize_bits;
int l2BlocksPerPage = PAGE_CACHE_SHIFT - ip->i_blkbits;
struct address_space *mapping = ip->i_mapping;
metapage_t *mp;
struct page *page;
......@@ -624,12 +568,10 @@ int jfs_mpstat_read(char *buffer, char **start, off_t offset, int length,
"=======================\n"
"page allocations = %d\n"
"page frees = %d\n"
"lock waits = %d\n"
"allocation waits = %d\n",
"lock waits = %d\n",
mpStat.pagealloc,
mpStat.pagefree,
mpStat.lockwait,
mpStat.allocwait);
mpStat.lockwait);
begin = offset;
*start = buffer + begin;
......
......@@ -57,11 +57,6 @@ typedef struct metapage {
struct jfs_log *log;
} metapage_t;
/*
* Direct-access address space operations
*/
extern struct address_space_operations direct_aops;
/* metapage flag */
#define META_locked 0
#define META_absolute 1
......
......@@ -48,6 +48,8 @@
*/
#include <linux/fs.h>
#include <linux/buffer_head.h>
#include "jfs_incore.h"
#include "jfs_filsys.h"
#include "jfs_superblock.h"
......@@ -314,18 +316,18 @@ int jfs_mount_rw(struct super_block *sb, int remount)
static int chkSuper(struct super_block *sb)
{
int rc = 0;
metapage_t *mp;
struct jfs_sb_info *sbi = JFS_SBI(sb);
struct jfs_superblock *j_sb;
struct buffer_head *bh;
int AIM_bytesize, AIT_bytesize;
int expected_AIM_bytesize, expected_AIT_bytesize;
s64 AIM_byte_addr, AIT_byte_addr, fsckwsp_addr;
s64 byte_addr_diff0, byte_addr_diff1;
s32 bsize;
if ((rc = readSuper(sb, &mp)))
if ((rc = readSuper(sb, &bh)))
return rc;
j_sb = (struct jfs_superblock *) (mp->data);
j_sb = (struct jfs_superblock *)bh->b_data;
/*
* validate superblock
......@@ -414,8 +416,7 @@ static int chkSuper(struct super_block *sb)
sbi->ait2 = j_sb->s_ait2;
out:
release_metapage(mp);
brelse(bh);
return rc;
}
......@@ -429,7 +430,7 @@ int updateSuper(struct super_block *sb, uint state)
{
struct jfs_superblock *j_sb;
struct jfs_sb_info *sbi = JFS_SBI(sb);
metapage_t *mp;
struct buffer_head *bh;
int rc;
/*
......@@ -438,10 +439,10 @@ int updateSuper(struct super_block *sb, uint state)
if (sbi->state == FM_DIRTY)
return 0;
if ((rc = readSuper(sb, &mp)))
if ((rc = readSuper(sb, &bh)))
return rc;
j_sb = (struct jfs_superblock *) (mp->data);
j_sb = (struct jfs_superblock *)bh->b_data;
j_sb->s_state = cpu_to_le32(state);
sbi->state = state;
......@@ -459,7 +460,10 @@ int updateSuper(struct super_block *sb, uint state)
j_sb->s_flag |= cpu_to_le32(JFS_DASD_PRIME);
}
flush_metapage(mp);
mark_buffer_dirty(bh);
ll_rw_block(WRITE, 1, &bh);
wait_on_buffer(bh);
brelse(bh);
return 0;
}
......@@ -470,18 +474,19 @@ int updateSuper(struct super_block *sb, uint state)
*
* read superblock by raw sector address
*/
int readSuper(struct super_block *sb, metapage_t ** mpp)
int readSuper(struct super_block *sb, struct buffer_head **bpp)
{
/* read in primary superblock */
*mpp = read_metapage(JFS_SBI(sb)->direct_inode,
SUPER1_OFF >> sb->s_blocksize_bits, PSIZE, 1);
if (*mpp == NULL) {
/* read in secondary/replicated superblock */
*mpp = read_metapage(JFS_SBI(sb)->direct_inode,
SUPER2_OFF >> sb->s_blocksize_bits,
PSIZE, 1);
}
return *mpp ? 0 : 1;
*bpp = sb_bread(sb, SUPER1_OFF >> sb->s_blocksize_bits);
if (bpp)
return 0;
/* read in secondary/replicated superblock */
*bpp = sb_bread(sb, SUPER2_OFF >> sb->s_blocksize_bits);
if (bpp)
return 0;
return -EIO;
}
......
......@@ -106,7 +106,7 @@ struct jfs_superblock {
};
extern int readSuper(struct super_block *, struct metapage **);
extern int readSuper(struct super_block *, struct buffer_head **);
extern int updateSuper(struct super_block *, uint);
#endif /*_H_JFS_SUPERBLOCK */
......@@ -144,7 +144,6 @@ struct {
*/
extern int lmGroupCommit(log_t * log, tblock_t * tblk);
extern void lmSync(log_t *);
extern int readSuper(struct super_block *sb, metapage_t ** bpp);
extern int jfs_commit_inode(struct inode *, int);
extern int jfs_stop_threads;
......
......@@ -49,13 +49,14 @@
*/
int jfs_umount(struct super_block *sb)
{
int rc = 0;
log_t *log;
struct address_space *bdev_mapping = sb->s_bdev->bd_inode->i_mapping;
struct jfs_sb_info *sbi = JFS_SBI(sb);
struct inode *ipbmap = sbi->ipbmap;
struct inode *ipimap = sbi->ipimap;
struct inode *ipaimap = sbi->ipaimap;
struct inode *ipaimap2 = sbi->ipaimap2;
log_t *log;
int rc = 0;
jFYI(1, ("\n UnMount JFS: sb:0x%p\n", sb));
......@@ -112,8 +113,8 @@ int jfs_umount(struct super_block *sb)
* Make sure all metadata makes it to disk before we mark
* the superblock as clean
*/
filemap_fdatawrite(sbi->direct_inode->i_mapping);
filemap_fdatawait(sbi->direct_inode->i_mapping);
filemap_fdatawrite(bdev_mapping);
filemap_fdatawait(bdev_mapping);
/*
* ensure all file system file pages are propagated to their
......@@ -140,6 +141,7 @@ int jfs_umount(struct super_block *sb)
int jfs_umount_rw(struct super_block *sb)
{
struct address_space *bdev_mapping = sb->s_bdev->bd_inode->i_mapping;
struct jfs_sb_info *sbi = JFS_SBI(sb);
log_t *log = sbi->log;
......@@ -158,8 +160,15 @@ int jfs_umount_rw(struct super_block *sb)
*/
dbSync(sbi->ipbmap);
diSync(sbi->ipimap);
filemap_fdatawrite(sbi->direct_inode->i_mapping);
filemap_fdatawait(sbi->direct_inode->i_mapping);
/*
* Note that we have to do this even if sync_blockdev() will
* do exactly the same a few instructions later: We can't
* mark the superblock clean before everything is flushed to
* disk.
*/
filemap_fdatawrite(bdev_mapping);
filemap_fdatawait(bdev_mapping);
updateSuper(sb, FM_CLEAN);
sbi->log = NULL;
......
......@@ -29,7 +29,6 @@
extern struct inode_operations jfs_file_inode_operations;
extern struct inode_operations jfs_symlink_inode_operations;
extern struct inode_operations jfs_special_inode_operations;
extern struct file_operations jfs_file_operations;
extern struct address_space_operations jfs_aops;
......@@ -1338,7 +1337,7 @@ int jfs_mknod(struct inode *dir, struct dentry *dentry, int mode, int rdev)
if ((rc = dtInsert(tid, dir, &dname, &ino, &btstack)))
goto out3;
ip->i_op = &jfs_special_inode_operations;
ip->i_op = &jfs_file_inode_operations;
init_special_inode(ip, ip->i_mode, rdev);
insert_inode_hash(ip);
......
......@@ -79,9 +79,8 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize)
int log_formatted = 0;
struct inode *iplist[1];
struct jfs_superblock *j_sb, *j_sb2;
metapage_t *sbp, *sb2p;
uint old_agsize;
struct buffer_head *bh;
struct buffer_head *bh, *bh2;
/* If the volume hasn't grown, get out now */
......@@ -230,9 +229,9 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize)
*/
/* read in superblock */
if ((rc = readSuper(sb, &sbp)))
if ((rc = readSuper(sb, &bh)))
goto error_out;
j_sb = (struct jfs_superblock *) (sbp->data);
j_sb = (struct jfs_superblock *)bh->b_data;
/* mark extendfs() in progress */
j_sb->s_state |= cpu_to_le32(FM_EXTENDFS);
......@@ -243,7 +242,10 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize)
PXDlength(&j_sb->s_xlogpxd, newLogSize);
/* synchronously update superblock */
flush_metapage(sbp);
mark_buffer_dirty(bh);
ll_rw_block(WRITE, 1, &bh);
wait_on_buffer(bh);
brelse(bh);
/*
* format new inline log synchronously;
......@@ -474,12 +476,13 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize)
diWriteSpecial(ipbmap2, 1);
diFreeSpecial(ipbmap2);
/*
* update superblock
*/
if ((rc = readSuper(sb, &sbp)))
if ((rc = readSuper(sb, &bh)))
goto error_out;
j_sb = (struct jfs_superblock *) (sbp->data);
j_sb = (struct jfs_superblock *)bh->b_data;
/* mark extendfs() completion */
j_sb->s_state &= cpu_to_le32(~FM_EXTENDFS);
......@@ -503,17 +506,22 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize)
/* sb->s_fsckloglen remains the same */
/* Update secondary superblock */
sb2p = read_metapage(sbi->direct_inode,
SUPER2_OFF >> sb->s_blocksize_bits, PSIZE, 1);
if (sb2p) {
j_sb2 = (struct jfs_superblock *) (sb2p->data);
bh2 = sb_bread(sb, SUPER2_OFF >> sb->s_blocksize_bits);
if (bh2) {
j_sb2 = (struct jfs_superblock *)bh2->b_data;
memcpy(j_sb2, j_sb, sizeof (struct jfs_superblock));
flush_metapage(sb2p);
mark_buffer_dirty(bh);
ll_rw_block(WRITE, 1, &bh2);
wait_on_buffer(bh2);
brelse(bh);
}
/* write primary superblock */
flush_metapage(sbp);
mark_buffer_dirty(bh);
ll_rw_block(WRITE, 1, &bh);
wait_on_buffer(bh);
brelse(bh);
goto resume;
......
......@@ -142,17 +142,6 @@ static void jfs_put_super(struct super_block *sb)
unload_nls(sbi->nls_tab);
sbi->nls_tab = NULL;
/*
* We need to clean out the direct_inode pages since this inode
* is not in the inode hash.
*/
filemap_fdatawrite(sbi->direct_inode->i_mapping);
filemap_fdatawait(sbi->direct_inode->i_mapping);
truncate_inode_pages(sbi->direct_mapping, 0);
iput(sbi->direct_inode);
sbi->direct_inode = NULL;
sbi->direct_mapping = NULL;
kfree(sbi);
}
......@@ -221,7 +210,6 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize)
int jfs_remount(struct super_block *sb, int *flags, char *data)
{
struct jfs_sb_info *sbi = JFS_SBI(sb);
s64 newLVSize = 0;
int rc = 0;
......@@ -239,15 +227,9 @@ int jfs_remount(struct super_block *sb, int *flags, char *data)
return rc;
}
if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY)) {
/*
* Invalidate any previously read metadata. fsck may
* have changed the on-disk data since we mounted r/o
*/
truncate_inode_pages(sbi->direct_mapping, 0);
if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY))
return jfs_mount_rw(sb, 1);
} else if ((!(sb->s_flags & MS_RDONLY)) && (*flags & MS_RDONLY))
else if ((!(sb->s_flags & MS_RDONLY)) && (*flags & MS_RDONLY))
return jfs_umount_rw(sb);
return 0;
......@@ -289,28 +271,13 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
sb->s_op = &jfs_super_operations;
sb->s_export_op = &jfs_export_operations;
/*
* Initialize direct-mapping inode/address-space
*/
inode = new_inode(sb);
if (inode == NULL)
goto out_kfree;
inode->i_ino = 0;
inode->i_nlink = 1;
inode->i_size = 0x0000010000000000LL;
inode->i_mapping->a_ops = &direct_aops;
inode->i_mapping->gfp_mask = GFP_NOFS;
sbi->direct_inode = inode;
sbi->direct_mapping = inode->i_mapping;
rc = jfs_mount(sb);
if (rc) {
if (!silent) {
jERROR(1,
("jfs_mount failed w/return code = %d\n", rc));
}
goto out_mount_failed;
goto out_kfree;
}
if (sb->s_flags & MS_RDONLY)
sbi->log = 0;
......@@ -360,14 +327,6 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
if (rc) {
jERROR(1, ("jfs_umount failed with return code %d\n", rc));
}
out_mount_failed:
filemap_fdatawrite(sbi->direct_inode->i_mapping);
filemap_fdatawait(sbi->direct_inode->i_mapping);
truncate_inode_pages(sbi->direct_mapping, 0);
make_bad_inode(sbi->direct_inode);
iput(sbi->direct_inode);
sbi->direct_inode = NULL;
sbi->direct_mapping = NULL;
out_kfree:
if (sbi->nls_tab)
unload_nls(sbi->nls_tab);
......
......@@ -79,10 +79,10 @@ struct ea_buffer {
#define EA_MALLOC 0x0008
/* Forward references */
void ea_release(struct inode *inode, struct ea_buffer *ea_buf);
static void ea_release(struct inode *inode, struct ea_buffer *ea_buf);
/*
* NAME: jfs_WriteEAInLine
* NAME: ea_write_inline
*
* FUNCTION: Attempt to write an EA inline if area is available
*
......@@ -103,8 +103,8 @@ void ea_release(struct inode *inode, struct ea_buffer *ea_buf);
*
* RETURNS: 0 for successful copy to inline area; -1 if area not available
*/
static int jfs_WriteEAInLine(struct inode *ip, struct jfs_ea_list *ealist,
int size, dxd_t * ea)
static int ea_write_inline(struct inode *ip, struct jfs_ea_list *ealist,
int size, dxd_t * ea)
{
struct jfs_inode_info *ji = JFS_IP(ip);
......@@ -144,7 +144,7 @@ static int jfs_WriteEAInLine(struct inode *ip, struct jfs_ea_list *ealist,
}
/*
* NAME: jfs_WriteEA
* NAME: ea_write
*
* FUNCTION: Write an EA for an inode
*
......@@ -162,7 +162,7 @@ static int jfs_WriteEAInLine(struct inode *ip, struct jfs_ea_list *ealist,
*
* RETURNS: 0 for success; Anything else indicates failure
*/
static int jfs_WriteEA(struct inode *ip, struct jfs_ea_list *ealist, int size,
static int ea_write(struct inode *ip, struct jfs_ea_list *ealist, int size,
dxd_t * ea)
{
struct super_block *sb = ip->i_sb;
......@@ -181,7 +181,7 @@ static int jfs_WriteEA(struct inode *ip, struct jfs_ea_list *ealist, int size,
* and empty EAs are all in-linable, provided the space exists.
*/
if (!ealist || size <= sizeof (ji->i_inline_ea)) {
if (!jfs_WriteEAInLine(ip, ealist, size, ea))
if (!ea_write_inline(ip, ealist, size, ea))
return 0;
}
......@@ -257,7 +257,7 @@ static int jfs_WriteEA(struct inode *ip, struct jfs_ea_list *ealist, int size,
}
/*
* NAME: jfs_ReadEAInLine
* NAME: ea_read_inline
*
* FUNCTION: Read an inlined EA into user's buffer
*
......@@ -267,7 +267,7 @@ static int jfs_WriteEA(struct inode *ip, struct jfs_ea_list *ealist, int size,
*
* RETURNS: 0
*/
static int jfs_ReadEAInLine(struct inode *ip, struct jfs_ea_list *ealist)
static int ea_read_inline(struct inode *ip, struct jfs_ea_list *ealist)
{
struct jfs_inode_info *ji = JFS_IP(ip);
int ea_size = sizeDXD(&ji->ea);
......@@ -288,7 +288,7 @@ static int jfs_ReadEAInLine(struct inode *ip, struct jfs_ea_list *ealist)
}
/*
* NAME: jfs_ReadEA
* NAME: ea_read
*
* FUNCTION: copy EA data into user's buffer
*
......@@ -296,11 +296,11 @@ static int jfs_ReadEAInLine(struct inode *ip, struct jfs_ea_list *ealist)
* ip - Inode pointer
* ealist - Pointer to buffer to fill in with EA
*
* NOTES: If EA is inline calls jfs_ReadEAInLine() to copy EA.
* NOTES: If EA is inline calls ea_read_inline() to copy EA.
*
* RETURNS: 0 for success; other indicates failure
*/
static int jfs_ReadEA(struct inode *ip, struct jfs_ea_list *ealist)
static int ea_read(struct inode *ip, struct jfs_ea_list *ealist)
{
struct super_block *sb = ip->i_sb;
struct jfs_inode_info *ji = JFS_IP(ip);
......@@ -315,7 +315,7 @@ static int jfs_ReadEA(struct inode *ip, struct jfs_ea_list *ealist)
/* quick check for in-line EA */
if (ji->ea.flag & DXD_INLINE)
return jfs_ReadEAInLine(ip, ealist);
return ea_read_inline(ip, ealist);
nbytes = sizeDXD(&ji->ea);
assert(nbytes);
......@@ -372,7 +372,7 @@ static int jfs_ReadEA(struct inode *ip, struct jfs_ea_list *ealist)
*
* RETURNS: 0 for success; Other indicates failure
*/
int ea_get(struct inode *inode, struct ea_buffer *ea_buf, int min_size)
static int ea_get(struct inode *inode, struct ea_buffer *ea_buf, int min_size)
{
struct jfs_inode_info *ji = JFS_IP(inode);
struct super_block *sb = inode->i_sb;
......@@ -436,8 +436,7 @@ int ea_get(struct inode *inode, struct ea_buffer *ea_buf, int min_size)
if (ea_size == 0)
return 0;
rc = jfs_ReadEA(inode, ea_buf->xattr);
if (rc) {
if ((rc = ea_read(inode, ea_buf->xattr))) {
kfree(ea_buf->xattr);
ea_buf->xattr = NULL;
return rc;
......@@ -472,8 +471,7 @@ int ea_get(struct inode *inode, struct ea_buffer *ea_buf, int min_size)
~(sb->s_blocksize - 1);
if (ea_size == 0)
return 0;
rc = jfs_ReadEA(inode, ea_buf->xattr);
if (rc) {
if ((rc = ea_read(inode, ea_buf->xattr))) {
discard_metapage(ea_buf->mp);
dbFree(inode, blkno, (s64) blocks_needed);
return rc;
......@@ -500,7 +498,7 @@ int ea_get(struct inode *inode, struct ea_buffer *ea_buf, int min_size)
return ea_size;
}
void ea_release(struct inode *inode, struct ea_buffer *ea_buf)
static void ea_release(struct inode *inode, struct ea_buffer *ea_buf)
{
if (ea_buf->flag & EA_MALLOC)
kfree(ea_buf->xattr);
......@@ -514,7 +512,7 @@ void ea_release(struct inode *inode, struct ea_buffer *ea_buf)
}
}
int ea_put(struct inode *inode, struct ea_buffer *ea_buf, int new_size)
static int ea_put(struct inode *inode, struct ea_buffer *ea_buf, int new_size)
{
struct jfs_inode_info *ji = JFS_IP(inode);
unsigned long old_blocks, new_blocks;
......@@ -532,16 +530,14 @@ int ea_put(struct inode *inode, struct ea_buffer *ea_buf, int new_size)
DXDaddress(&ea_buf->new_ea, 0);
DXDlength(&ea_buf->new_ea, 0);
} else if (ea_buf->flag & EA_MALLOC) {
rc = jfs_WriteEA(inode, ea_buf->xattr, new_size,
&ea_buf->new_ea);
rc = ea_write(inode, ea_buf->xattr, new_size, &ea_buf->new_ea);
kfree(ea_buf->xattr);
} else if (ea_buf->flag & EA_NEW) {
/* We have already allocated a new dxd */
flush_metapage(ea_buf->mp);
} else {
/* ->xattr must point to original ea's metapage */
rc = jfs_WriteEA(inode, ea_buf->xattr, new_size,
&ea_buf->new_ea);
rc = ea_write(inode, ea_buf->xattr, new_size, &ea_buf->new_ea);
discard_metapage(ea_buf->mp);
}
if (rc)
......
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