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 @@ ...@@ -24,9 +24,6 @@
#include "jfs_debug.h" #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); extern int jfs_commit_inode(struct inode *, int);
int jfs_fsync(struct file *file, struct dentry *dentry, int datasync) int jfs_fsync(struct file *file, struct dentry *dentry, int datasync)
...@@ -114,11 +111,3 @@ struct file_operations jfs_file_operations = { ...@@ -114,11 +111,3 @@ struct file_operations jfs_file_operations = {
.sendfile = generic_file_sendfile, .sendfile = generic_file_sendfile,
.fsync = jfs_fsync, .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 @@ ...@@ -31,7 +31,6 @@
extern struct inode_operations jfs_dir_inode_operations; extern struct inode_operations jfs_dir_inode_operations;
extern struct inode_operations jfs_file_inode_operations; extern struct inode_operations jfs_file_inode_operations;
extern struct inode_operations jfs_symlink_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_dir_operations;
extern struct file_operations jfs_file_operations; extern struct file_operations jfs_file_operations;
struct address_space_operations jfs_aops; struct address_space_operations jfs_aops;
...@@ -66,7 +65,7 @@ struct inode *jfs_iget(struct super_block *sb, ino_t ino) ...@@ -66,7 +65,7 @@ struct inode *jfs_iget(struct super_block *sb, ino_t ino)
} else } else
inode->i_op = &jfs_symlink_inode_operations; inode->i_op = &jfs_symlink_inode_operations;
} else { } else {
inode->i_op = &jfs_special_inode_operations; inode->i_op = &jfs_file_inode_operations;
init_special_inode(inode, inode->i_mode, init_special_inode(inode, inode->i_mode,
kdev_t_to_nr(inode->i_rdev)); kdev_t_to_nr(inode->i_rdev));
} }
......
...@@ -101,7 +101,6 @@ ...@@ -101,7 +101,6 @@
*/ */
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/smp_lock.h>
#include "jfs_incore.h" #include "jfs_incore.h"
#include "jfs_superblock.h" #include "jfs_superblock.h"
#include "jfs_filsys.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 @@ ...@@ -26,8 +26,9 @@
* forward references * forward references
*/ */
static int extBalloc(struct inode *, s64, s64 *, s64 *); static int extBalloc(struct inode *, s64, s64 *, s64 *);
#ifdef _NOTYET
static int extBrealloc(struct inode *, s64, s64, s64 *, s64 *); static int extBrealloc(struct inode *, s64, s64, s64 *, s64 *);
int extRecord(struct inode *, xad_t *); #endif
static s64 extRoundDown(s64 nb); static s64 extRoundDown(s64 nb);
/* /*
...@@ -191,6 +192,7 @@ extAlloc(struct inode *ip, s64 xlen, s64 pno, xad_t * xp, boolean_t abnr) ...@@ -191,6 +192,7 @@ extAlloc(struct inode *ip, s64 xlen, s64 pno, xad_t * xp, boolean_t abnr)
} }
#ifdef _NOTYET
/* /*
* NAME: extRealloc() * NAME: extRealloc()
* *
...@@ -335,6 +337,7 @@ int extRealloc(struct inode *ip, s64 nxlen, xad_t * xp, boolean_t abnr) ...@@ -335,6 +337,7 @@ int extRealloc(struct inode *ip, s64 nxlen, xad_t * xp, boolean_t abnr)
up(&JFS_IP(ip)->commit_sem); up(&JFS_IP(ip)->commit_sem);
return (rc); return (rc);
} }
#endif /* _NOTYET */
/* /*
...@@ -440,6 +443,7 @@ int extRecord(struct inode *ip, xad_t * xp) ...@@ -440,6 +443,7 @@ int extRecord(struct inode *ip, xad_t * xp)
} }
#ifdef _NOTYET
/* /*
* NAME: extFill() * NAME: extFill()
* *
...@@ -473,6 +477,7 @@ int extFill(struct inode *ip, xad_t * xp) ...@@ -473,6 +477,7 @@ int extFill(struct inode *ip, xad_t * xp)
return (0); return (0);
} }
#endif /* _NOTYET */
/* /*
...@@ -548,6 +553,7 @@ extBalloc(struct inode *ip, s64 hint, s64 * nblocks, s64 * blkno) ...@@ -548,6 +553,7 @@ extBalloc(struct inode *ip, s64 hint, s64 * nblocks, s64 * blkno)
} }
#ifdef _NOTYET
/* /*
* NAME: extBrealloc() * NAME: extBrealloc()
* *
...@@ -601,6 +607,7 @@ extBrealloc(struct inode *ip, ...@@ -601,6 +607,7 @@ extBrealloc(struct inode *ip,
*/ */
return (extBalloc(ip, blkno, newnblks, newblkno)); return (extBalloc(ip, blkno, newnblks, newblkno));
} }
#endif /* _NOTYET */
/* /*
......
...@@ -42,6 +42,8 @@ ...@@ -42,6 +42,8 @@
*/ */
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/buffer_head.h>
#include "jfs_incore.h" #include "jfs_incore.h"
#include "jfs_filsys.h" #include "jfs_filsys.h"
#include "jfs_dinode.h" #include "jfs_dinode.h"
...@@ -1175,7 +1177,7 @@ int diFree(struct inode *ip) ...@@ -1175,7 +1177,7 @@ int diFree(struct inode *ip)
* invalidate any page of the inode extent freed from buffer cache; * invalidate any page of the inode extent freed from buffer cache;
*/ */
freepxd = iagp->inoext[extno]; 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) * update iag list(s) (careful update step 2)
...@@ -2963,26 +2965,30 @@ printf("diExtendFS: iag:%d agstart:%Ld agno:%d\n", i, agstart, n); ...@@ -2963,26 +2965,30 @@ printf("diExtendFS: iag:%d agstart:%Ld agno:%d\n", i, agstart, n);
* *
* note: shadow page with regular inode (rel.2); * note: shadow page with regular inode (rel.2);
*/ */
static void static void duplicateIXtree(struct super_block *sb, s64 blkno,
duplicateIXtree(struct super_block *sb, s64 blkno, int xlen, s64 * xaddr) int xlen, s64 *xaddr)
{ {
int rc;
tid_t tid;
struct inode *ip;
metapage_t *mpsuper;
struct jfs_superblock *j_sb; 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 AIT2 ipmap2 is bad, do not try to update it */
if (JFS_SBI(sb)->mntflag & JFS_BAD_SAIT) /* s_flag */ if (JFS_SBI(sb)->mntflag & JFS_BAD_SAIT) /* s_flag */
return; return;
ip = diReadSpecial(sb, FILESYSTEM_I, 1); ip = diReadSpecial(sb, FILESYSTEM_I, 1);
if (ip == 0) { if (ip == NULL) {
JFS_SBI(sb)->mntflag |= JFS_BAD_SAIT; JFS_SBI(sb)->mntflag |= JFS_BAD_SAIT;
if ((rc = readSuper(sb, &mpsuper))) if ((rc = readSuper(sb, &bh)))
return; return;
j_sb = (struct jfs_superblock *) (mpsuper->data); j_sb = (struct jfs_superblock *)bh->b_data;
j_sb->s_flag |= JFS_BAD_SAIT; 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; return;
} }
......
...@@ -152,8 +152,6 @@ struct jfs_sb_info { ...@@ -152,8 +152,6 @@ struct jfs_sb_info {
/* Formerly in ipbmap */ /* Formerly in ipbmap */
struct bmap *bmap; /* 4: incore bmap descriptor */ struct bmap *bmap; /* 4: incore bmap descriptor */
struct nls_table *nls_tab; /* 4: current codepage */ 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 */ uint state; /* 4: mount/recovery state */
}; };
......
...@@ -960,17 +960,19 @@ int lmLogSync(log_t * log, int nosyncwait) ...@@ -960,17 +960,19 @@ int lmLogSync(log_t * log, int nosyncwait)
* reset syncpt = sync * reset syncpt = sync
*/ */
if (log->sync != log->syncpt) { 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 * We need to make sure all of the "written" metapages
* actually make it to disk * actually make it to disk
*/ */
filemap_fdatawrite(sbi->ipbmap->i_mapping); filemap_fdatawrite(sbi->ipbmap->i_mapping);
filemap_fdatawrite(sbi->ipimap->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->ipbmap->i_mapping);
filemap_fdatawait(sbi->ipimap->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.logtid = 0;
lrd.backchain = 0; lrd.backchain = 0;
...@@ -1985,6 +1987,7 @@ static void lbmIODone(struct bio *bio) ...@@ -1985,6 +1987,7 @@ static void lbmIODone(struct bio *bio)
jERROR(1, ("lbmIODone: I/O error in JFS log\n")); jERROR(1, ("lbmIODone: I/O error in JFS log\n"));
} }
bio_put(bio); bio_put(bio);
/* /*
...@@ -2102,7 +2105,6 @@ static void lbmIODone(struct bio *bio) ...@@ -2102,7 +2105,6 @@ static void lbmIODone(struct bio *bio)
LCACHE_UNLOCK(flags); /* unlock+enable */ LCACHE_UNLOCK(flags); /* unlock+enable */
} }
return;
} }
int jfsIOWait(void *arg) int jfsIOWait(void *arg)
......
...@@ -27,16 +27,13 @@ ...@@ -27,16 +27,13 @@
#include "jfs_txnmgr.h" #include "jfs_txnmgr.h"
#include "jfs_debug.h" #include "jfs_debug.h"
extern struct task_struct *jfsCommitTask;
static spinlock_t meta_lock = SPIN_LOCK_UNLOCKED; static spinlock_t meta_lock = SPIN_LOCK_UNLOCKED;
static wait_queue_head_t meta_wait;
#ifdef CONFIG_JFS_STATISTICS #ifdef CONFIG_JFS_STATISTICS
struct { struct {
uint pagealloc; /* # of page allocations */ uint pagealloc; /* # of page allocations */
uint pagefree; /* # of page frees */ uint pagefree; /* # of page frees */
uint lockwait; /* # of sleeping lock_metapage() calls */ uint lockwait; /* # of sleeping lock_metapage() calls */
uint allocwait; /* # of sleeping alloc_metapage() calls */
} mpStat; } mpStat;
#endif #endif
...@@ -134,11 +131,6 @@ static void mp_mempool_free(void *element, void *pool_data) ...@@ -134,11 +131,6 @@ static void mp_mempool_free(void *element, void *pool_data)
int __init metapage_init(void) int __init metapage_init(void)
{ {
/*
* Initialize wait queue
*/
init_waitqueue_head(&meta_wait);
/* /*
* Allocate the metapage structures * Allocate the metapage structures
*/ */
...@@ -225,51 +217,6 @@ static void remove_from_hash(metapage_t * mp, metapage_t ** hash_ptr) ...@@ -225,51 +217,6 @@ static void remove_from_hash(metapage_t * mp, metapage_t ** hash_ptr)
mp->hash_next->hash_prev = mp->hash_prev; 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, metapage_t *__get_metapage(struct inode *inode,
unsigned long lblock, unsigned int size, unsigned long lblock, unsigned int size,
int absolute, unsigned long new) int absolute, unsigned long new)
...@@ -286,14 +233,12 @@ metapage_t *__get_metapage(struct inode *inode, ...@@ -286,14 +233,12 @@ metapage_t *__get_metapage(struct inode *inode,
inode, lblock)); inode, lblock));
if (absolute) if (absolute)
mapping = JFS_SBI(inode->i_sb)->direct_mapping; mapping = inode->i_sb->s_bdev->bd_inode->i_mapping;
else else
mapping = inode->i_mapping; mapping = inode->i_mapping;
spin_lock(&meta_lock); spin_lock(&meta_lock);
hash_ptr = meta_hash(mapping, lblock); hash_ptr = meta_hash(mapping, lblock);
mp = search_hash(hash_ptr, mapping, lblock); mp = search_hash(hash_ptr, mapping, lblock);
if (mp) { if (mp) {
page_found: page_found:
...@@ -309,7 +254,7 @@ metapage_t *__get_metapage(struct inode *inode, ...@@ -309,7 +254,7 @@ metapage_t *__get_metapage(struct inode *inode,
lock_metapage(mp); lock_metapage(mp);
spin_unlock(&meta_lock); spin_unlock(&meta_lock);
} else { } else {
l2bsize = inode->i_sb->s_blocksize_bits; l2bsize = inode->i_blkbits;
l2BlocksPerPage = PAGE_CACHE_SHIFT - l2bsize; l2BlocksPerPage = PAGE_CACHE_SHIFT - l2bsize;
page_index = lblock >> l2BlocksPerPage; page_index = lblock >> l2BlocksPerPage;
page_offset = (lblock - (page_index << l2BlocksPerPage)) << page_offset = (lblock - (page_index << l2BlocksPerPage)) <<
...@@ -431,12 +376,11 @@ void hold_metapage(metapage_t * mp, int force) ...@@ -431,12 +376,11 @@ void hold_metapage(metapage_t * mp, int force)
static void __write_metapage(metapage_t * mp) 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_index;
unsigned long page_offset; unsigned long page_offset;
int rc; 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)); jFYI(1, ("__write_metapage: mp = 0x%p\n", mp));
...@@ -561,7 +505,7 @@ void __invalidate_metapages(struct inode *ip, s64 addr, int len) ...@@ -561,7 +505,7 @@ void __invalidate_metapages(struct inode *ip, s64 addr, int len)
{ {
metapage_t **hash_ptr; metapage_t **hash_ptr;
unsigned long lblock; 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; struct address_space *mapping = ip->i_mapping;
metapage_t *mp; metapage_t *mp;
struct page *page; struct page *page;
...@@ -624,12 +568,10 @@ int jfs_mpstat_read(char *buffer, char **start, off_t offset, int length, ...@@ -624,12 +568,10 @@ int jfs_mpstat_read(char *buffer, char **start, off_t offset, int length,
"=======================\n" "=======================\n"
"page allocations = %d\n" "page allocations = %d\n"
"page frees = %d\n" "page frees = %d\n"
"lock waits = %d\n" "lock waits = %d\n",
"allocation waits = %d\n",
mpStat.pagealloc, mpStat.pagealloc,
mpStat.pagefree, mpStat.pagefree,
mpStat.lockwait, mpStat.lockwait);
mpStat.allocwait);
begin = offset; begin = offset;
*start = buffer + begin; *start = buffer + begin;
......
...@@ -57,11 +57,6 @@ typedef struct metapage { ...@@ -57,11 +57,6 @@ typedef struct metapage {
struct jfs_log *log; struct jfs_log *log;
} metapage_t; } metapage_t;
/*
* Direct-access address space operations
*/
extern struct address_space_operations direct_aops;
/* metapage flag */ /* metapage flag */
#define META_locked 0 #define META_locked 0
#define META_absolute 1 #define META_absolute 1
......
...@@ -48,6 +48,8 @@ ...@@ -48,6 +48,8 @@
*/ */
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/buffer_head.h>
#include "jfs_incore.h" #include "jfs_incore.h"
#include "jfs_filsys.h" #include "jfs_filsys.h"
#include "jfs_superblock.h" #include "jfs_superblock.h"
...@@ -314,18 +316,18 @@ int jfs_mount_rw(struct super_block *sb, int remount) ...@@ -314,18 +316,18 @@ int jfs_mount_rw(struct super_block *sb, int remount)
static int chkSuper(struct super_block *sb) static int chkSuper(struct super_block *sb)
{ {
int rc = 0; int rc = 0;
metapage_t *mp;
struct jfs_sb_info *sbi = JFS_SBI(sb); struct jfs_sb_info *sbi = JFS_SBI(sb);
struct jfs_superblock *j_sb; struct jfs_superblock *j_sb;
struct buffer_head *bh;
int AIM_bytesize, AIT_bytesize; int AIM_bytesize, AIT_bytesize;
int expected_AIM_bytesize, expected_AIT_bytesize; int expected_AIM_bytesize, expected_AIT_bytesize;
s64 AIM_byte_addr, AIT_byte_addr, fsckwsp_addr; s64 AIM_byte_addr, AIT_byte_addr, fsckwsp_addr;
s64 byte_addr_diff0, byte_addr_diff1; s64 byte_addr_diff0, byte_addr_diff1;
s32 bsize; s32 bsize;
if ((rc = readSuper(sb, &mp))) if ((rc = readSuper(sb, &bh)))
return rc; return rc;
j_sb = (struct jfs_superblock *) (mp->data); j_sb = (struct jfs_superblock *)bh->b_data;
/* /*
* validate superblock * validate superblock
...@@ -414,8 +416,7 @@ static int chkSuper(struct super_block *sb) ...@@ -414,8 +416,7 @@ static int chkSuper(struct super_block *sb)
sbi->ait2 = j_sb->s_ait2; sbi->ait2 = j_sb->s_ait2;
out: out:
release_metapage(mp); brelse(bh);
return rc; return rc;
} }
...@@ -429,7 +430,7 @@ int updateSuper(struct super_block *sb, uint state) ...@@ -429,7 +430,7 @@ int updateSuper(struct super_block *sb, uint state)
{ {
struct jfs_superblock *j_sb; struct jfs_superblock *j_sb;
struct jfs_sb_info *sbi = JFS_SBI(sb); struct jfs_sb_info *sbi = JFS_SBI(sb);
metapage_t *mp; struct buffer_head *bh;
int rc; int rc;
/* /*
...@@ -438,10 +439,10 @@ int updateSuper(struct super_block *sb, uint state) ...@@ -438,10 +439,10 @@ int updateSuper(struct super_block *sb, uint state)
if (sbi->state == FM_DIRTY) if (sbi->state == FM_DIRTY)
return 0; return 0;
if ((rc = readSuper(sb, &mp))) if ((rc = readSuper(sb, &bh)))
return rc; 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); j_sb->s_state = cpu_to_le32(state);
sbi->state = state; sbi->state = state;
...@@ -459,7 +460,10 @@ int updateSuper(struct super_block *sb, uint state) ...@@ -459,7 +460,10 @@ int updateSuper(struct super_block *sb, uint state)
j_sb->s_flag |= cpu_to_le32(JFS_DASD_PRIME); 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; return 0;
} }
...@@ -470,18 +474,19 @@ int updateSuper(struct super_block *sb, uint state) ...@@ -470,18 +474,19 @@ int updateSuper(struct super_block *sb, uint state)
* *
* read superblock by raw sector address * 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 */ /* read in primary superblock */
*mpp = read_metapage(JFS_SBI(sb)->direct_inode, *bpp = sb_bread(sb, SUPER1_OFF >> sb->s_blocksize_bits);
SUPER1_OFF >> sb->s_blocksize_bits, PSIZE, 1); if (bpp)
if (*mpp == NULL) { return 0;
/* read in secondary/replicated superblock */
*mpp = read_metapage(JFS_SBI(sb)->direct_inode, /* read in secondary/replicated superblock */
SUPER2_OFF >> sb->s_blocksize_bits, *bpp = sb_bread(sb, SUPER2_OFF >> sb->s_blocksize_bits);
PSIZE, 1); if (bpp)
} return 0;
return *mpp ? 0 : 1;
return -EIO;
} }
......
...@@ -106,7 +106,7 @@ struct jfs_superblock { ...@@ -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); extern int updateSuper(struct super_block *, uint);
#endif /*_H_JFS_SUPERBLOCK */ #endif /*_H_JFS_SUPERBLOCK */
...@@ -144,7 +144,6 @@ struct { ...@@ -144,7 +144,6 @@ struct {
*/ */
extern int lmGroupCommit(log_t * log, tblock_t * tblk); extern int lmGroupCommit(log_t * log, tblock_t * tblk);
extern void lmSync(log_t *); 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_commit_inode(struct inode *, int);
extern int jfs_stop_threads; extern int jfs_stop_threads;
......
...@@ -49,13 +49,14 @@ ...@@ -49,13 +49,14 @@
*/ */
int jfs_umount(struct super_block *sb) int jfs_umount(struct super_block *sb)
{ {
int rc = 0; struct address_space *bdev_mapping = sb->s_bdev->bd_inode->i_mapping;
log_t *log;
struct jfs_sb_info *sbi = JFS_SBI(sb); struct jfs_sb_info *sbi = JFS_SBI(sb);
struct inode *ipbmap = sbi->ipbmap; struct inode *ipbmap = sbi->ipbmap;
struct inode *ipimap = sbi->ipimap; struct inode *ipimap = sbi->ipimap;
struct inode *ipaimap = sbi->ipaimap; struct inode *ipaimap = sbi->ipaimap;
struct inode *ipaimap2 = sbi->ipaimap2; struct inode *ipaimap2 = sbi->ipaimap2;
log_t *log;
int rc = 0;
jFYI(1, ("\n UnMount JFS: sb:0x%p\n", sb)); jFYI(1, ("\n UnMount JFS: sb:0x%p\n", sb));
...@@ -112,8 +113,8 @@ int jfs_umount(struct super_block *sb) ...@@ -112,8 +113,8 @@ int jfs_umount(struct super_block *sb)
* Make sure all metadata makes it to disk before we mark * Make sure all metadata makes it to disk before we mark
* the superblock as clean * the superblock as clean
*/ */
filemap_fdatawrite(sbi->direct_inode->i_mapping); filemap_fdatawrite(bdev_mapping);
filemap_fdatawait(sbi->direct_inode->i_mapping); filemap_fdatawait(bdev_mapping);
/* /*
* ensure all file system file pages are propagated to their * ensure all file system file pages are propagated to their
...@@ -140,6 +141,7 @@ int jfs_umount(struct super_block *sb) ...@@ -140,6 +141,7 @@ int jfs_umount(struct super_block *sb)
int jfs_umount_rw(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); struct jfs_sb_info *sbi = JFS_SBI(sb);
log_t *log = sbi->log; log_t *log = sbi->log;
...@@ -158,8 +160,15 @@ int jfs_umount_rw(struct super_block *sb) ...@@ -158,8 +160,15 @@ int jfs_umount_rw(struct super_block *sb)
*/ */
dbSync(sbi->ipbmap); dbSync(sbi->ipbmap);
diSync(sbi->ipimap); 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); updateSuper(sb, FM_CLEAN);
sbi->log = NULL; sbi->log = NULL;
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
extern struct inode_operations jfs_file_inode_operations; extern struct inode_operations jfs_file_inode_operations;
extern struct inode_operations jfs_symlink_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 file_operations jfs_file_operations;
extern struct address_space_operations jfs_aops; extern struct address_space_operations jfs_aops;
...@@ -1338,7 +1337,7 @@ int jfs_mknod(struct inode *dir, struct dentry *dentry, int mode, int rdev) ...@@ -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))) if ((rc = dtInsert(tid, dir, &dname, &ino, &btstack)))
goto out3; goto out3;
ip->i_op = &jfs_special_inode_operations; ip->i_op = &jfs_file_inode_operations;
init_special_inode(ip, ip->i_mode, rdev); init_special_inode(ip, ip->i_mode, rdev);
insert_inode_hash(ip); insert_inode_hash(ip);
......
...@@ -79,9 +79,8 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize) ...@@ -79,9 +79,8 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize)
int log_formatted = 0; int log_formatted = 0;
struct inode *iplist[1]; struct inode *iplist[1];
struct jfs_superblock *j_sb, *j_sb2; struct jfs_superblock *j_sb, *j_sb2;
metapage_t *sbp, *sb2p;
uint old_agsize; uint old_agsize;
struct buffer_head *bh; struct buffer_head *bh, *bh2;
/* If the volume hasn't grown, get out now */ /* If the volume hasn't grown, get out now */
...@@ -230,9 +229,9 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize) ...@@ -230,9 +229,9 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize)
*/ */
/* read in superblock */ /* read in superblock */
if ((rc = readSuper(sb, &sbp))) if ((rc = readSuper(sb, &bh)))
goto error_out; goto error_out;
j_sb = (struct jfs_superblock *) (sbp->data); j_sb = (struct jfs_superblock *)bh->b_data;
/* mark extendfs() in progress */ /* mark extendfs() in progress */
j_sb->s_state |= cpu_to_le32(FM_EXTENDFS); j_sb->s_state |= cpu_to_le32(FM_EXTENDFS);
...@@ -243,7 +242,10 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize) ...@@ -243,7 +242,10 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize)
PXDlength(&j_sb->s_xlogpxd, newLogSize); PXDlength(&j_sb->s_xlogpxd, newLogSize);
/* synchronously update superblock */ /* 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; * format new inline log synchronously;
...@@ -474,12 +476,13 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize) ...@@ -474,12 +476,13 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize)
diWriteSpecial(ipbmap2, 1); diWriteSpecial(ipbmap2, 1);
diFreeSpecial(ipbmap2); diFreeSpecial(ipbmap2);
/* /*
* update superblock * update superblock
*/ */
if ((rc = readSuper(sb, &sbp))) if ((rc = readSuper(sb, &bh)))
goto error_out; goto error_out;
j_sb = (struct jfs_superblock *) (sbp->data); j_sb = (struct jfs_superblock *)bh->b_data;
/* mark extendfs() completion */ /* mark extendfs() completion */
j_sb->s_state &= cpu_to_le32(~FM_EXTENDFS); j_sb->s_state &= cpu_to_le32(~FM_EXTENDFS);
...@@ -503,17 +506,22 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize) ...@@ -503,17 +506,22 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize)
/* sb->s_fsckloglen remains the same */ /* sb->s_fsckloglen remains the same */
/* Update secondary superblock */ /* Update secondary superblock */
sb2p = read_metapage(sbi->direct_inode, bh2 = sb_bread(sb, SUPER2_OFF >> sb->s_blocksize_bits);
SUPER2_OFF >> sb->s_blocksize_bits, PSIZE, 1); if (bh2) {
j_sb2 = (struct jfs_superblock *)bh2->b_data;
if (sb2p) {
j_sb2 = (struct jfs_superblock *) (sb2p->data);
memcpy(j_sb2, j_sb, sizeof (struct jfs_superblock)); 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 */ /* write primary superblock */
flush_metapage(sbp); mark_buffer_dirty(bh);
ll_rw_block(WRITE, 1, &bh);
wait_on_buffer(bh);
brelse(bh);
goto resume; goto resume;
......
...@@ -142,17 +142,6 @@ static void jfs_put_super(struct super_block *sb) ...@@ -142,17 +142,6 @@ static void jfs_put_super(struct super_block *sb)
unload_nls(sbi->nls_tab); unload_nls(sbi->nls_tab);
sbi->nls_tab = NULL; 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); kfree(sbi);
} }
...@@ -221,7 +210,6 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize) ...@@ -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) int jfs_remount(struct super_block *sb, int *flags, char *data)
{ {
struct jfs_sb_info *sbi = JFS_SBI(sb);
s64 newLVSize = 0; s64 newLVSize = 0;
int rc = 0; int rc = 0;
...@@ -239,15 +227,9 @@ int jfs_remount(struct super_block *sb, int *flags, char *data) ...@@ -239,15 +227,9 @@ 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))
/*
* 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);
return jfs_mount_rw(sb, 1); 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 jfs_umount_rw(sb);
return 0; return 0;
...@@ -289,28 +271,13 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -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_op = &jfs_super_operations;
sb->s_export_op = &jfs_export_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); rc = jfs_mount(sb);
if (rc) { if (rc) {
if (!silent) { if (!silent) {
jERROR(1, jERROR(1,
("jfs_mount failed w/return code = %d\n", rc)); ("jfs_mount failed w/return code = %d\n", rc));
} }
goto out_mount_failed; goto out_kfree;
} }
if (sb->s_flags & MS_RDONLY) if (sb->s_flags & MS_RDONLY)
sbi->log = 0; sbi->log = 0;
...@@ -360,14 +327,6 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -360,14 +327,6 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
if (rc) { if (rc) {
jERROR(1, ("jfs_umount failed with return code %d\n", 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: out_kfree:
if (sbi->nls_tab) if (sbi->nls_tab)
unload_nls(sbi->nls_tab); unload_nls(sbi->nls_tab);
......
...@@ -79,10 +79,10 @@ struct ea_buffer { ...@@ -79,10 +79,10 @@ struct ea_buffer {
#define EA_MALLOC 0x0008 #define EA_MALLOC 0x0008
/* Forward references */ /* 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 * 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); ...@@ -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 * 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, static int ea_write_inline(struct inode *ip, struct jfs_ea_list *ealist,
int size, dxd_t * ea) int size, dxd_t * ea)
{ {
struct jfs_inode_info *ji = JFS_IP(ip); struct jfs_inode_info *ji = JFS_IP(ip);
...@@ -144,7 +144,7 @@ static int jfs_WriteEAInLine(struct inode *ip, struct jfs_ea_list *ealist, ...@@ -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 * FUNCTION: Write an EA for an inode
* *
...@@ -162,7 +162,7 @@ static int jfs_WriteEAInLine(struct inode *ip, struct jfs_ea_list *ealist, ...@@ -162,7 +162,7 @@ static int jfs_WriteEAInLine(struct inode *ip, struct jfs_ea_list *ealist,
* *
* RETURNS: 0 for success; Anything else indicates failure * 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) dxd_t * ea)
{ {
struct super_block *sb = ip->i_sb; 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, ...@@ -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. * and empty EAs are all in-linable, provided the space exists.
*/ */
if (!ealist || size <= sizeof (ji->i_inline_ea)) { 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; return 0;
} }
...@@ -257,7 +257,7 @@ static int jfs_WriteEA(struct inode *ip, struct jfs_ea_list *ealist, int size, ...@@ -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 * 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, ...@@ -267,7 +267,7 @@ static int jfs_WriteEA(struct inode *ip, struct jfs_ea_list *ealist, int size,
* *
* RETURNS: 0 * 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); struct jfs_inode_info *ji = JFS_IP(ip);
int ea_size = sizeDXD(&ji->ea); int ea_size = sizeDXD(&ji->ea);
...@@ -288,7 +288,7 @@ static int jfs_ReadEAInLine(struct inode *ip, struct jfs_ea_list *ealist) ...@@ -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 * FUNCTION: copy EA data into user's buffer
* *
...@@ -296,11 +296,11 @@ static int jfs_ReadEAInLine(struct inode *ip, struct jfs_ea_list *ealist) ...@@ -296,11 +296,11 @@ static int jfs_ReadEAInLine(struct inode *ip, struct jfs_ea_list *ealist)
* ip - Inode pointer * ip - Inode pointer
* ealist - Pointer to buffer to fill in with EA * 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 * 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 super_block *sb = ip->i_sb;
struct jfs_inode_info *ji = JFS_IP(ip); struct jfs_inode_info *ji = JFS_IP(ip);
...@@ -315,7 +315,7 @@ static int jfs_ReadEA(struct inode *ip, struct jfs_ea_list *ealist) ...@@ -315,7 +315,7 @@ static int jfs_ReadEA(struct inode *ip, struct jfs_ea_list *ealist)
/* quick check for in-line EA */ /* quick check for in-line EA */
if (ji->ea.flag & DXD_INLINE) if (ji->ea.flag & DXD_INLINE)
return jfs_ReadEAInLine(ip, ealist); return ea_read_inline(ip, ealist);
nbytes = sizeDXD(&ji->ea); nbytes = sizeDXD(&ji->ea);
assert(nbytes); assert(nbytes);
...@@ -372,7 +372,7 @@ static int jfs_ReadEA(struct inode *ip, struct jfs_ea_list *ealist) ...@@ -372,7 +372,7 @@ static int jfs_ReadEA(struct inode *ip, struct jfs_ea_list *ealist)
* *
* RETURNS: 0 for success; Other indicates failure * 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 jfs_inode_info *ji = JFS_IP(inode);
struct super_block *sb = inode->i_sb; 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) ...@@ -436,8 +436,7 @@ int ea_get(struct inode *inode, struct ea_buffer *ea_buf, int min_size)
if (ea_size == 0) if (ea_size == 0)
return 0; return 0;
rc = jfs_ReadEA(inode, ea_buf->xattr); if ((rc = ea_read(inode, ea_buf->xattr))) {
if (rc) {
kfree(ea_buf->xattr); kfree(ea_buf->xattr);
ea_buf->xattr = NULL; ea_buf->xattr = NULL;
return rc; return rc;
...@@ -472,8 +471,7 @@ int ea_get(struct inode *inode, struct ea_buffer *ea_buf, int min_size) ...@@ -472,8 +471,7 @@ int ea_get(struct inode *inode, struct ea_buffer *ea_buf, int min_size)
~(sb->s_blocksize - 1); ~(sb->s_blocksize - 1);
if (ea_size == 0) if (ea_size == 0)
return 0; return 0;
rc = jfs_ReadEA(inode, ea_buf->xattr); if ((rc = ea_read(inode, ea_buf->xattr))) {
if (rc) {
discard_metapage(ea_buf->mp); discard_metapage(ea_buf->mp);
dbFree(inode, blkno, (s64) blocks_needed); dbFree(inode, blkno, (s64) blocks_needed);
return rc; return rc;
...@@ -500,7 +498,7 @@ int ea_get(struct inode *inode, struct ea_buffer *ea_buf, int min_size) ...@@ -500,7 +498,7 @@ int ea_get(struct inode *inode, struct ea_buffer *ea_buf, int min_size)
return ea_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) if (ea_buf->flag & EA_MALLOC)
kfree(ea_buf->xattr); kfree(ea_buf->xattr);
...@@ -514,7 +512,7 @@ void ea_release(struct inode *inode, struct ea_buffer *ea_buf) ...@@ -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); struct jfs_inode_info *ji = JFS_IP(inode);
unsigned long old_blocks, new_blocks; unsigned long old_blocks, new_blocks;
...@@ -532,16 +530,14 @@ int ea_put(struct inode *inode, struct ea_buffer *ea_buf, int new_size) ...@@ -532,16 +530,14 @@ int ea_put(struct inode *inode, struct ea_buffer *ea_buf, int new_size)
DXDaddress(&ea_buf->new_ea, 0); DXDaddress(&ea_buf->new_ea, 0);
DXDlength(&ea_buf->new_ea, 0); DXDlength(&ea_buf->new_ea, 0);
} else if (ea_buf->flag & EA_MALLOC) { } else if (ea_buf->flag & EA_MALLOC) {
rc = jfs_WriteEA(inode, ea_buf->xattr, new_size, rc = ea_write(inode, ea_buf->xattr, new_size, &ea_buf->new_ea);
&ea_buf->new_ea);
kfree(ea_buf->xattr); kfree(ea_buf->xattr);
} else if (ea_buf->flag & EA_NEW) { } else if (ea_buf->flag & EA_NEW) {
/* We have already allocated a new dxd */ /* We have already allocated a new dxd */
flush_metapage(ea_buf->mp); flush_metapage(ea_buf->mp);
} else { } else {
/* ->xattr must point to original ea's metapage */ /* ->xattr must point to original ea's metapage */
rc = jfs_WriteEA(inode, ea_buf->xattr, new_size, rc = ea_write(inode, ea_buf->xattr, new_size, &ea_buf->new_ea);
&ea_buf->new_ea);
discard_metapage(ea_buf->mp); discard_metapage(ea_buf->mp);
} }
if (rc) 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