Commit 6ad814c1 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Merge kroah.com:/home/greg/linux/BK/bleeding_edge-2.5

into kroah.com:/home/greg/linux/BK/gregkh-2.5
parents 2233e8ec c9581bb6
...@@ -318,7 +318,7 @@ prepare: include/linux/version.h include/asm include/config/MARKER ...@@ -318,7 +318,7 @@ prepare: include/linux/version.h include/asm include/config/MARKER
# This can be used by arch/$ARCH/Makefile to preprocess # This can be used by arch/$ARCH/Makefile to preprocess
# their vmlinux.lds.S file # their vmlinux.lds.S file
arch/$ARCH/vmlinux.lds.s: arch/$ARCH/vmlinux.lds.S arch/$(ARCH)/vmlinux.lds.s: arch/$(ARCH)/vmlinux.lds.S
$(CPP) $(CPPFLAGS) $(CPPFLAGS_$@) -P -C -U$(ARCH) $< -o $@ $(CPP) $(CPPFLAGS) $(CPPFLAGS_$@) -P -C -U$(ARCH) $< -o $@
# Single targets # Single targets
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
LDFLAGS := -m elf_i386 LDFLAGS := -m elf_i386
OBJCOPYFLAGS := -O binary -R .note -R .comment -S OBJCOPYFLAGS := -O binary -R .note -R .comment -S
LDFLAGS_vmlinux := -T arch/i386/vmlinux.lds -e stext LDFLAGS_vmlinux := -T arch/i386/vmlinux.lds.s -e stext
CFLAGS += -pipe CFLAGS += -pipe
...@@ -104,7 +104,7 @@ endif ...@@ -104,7 +104,7 @@ endif
MAKEBOOT = +$(MAKE) -C arch/$(ARCH)/boot MAKEBOOT = +$(MAKE) -C arch/$(ARCH)/boot
vmlinux: arch/i386/vmlinux.lds vmlinux: arch/i386/vmlinux.lds.s
.PHONY: zImage bzImage compressed zlilo bzlilo zdisk bzdisk install \ .PHONY: zImage bzImage compressed zlilo bzlilo zdisk bzdisk install \
clean archclean archmrproper clean archclean archmrproper
......
...@@ -60,7 +60,6 @@ int __init sensors_init(void); ...@@ -60,7 +60,6 @@ int __init sensors_init(void);
static struct ctl_table_header *i2c_entries[SENSORS_ENTRY_MAX]; static struct ctl_table_header *i2c_entries[SENSORS_ENTRY_MAX];
static struct i2c_client *i2c_clients[SENSORS_ENTRY_MAX]; static struct i2c_client *i2c_clients[SENSORS_ENTRY_MAX];
static unsigned short i2c_inodes[SENSORS_ENTRY_MAX];
static ctl_table sysctl_table[] = { static ctl_table sysctl_table[] = {
{CTL_DEV, "dev", NULL, 0, 0555}, {CTL_DEV, "dev", NULL, 0, 0555},
...@@ -189,8 +188,6 @@ int i2c_register_entry(struct i2c_client *client, const char *prefix, ...@@ -189,8 +188,6 @@ int i2c_register_entry(struct i2c_client *client, const char *prefix,
return id; return id;
} }
#endif /* DEBUG */ #endif /* DEBUG */
i2c_inodes[id - 256] =
new_header->ctl_table->child->child->de->low_ino;
new_header->ctl_table->child->child->de->owner = controlling_mod; new_header->ctl_table->child->child->de->owner = controlling_mod;
return id; return id;
...@@ -213,49 +210,6 @@ void i2c_deregister_entry(int id) ...@@ -213,49 +210,6 @@ void i2c_deregister_entry(int id)
} }
} }
/* Monitor access for /proc/sys/dev/sensors; make unloading i2c-proc.o
impossible if some process still uses it or some file in it */
void i2c_fill_inode(struct inode *inode, int fill)
{
if (fill)
MOD_INC_USE_COUNT;
else
MOD_DEC_USE_COUNT;
}
/* Monitor access for /proc/sys/dev/sensors/ directories; make unloading
the corresponding module impossible if some process still uses it or
some file in it */
void i2c_dir_fill_inode(struct inode *inode, int fill)
{
int i;
struct i2c_client *client;
#ifdef DEBUG
if (!inode) {
printk(KERN_ERR "i2c-proc.o: Warning: inode NULL in fill_inode()\n");
return;
}
#endif /* def DEBUG */
for (i = 0; i < SENSORS_ENTRY_MAX; i++)
if (i2c_clients[i]
&& (i2c_inodes[i] == inode->i_ino)) break;
#ifdef DEBUG
if (i == SENSORS_ENTRY_MAX) {
printk
(KERN_ERR "i2c-proc.o: Warning: inode (%ld) not found in fill_inode()\n",
inode->i_ino);
return;
}
#endif /* def DEBUG */
client = i2c_clients[i];
if (fill)
client->driver->inc_use(client);
else
client->driver->dec_use(client);
}
int i2c_proc_chips(ctl_table * ctl, int write, struct file *filp, int i2c_proc_chips(ctl_table * ctl, int write, struct file *filp,
void *buffer, size_t * lenp) void *buffer, size_t * lenp)
{ {
......
...@@ -1817,7 +1817,7 @@ static int idefloppy_ioctl (ide_drive_t *drive, struct inode *inode, struct file ...@@ -1817,7 +1817,7 @@ static int idefloppy_ioctl (ide_drive_t *drive, struct inode *inode, struct file
return (idefloppy_get_format_progress(drive, inode, file, return (idefloppy_get_format_progress(drive, inode, file,
(int *)arg)); (int *)arg));
} }
return -EIO; return -EINVAL;
} }
/* /*
......
...@@ -275,7 +275,6 @@ static void init_hwif_data (unsigned int index) ...@@ -275,7 +275,6 @@ static void init_hwif_data (unsigned int index)
drive->name[1] = 'd'; drive->name[1] = 'd';
drive->name[2] = 'a' + (index * MAX_DRIVES) + unit; drive->name[2] = 'a' + (index * MAX_DRIVES) + unit;
drive->max_failures = IDE_DEFAULT_MAX_FAILURES; drive->max_failures = IDE_DEFAULT_MAX_FAILURES;
init_waitqueue_head(&drive->wqueue);
INIT_LIST_HEAD(&drive->list); INIT_LIST_HEAD(&drive->list);
} }
} }
...@@ -1805,8 +1804,6 @@ static int ide_open (struct inode * inode, struct file * filp) ...@@ -1805,8 +1804,6 @@ static int ide_open (struct inode * inode, struct file * filp)
#endif /* defined(CONFIG_BLK_DEV_IDESCSI) && defined(CONFIG_SCSI) */ #endif /* defined(CONFIG_BLK_DEV_IDESCSI) && defined(CONFIG_SCSI) */
} }
#endif /* CONFIG_KMOD */ #endif /* CONFIG_KMOD */
while (drive->busy)
sleep_on(&drive->wqueue);
drive->usage++; drive->usage++;
if (drive->driver != NULL) if (drive->driver != NULL)
return DRIVER(drive)->open(inode, filp, drive); return DRIVER(drive)->open(inode, filp, drive);
...@@ -1877,7 +1874,7 @@ struct seq_operations ide_drivers_op = { ...@@ -1877,7 +1874,7 @@ struct seq_operations ide_drivers_op = {
*/ */
int ide_replace_subdriver (ide_drive_t *drive, const char *driver) int ide_replace_subdriver (ide_drive_t *drive, const char *driver)
{ {
if (!drive->present || drive->busy || drive->usage) if (!drive->present || drive->usage)
goto abort; goto abort;
if (drive->driver != NULL && DRIVER(drive)->cleanup(drive)) if (drive->driver != NULL && DRIVER(drive)->cleanup(drive))
goto abort; goto abort;
...@@ -1961,7 +1958,7 @@ void ide_unregister (unsigned int index) ...@@ -1961,7 +1958,7 @@ void ide_unregister (unsigned int index)
drive = &hwif->drives[unit]; drive = &hwif->drives[unit];
if (!drive->present) if (!drive->present)
continue; continue;
if (drive->busy || drive->usage) if (drive->usage)
goto abort; goto abort;
if (drive->driver != NULL && DRIVER(drive)->cleanup(drive)) if (drive->driver != NULL && DRIVER(drive)->cleanup(drive))
goto abort; goto abort;
...@@ -2653,18 +2650,6 @@ static int ide_ioctl (struct inode *inode, struct file *file, ...@@ -2653,18 +2650,6 @@ static int ide_ioctl (struct inode *inode, struct file *file,
} }
return 0; return 0;
} }
case BLKGETSIZE:
case BLKGETSIZE64:
case BLKROSET:
case BLKROGET:
case BLKFLSBUF:
case BLKSSZGET:
case BLKPG:
case BLKELVGET:
case BLKELVSET:
case BLKBSZGET:
case BLKBSZSET:
return blk_ioctl(inode->i_bdev, cmd, arg);
case CDROMEJECT: case CDROMEJECT:
case CDROMCLOSETRAY: case CDROMCLOSETRAY:
...@@ -3362,7 +3347,7 @@ static ide_startstop_t default_error (ide_drive_t *drive, const char *msg, byte ...@@ -3362,7 +3347,7 @@ static ide_startstop_t default_error (ide_drive_t *drive, const char *msg, byte
static int default_ioctl (ide_drive_t *drive, struct inode *inode, struct file *file, static int default_ioctl (ide_drive_t *drive, struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
return -EIO; return -EINVAL;
} }
static int default_open (struct inode *inode, struct file *filp, ide_drive_t *drive) static int default_open (struct inode *inode, struct file *filp, ide_drive_t *drive)
...@@ -3434,7 +3419,7 @@ int ide_register_subdriver (ide_drive_t *drive, ide_driver_t *driver, int versio ...@@ -3434,7 +3419,7 @@ int ide_register_subdriver (ide_drive_t *drive, ide_driver_t *driver, int versio
spin_lock_irqsave(&ide_lock, flags); spin_lock_irqsave(&ide_lock, flags);
if (version != IDE_SUBDRIVER_VERSION || !drive->present || if (version != IDE_SUBDRIVER_VERSION || !drive->present ||
drive->driver != NULL || drive->busy || drive->usage) { drive->driver != NULL || drive->usage) {
spin_unlock_irqrestore(&ide_lock, flags); spin_unlock_irqrestore(&ide_lock, flags);
return 1; return 1;
} }
...@@ -3463,8 +3448,7 @@ int ide_unregister_subdriver (ide_drive_t *drive) ...@@ -3463,8 +3448,7 @@ int ide_unregister_subdriver (ide_drive_t *drive)
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&ide_lock, flags); spin_lock_irqsave(&ide_lock, flags);
if (drive->usage || drive->busy || if (drive->usage || drive->driver == NULL || DRIVER(drive)->busy) {
drive->driver == NULL || DRIVER(drive)->busy) {
spin_unlock_irqrestore(&ide_lock, flags); spin_unlock_irqrestore(&ide_lock, flags);
return 1; return 1;
} }
......
...@@ -992,7 +992,7 @@ asmlinkage long sys_io_submit(aio_context_t ctx_id, long nr, ...@@ -992,7 +992,7 @@ asmlinkage long sys_io_submit(aio_context_t ctx_id, long nr,
break; break;
} }
if (unlikely(__copy_from_user(&tmp, user_iocb, sizeof(tmp)))) { if (unlikely(copy_from_user(&tmp, user_iocb, sizeof(tmp)))) {
ret = -EFAULT; ret = -EFAULT;
break; break;
} }
......
...@@ -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)
......
...@@ -368,7 +368,7 @@ struct inode { ...@@ -368,7 +368,7 @@ struct inode {
atomic_t i_count; atomic_t i_count;
dev_t i_dev; dev_t i_dev;
umode_t i_mode; umode_t i_mode;
nlink_t i_nlink; unsigned int i_nlink;
uid_t i_uid; uid_t i_uid;
gid_t i_gid; gid_t i_gid;
kdev_t i_rdev; kdev_t i_rdev;
......
...@@ -464,7 +464,6 @@ typedef struct ide_drive_s { ...@@ -464,7 +464,6 @@ typedef struct ide_drive_s {
byte nice1; /* flag: give potential excess bandwidth */ byte nice1; /* flag: give potential excess bandwidth */
unsigned present : 1; /* drive is physically present */ unsigned present : 1; /* drive is physically present */
unsigned noprobe : 1; /* from: hdx=noprobe */ unsigned noprobe : 1; /* from: hdx=noprobe */
unsigned busy : 1; /* currently doing revalidate_disk() */
unsigned removable : 1; /* 1 if need to do check_media_change */ unsigned removable : 1; /* 1 if need to do check_media_change */
unsigned forced_geom : 1; /* 1 if hdx=c,h,s was given at boot */ unsigned forced_geom : 1; /* 1 if hdx=c,h,s was given at boot */
unsigned no_unmask : 1; /* disallow setting unmask bit */ unsigned no_unmask : 1; /* disallow setting unmask bit */
...@@ -506,7 +505,6 @@ typedef struct ide_drive_s { ...@@ -506,7 +505,6 @@ typedef struct ide_drive_s {
unsigned long long capacity48; /* total number of sectors */ unsigned long long capacity48; /* total number of sectors */
unsigned int drive_data; /* for use by tuneproc/selectproc as needed */ unsigned int drive_data; /* for use by tuneproc/selectproc as needed */
struct hwif_s *hwif; /* actually (ide_hwif_t *) */ struct hwif_s *hwif; /* actually (ide_hwif_t *) */
wait_queue_head_t wqueue; /* used to wait for drive in open() */
struct hd_driveid *id; /* drive model identification info */ struct hd_driveid *id; /* drive model identification info */
struct hd_struct *part; /* drive partition table */ struct hd_struct *part; /* drive partition table */
char name[4]; /* drive name, such as "hda" */ char name[4]; /* drive name, such as "hda" */
......
...@@ -455,7 +455,7 @@ extern struct task_struct init_task; ...@@ -455,7 +455,7 @@ extern struct task_struct init_task;
extern struct mm_struct init_mm; extern struct mm_struct init_mm;
/* PID hashing. (shouldnt this be dynamic?) */ /* PID hashing. (shouldnt this be dynamic?) */
#define PIDHASH_SZ (4096 >> 2) #define PIDHASH_SZ 8192
extern struct task_struct *pidhash[PIDHASH_SZ]; extern struct task_struct *pidhash[PIDHASH_SZ];
#define pid_hashfn(x) ((((x) >> 8) ^ (x)) & (PIDHASH_SZ - 1)) #define pid_hashfn(x) ((((x) >> 8) ^ (x)) & (PIDHASH_SZ - 1))
......
...@@ -127,6 +127,7 @@ enum ...@@ -127,6 +127,7 @@ enum
KERN_CORE_USES_PID=52, /* int: use core or core.%pid */ KERN_CORE_USES_PID=52, /* int: use core or core.%pid */
KERN_TAINTED=53, /* int: various kernel tainted flags */ KERN_TAINTED=53, /* int: various kernel tainted flags */
KERN_CADPID=54, /* int: PID of the process to notify on CAD */ KERN_CADPID=54, /* int: PID of the process to notify on CAD */
KERN_PIDMAX=55, /* int: PID # limit */
}; };
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
/* /*
* This controls the maximum pid allocated to a process * This controls the maximum pid allocated to a process
*/ */
#define PID_MASK 0x3fffffff #define DEFAULT_PID_MAX 0x8000
#define PID_MAX (PID_MASK+1)
#endif #endif
...@@ -66,7 +66,8 @@ static void release_task(struct task_struct * p) ...@@ -66,7 +66,8 @@ static void release_task(struct task_struct * p)
atomic_dec(&p->user->processes); atomic_dec(&p->user->processes);
security_ops->task_free_security(p); security_ops->task_free_security(p);
free_uid(p->user); free_uid(p->user);
BUG_ON(!list_empty(&p->ptrace_list) || !list_empty(&p->ptrace_children)); BUG_ON(p->ptrace || !list_empty(&p->ptrace_list) ||
!list_empty(&p->ptrace_children));
unhash_process(p); unhash_process(p);
release_thread(p); release_thread(p);
...@@ -718,8 +719,14 @@ asmlinkage long sys_wait4(pid_t pid,unsigned int * stat_addr, int options, struc ...@@ -718,8 +719,14 @@ asmlinkage long sys_wait4(pid_t pid,unsigned int * stat_addr, int options, struc
ptrace_unlink(p); ptrace_unlink(p);
do_notify_parent(p, SIGCHLD); do_notify_parent(p, SIGCHLD);
write_unlock_irq(&tasklist_lock); write_unlock_irq(&tasklist_lock);
} else } else {
if (p->ptrace) {
write_lock_irq(&tasklist_lock);
ptrace_unlink(p);
write_unlock_irq(&tasklist_lock);
}
release_task(p); release_task(p);
}
goto end_wait4; goto end_wait4;
default: default:
continue; continue;
......
...@@ -46,6 +46,14 @@ int nr_threads; ...@@ -46,6 +46,14 @@ int nr_threads;
int max_threads; int max_threads;
unsigned long total_forks; /* Handle normal Linux uptimes. */ unsigned long total_forks; /* Handle normal Linux uptimes. */
/*
* Protects next_safe, last_pid and pid_max:
*/
spinlock_t lastpid_lock = SPIN_LOCK_UNLOCKED;
static int next_safe = DEFAULT_PID_MAX;
int pid_max = DEFAULT_PID_MAX;
int last_pid; int last_pid;
struct task_struct *pidhash[PIDHASH_SZ]; struct task_struct *pidhash[PIDHASH_SZ];
...@@ -151,11 +159,8 @@ static struct task_struct *dup_task_struct(struct task_struct *orig) ...@@ -151,11 +159,8 @@ static struct task_struct *dup_task_struct(struct task_struct *orig)
return tsk; return tsk;
} }
spinlock_t lastpid_lock = SPIN_LOCK_UNLOCKED;
static int get_pid(unsigned long flags) static int get_pid(unsigned long flags)
{ {
static int next_safe = PID_MAX;
struct task_struct *p; struct task_struct *p;
int pid; int pid;
...@@ -163,34 +168,35 @@ static int get_pid(unsigned long flags) ...@@ -163,34 +168,35 @@ static int get_pid(unsigned long flags)
return 0; return 0;
spin_lock(&lastpid_lock); spin_lock(&lastpid_lock);
if((++last_pid) & ~PID_MASK) { if (++last_pid > pid_max) {
last_pid = 300; /* Skip daemons etc. */ last_pid = 300; /* Skip daemons etc. */
goto inside; goto inside;
} }
if(last_pid >= next_safe) {
if (last_pid >= next_safe) {
inside: inside:
next_safe = PID_MAX; next_safe = pid_max;
read_lock(&tasklist_lock); read_lock(&tasklist_lock);
repeat: repeat:
for_each_task(p) { for_each_task(p) {
if(p->pid == last_pid || if (p->pid == last_pid ||
p->pgrp == last_pid || p->pgrp == last_pid ||
p->tgid == last_pid || p->tgid == last_pid ||
p->session == last_pid) { p->session == last_pid) {
if(++last_pid >= next_safe) { if (++last_pid >= next_safe) {
if(last_pid & ~PID_MASK) if (last_pid >= pid_max)
last_pid = 300; last_pid = 300;
next_safe = PID_MAX; next_safe = pid_max;
} }
goto repeat; goto repeat;
} }
if(p->pid > last_pid && next_safe > p->pid) if (p->pid > last_pid && next_safe > p->pid)
next_safe = p->pid; next_safe = p->pid;
if(p->pgrp > last_pid && next_safe > p->pgrp) if (p->pgrp > last_pid && next_safe > p->pgrp)
next_safe = p->pgrp; next_safe = p->pgrp;
if(p->tgid > last_pid && next_safe > p->tgid) if (p->tgid > last_pid && next_safe > p->tgid)
next_safe = p->tgid; next_safe = p->tgid;
if(p->session > last_pid && next_safe > p->session) if (p->session > last_pid && next_safe > p->session)
next_safe = p->session; next_safe = p->session;
} }
read_unlock(&tasklist_lock); read_unlock(&tasklist_lock);
......
...@@ -29,7 +29,7 @@ void __ptrace_link(task_t *child, task_t *new_parent) ...@@ -29,7 +29,7 @@ void __ptrace_link(task_t *child, task_t *new_parent)
if (!list_empty(&child->ptrace_list)) if (!list_empty(&child->ptrace_list))
BUG(); BUG();
if (child->parent == new_parent) if (child->parent == new_parent)
BUG(); return;
list_add(&child->ptrace_list, &child->parent->ptrace_children); list_add(&child->ptrace_list, &child->parent->ptrace_children);
REMOVE_LINKS(child); REMOVE_LINKS(child);
child->parent = new_parent; child->parent = new_parent;
......
...@@ -51,6 +51,7 @@ extern int max_queued_signals; ...@@ -51,6 +51,7 @@ extern int max_queued_signals;
extern int sysrq_enabled; extern int sysrq_enabled;
extern int core_uses_pid; extern int core_uses_pid;
extern int cad_pid; extern int cad_pid;
extern int pid_max;
/* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */ /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
static int maxolduid = 65535; static int maxolduid = 65535;
...@@ -255,6 +256,8 @@ static ctl_table kern_table[] = { ...@@ -255,6 +256,8 @@ static ctl_table kern_table[] = {
{KERN_S390_USER_DEBUG_LOGGING,"userprocess_debug", {KERN_S390_USER_DEBUG_LOGGING,"userprocess_debug",
&sysctl_userprocess_debug,sizeof(int),0644,NULL,&proc_dointvec}, &sysctl_userprocess_debug,sizeof(int),0644,NULL,&proc_dointvec},
#endif #endif
{KERN_PIDMAX, "pid_max", &pid_max, sizeof (int),
0600, NULL, &proc_dointvec},
{0} {0}
}; };
......
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