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
# This can be used by arch/$ARCH/Makefile to preprocess
# 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 $@
# Single targets
......
......@@ -18,7 +18,7 @@
LDFLAGS := -m elf_i386
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
......@@ -104,7 +104,7 @@ endif
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 \
clean archclean archmrproper
......
......@@ -60,7 +60,6 @@ int __init sensors_init(void);
static struct ctl_table_header *i2c_entries[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[] = {
{CTL_DEV, "dev", NULL, 0, 0555},
......@@ -189,8 +188,6 @@ int i2c_register_entry(struct i2c_client *client, const char *prefix,
return id;
}
#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;
return 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,
void *buffer, size_t * lenp)
{
......
......@@ -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,
(int *)arg));
}
return -EIO;
return -EINVAL;
}
/*
......
......@@ -275,7 +275,6 @@ static void init_hwif_data (unsigned int index)
drive->name[1] = 'd';
drive->name[2] = 'a' + (index * MAX_DRIVES) + unit;
drive->max_failures = IDE_DEFAULT_MAX_FAILURES;
init_waitqueue_head(&drive->wqueue);
INIT_LIST_HEAD(&drive->list);
}
}
......@@ -1805,8 +1804,6 @@ static int ide_open (struct inode * inode, struct file * filp)
#endif /* defined(CONFIG_BLK_DEV_IDESCSI) && defined(CONFIG_SCSI) */
}
#endif /* CONFIG_KMOD */
while (drive->busy)
sleep_on(&drive->wqueue);
drive->usage++;
if (drive->driver != NULL)
return DRIVER(drive)->open(inode, filp, drive);
......@@ -1877,7 +1874,7 @@ struct seq_operations ide_drivers_op = {
*/
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;
if (drive->driver != NULL && DRIVER(drive)->cleanup(drive))
goto abort;
......@@ -1961,7 +1958,7 @@ void ide_unregister (unsigned int index)
drive = &hwif->drives[unit];
if (!drive->present)
continue;
if (drive->busy || drive->usage)
if (drive->usage)
goto abort;
if (drive->driver != NULL && DRIVER(drive)->cleanup(drive))
goto abort;
......@@ -2653,18 +2650,6 @@ static int ide_ioctl (struct inode *inode, struct file *file,
}
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 CDROMCLOSETRAY:
......@@ -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,
unsigned int cmd, unsigned long arg)
{
return -EIO;
return -EINVAL;
}
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
spin_lock_irqsave(&ide_lock, flags);
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);
return 1;
}
......@@ -3463,8 +3448,7 @@ int ide_unregister_subdriver (ide_drive_t *drive)
unsigned long flags;
spin_lock_irqsave(&ide_lock, flags);
if (drive->usage || drive->busy ||
drive->driver == NULL || DRIVER(drive)->busy) {
if (drive->usage || drive->driver == NULL || DRIVER(drive)->busy) {
spin_unlock_irqrestore(&ide_lock, flags);
return 1;
}
......
......@@ -992,7 +992,7 @@ asmlinkage long sys_io_submit(aio_context_t ctx_id, long nr,
break;
}
if (unlikely(__copy_from_user(&tmp, user_iocb, sizeof(tmp)))) {
if (unlikely(copy_from_user(&tmp, user_iocb, sizeof(tmp)))) {
ret = -EFAULT;
break;
}
......
......@@ -24,9 +24,6 @@
#include "jfs_debug.h"
extern int generic_file_open(struct inode *, struct file *);
extern loff_t generic_file_llseek(struct file *, loff_t, int origin);
extern int jfs_commit_inode(struct inode *, int);
int jfs_fsync(struct file *file, struct dentry *dentry, int datasync)
......@@ -114,11 +111,3 @@ struct file_operations jfs_file_operations = {
.sendfile = generic_file_sendfile,
.fsync = jfs_fsync,
};
struct inode_operations jfs_special_inode_operations = {
.setxattr = jfs_setxattr,
.getxattr = jfs_getxattr,
.listxattr = jfs_listxattr,
.removexattr = jfs_removexattr,
};
......@@ -31,7 +31,6 @@
extern struct inode_operations jfs_dir_inode_operations;
extern struct inode_operations jfs_file_inode_operations;
extern struct inode_operations jfs_symlink_inode_operations;
extern struct inode_operations jfs_special_inode_operations;
extern struct file_operations jfs_dir_operations;
extern struct file_operations jfs_file_operations;
struct address_space_operations jfs_aops;
......@@ -66,7 +65,7 @@ struct inode *jfs_iget(struct super_block *sb, ino_t ino)
} else
inode->i_op = &jfs_symlink_inode_operations;
} else {
inode->i_op = &jfs_special_inode_operations;
inode->i_op = &jfs_file_inode_operations;
init_special_inode(inode, inode->i_mode,
kdev_t_to_nr(inode->i_rdev));
}
......
......@@ -101,7 +101,6 @@
*/
#include <linux/fs.h>
#include <linux/smp_lock.h>
#include "jfs_incore.h"
#include "jfs_superblock.h"
#include "jfs_filsys.h"
......
/*
* Copyright (c) International Business Machines Corp., 2000-2001
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
* the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _H_JFS_EXTENDFS
#define _H_JFS_EXTENDFS
/*
* extendfs parameter list
*/
typedef struct {
u32 flag; /* 4: */
u8 dev; /* 1: */
u8 pad[3]; /* 3: */
s64 LVSize; /* 8: LV size in LV block */
s64 FSSize; /* 8: FS size in LV block */
s32 LogSize; /* 4: inlinelog size in LV block */
} extendfs_t; /* (28) */
/* plist flag */
#define EXTENDFS_QUERY 0x00000001
#endif /* _H_JFS_EXTENDFS */
......@@ -26,8 +26,9 @@
* forward references
*/
static int extBalloc(struct inode *, s64, s64 *, s64 *);
#ifdef _NOTYET
static int extBrealloc(struct inode *, s64, s64, s64 *, s64 *);
int extRecord(struct inode *, xad_t *);
#endif
static s64 extRoundDown(s64 nb);
/*
......@@ -191,6 +192,7 @@ extAlloc(struct inode *ip, s64 xlen, s64 pno, xad_t * xp, boolean_t abnr)
}
#ifdef _NOTYET
/*
* NAME: extRealloc()
*
......@@ -335,6 +337,7 @@ int extRealloc(struct inode *ip, s64 nxlen, xad_t * xp, boolean_t abnr)
up(&JFS_IP(ip)->commit_sem);
return (rc);
}
#endif /* _NOTYET */
/*
......@@ -440,6 +443,7 @@ int extRecord(struct inode *ip, xad_t * xp)
}
#ifdef _NOTYET
/*
* NAME: extFill()
*
......@@ -473,6 +477,7 @@ int extFill(struct inode *ip, xad_t * xp)
return (0);
}
#endif /* _NOTYET */
/*
......@@ -548,6 +553,7 @@ extBalloc(struct inode *ip, s64 hint, s64 * nblocks, s64 * blkno)
}
#ifdef _NOTYET
/*
* NAME: extBrealloc()
*
......@@ -601,6 +607,7 @@ extBrealloc(struct inode *ip,
*/
return (extBalloc(ip, blkno, newnblks, newblkno));
}
#endif /* _NOTYET */
/*
......
......@@ -42,6 +42,8 @@
*/
#include <linux/fs.h>
#include <linux/buffer_head.h>
#include "jfs_incore.h"
#include "jfs_filsys.h"
#include "jfs_dinode.h"
......@@ -1175,7 +1177,7 @@ int diFree(struct inode *ip)
* invalidate any page of the inode extent freed from buffer cache;
*/
freepxd = iagp->inoext[extno];
invalidate_pxd_metapages(JFS_SBI(ip->i_sb)->direct_inode, freepxd);
invalidate_pxd_metapages(ip->i_sb->s_bdev->bd_inode, freepxd);
/*
* update iag list(s) (careful update step 2)
......@@ -2963,26 +2965,30 @@ printf("diExtendFS: iag:%d agstart:%Ld agno:%d\n", i, agstart, n);
*
* note: shadow page with regular inode (rel.2);
*/
static void
duplicateIXtree(struct super_block *sb, s64 blkno, int xlen, s64 * xaddr)
static void duplicateIXtree(struct super_block *sb, s64 blkno,
int xlen, s64 *xaddr)
{
int rc;
tid_t tid;
struct inode *ip;
metapage_t *mpsuper;
struct jfs_superblock *j_sb;
struct buffer_head *bh;
struct inode *ip;
tid_t tid;
int rc;
/* if AIT2 ipmap2 is bad, do not try to update it */
if (JFS_SBI(sb)->mntflag & JFS_BAD_SAIT) /* s_flag */
return;
ip = diReadSpecial(sb, FILESYSTEM_I, 1);
if (ip == 0) {
if (ip == NULL) {
JFS_SBI(sb)->mntflag |= JFS_BAD_SAIT;
if ((rc = readSuper(sb, &mpsuper)))
if ((rc = readSuper(sb, &bh)))
return;
j_sb = (struct jfs_superblock *) (mpsuper->data);
j_sb = (struct jfs_superblock *)bh->b_data;
j_sb->s_flag |= JFS_BAD_SAIT;
write_metapage(mpsuper);
mark_buffer_dirty(bh);
ll_rw_block(WRITE, 1, &bh);
wait_on_buffer(bh);
brelse(bh);
return;
}
......
......@@ -152,8 +152,6 @@ struct jfs_sb_info {
/* Formerly in ipbmap */
struct bmap *bmap; /* 4: incore bmap descriptor */
struct nls_table *nls_tab; /* 4: current codepage */
struct inode *direct_inode; /* 4: inode for physical I/O */
struct address_space *direct_mapping; /* 4: mapping for physical I/O */
uint state; /* 4: mount/recovery state */
};
......
......@@ -960,17 +960,19 @@ int lmLogSync(log_t * log, int nosyncwait)
* reset syncpt = sync
*/
if (log->sync != log->syncpt) {
struct jfs_sb_info *sbi = JFS_SBI(log->sb);
struct super_block *sb = log->sb;
struct jfs_sb_info *sbi = JFS_SBI(sb);
/*
* We need to make sure all of the "written" metapages
* actually make it to disk
*/
filemap_fdatawrite(sbi->ipbmap->i_mapping);
filemap_fdatawrite(sbi->ipimap->i_mapping);
filemap_fdatawrite(sbi->direct_inode->i_mapping);
filemap_fdatawrite(sb->s_bdev->bd_inode->i_mapping);
filemap_fdatawait(sbi->ipbmap->i_mapping);
filemap_fdatawait(sbi->ipimap->i_mapping);
filemap_fdatawait(sbi->direct_inode->i_mapping);
filemap_fdatawait(sb->s_bdev->bd_inode->i_mapping);
lrd.logtid = 0;
lrd.backchain = 0;
......@@ -1985,6 +1987,7 @@ static void lbmIODone(struct bio *bio)
jERROR(1, ("lbmIODone: I/O error in JFS log\n"));
}
bio_put(bio);
/*
......@@ -2102,7 +2105,6 @@ static void lbmIODone(struct bio *bio)
LCACHE_UNLOCK(flags); /* unlock+enable */
}
return;
}
int jfsIOWait(void *arg)
......
......@@ -27,16 +27,13 @@
#include "jfs_txnmgr.h"
#include "jfs_debug.h"
extern struct task_struct *jfsCommitTask;
static spinlock_t meta_lock = SPIN_LOCK_UNLOCKED;
static wait_queue_head_t meta_wait;
#ifdef CONFIG_JFS_STATISTICS
struct {
uint pagealloc; /* # of page allocations */
uint pagefree; /* # of page frees */
uint lockwait; /* # of sleeping lock_metapage() calls */
uint allocwait; /* # of sleeping alloc_metapage() calls */
} mpStat;
#endif
......@@ -134,11 +131,6 @@ static void mp_mempool_free(void *element, void *pool_data)
int __init metapage_init(void)
{
/*
* Initialize wait queue
*/
init_waitqueue_head(&meta_wait);
/*
* Allocate the metapage structures
*/
......@@ -225,51 +217,6 @@ static void remove_from_hash(metapage_t * mp, metapage_t ** hash_ptr)
mp->hash_next->hash_prev = mp->hash_prev;
}
/*
* Direct address space operations
*/
static int direct_get_block(struct inode *ip, sector_t lblock,
struct buffer_head *bh_result, int create)
{
if (create)
set_buffer_new(bh_result);
map_bh(bh_result, ip->i_sb, lblock);
return 0;
}
static int direct_writepage(struct page *page)
{
return block_write_full_page(page, direct_get_block);
}
static int direct_readpage(struct file *fp, struct page *page)
{
return block_read_full_page(page, direct_get_block);
}
static int direct_prepare_write(struct file *file, struct page *page,
unsigned from, unsigned to)
{
return block_prepare_write(page, from, to, direct_get_block);
}
static int direct_bmap(struct address_space *mapping, long block)
{
return generic_block_bmap(mapping, block, direct_get_block);
}
struct address_space_operations direct_aops = {
.readpage = direct_readpage,
.writepage = direct_writepage,
.sync_page = block_sync_page,
.prepare_write = direct_prepare_write,
.commit_write = generic_commit_write,
.bmap = direct_bmap,
};
metapage_t *__get_metapage(struct inode *inode,
unsigned long lblock, unsigned int size,
int absolute, unsigned long new)
......@@ -286,14 +233,12 @@ metapage_t *__get_metapage(struct inode *inode,
inode, lblock));
if (absolute)
mapping = JFS_SBI(inode->i_sb)->direct_mapping;
mapping = inode->i_sb->s_bdev->bd_inode->i_mapping;
else
mapping = inode->i_mapping;
spin_lock(&meta_lock);
hash_ptr = meta_hash(mapping, lblock);
mp = search_hash(hash_ptr, mapping, lblock);
if (mp) {
page_found:
......@@ -309,7 +254,7 @@ metapage_t *__get_metapage(struct inode *inode,
lock_metapage(mp);
spin_unlock(&meta_lock);
} else {
l2bsize = inode->i_sb->s_blocksize_bits;
l2bsize = inode->i_blkbits;
l2BlocksPerPage = PAGE_CACHE_SHIFT - l2bsize;
page_index = lblock >> l2BlocksPerPage;
page_offset = (lblock - (page_index << l2BlocksPerPage)) <<
......@@ -431,12 +376,11 @@ void hold_metapage(metapage_t * mp, int force)
static void __write_metapage(metapage_t * mp)
{
struct inode *ip = (struct inode *) mp->mapping->host;
int l2bsize = mp->mapping->host->i_blkbits;
int l2BlocksPerPage = PAGE_CACHE_SHIFT - l2bsize;
unsigned long page_index;
unsigned long page_offset;
int rc;
int l2bsize = ip->i_sb->s_blocksize_bits;
int l2BlocksPerPage = PAGE_CACHE_SHIFT - l2bsize;
jFYI(1, ("__write_metapage: mp = 0x%p\n", mp));
......@@ -561,7 +505,7 @@ void __invalidate_metapages(struct inode *ip, s64 addr, int len)
{
metapage_t **hash_ptr;
unsigned long lblock;
int l2BlocksPerPage = PAGE_CACHE_SHIFT - ip->i_sb->s_blocksize_bits;
int l2BlocksPerPage = PAGE_CACHE_SHIFT - ip->i_blkbits;
struct address_space *mapping = ip->i_mapping;
metapage_t *mp;
struct page *page;
......@@ -624,12 +568,10 @@ int jfs_mpstat_read(char *buffer, char **start, off_t offset, int length,
"=======================\n"
"page allocations = %d\n"
"page frees = %d\n"
"lock waits = %d\n"
"allocation waits = %d\n",
"lock waits = %d\n",
mpStat.pagealloc,
mpStat.pagefree,
mpStat.lockwait,
mpStat.allocwait);
mpStat.lockwait);
begin = offset;
*start = buffer + begin;
......
......@@ -57,11 +57,6 @@ typedef struct metapage {
struct jfs_log *log;
} metapage_t;
/*
* Direct-access address space operations
*/
extern struct address_space_operations direct_aops;
/* metapage flag */
#define META_locked 0
#define META_absolute 1
......
......@@ -48,6 +48,8 @@
*/
#include <linux/fs.h>
#include <linux/buffer_head.h>
#include "jfs_incore.h"
#include "jfs_filsys.h"
#include "jfs_superblock.h"
......@@ -314,18 +316,18 @@ int jfs_mount_rw(struct super_block *sb, int remount)
static int chkSuper(struct super_block *sb)
{
int rc = 0;
metapage_t *mp;
struct jfs_sb_info *sbi = JFS_SBI(sb);
struct jfs_superblock *j_sb;
struct buffer_head *bh;
int AIM_bytesize, AIT_bytesize;
int expected_AIM_bytesize, expected_AIT_bytesize;
s64 AIM_byte_addr, AIT_byte_addr, fsckwsp_addr;
s64 byte_addr_diff0, byte_addr_diff1;
s32 bsize;
if ((rc = readSuper(sb, &mp)))
if ((rc = readSuper(sb, &bh)))
return rc;
j_sb = (struct jfs_superblock *) (mp->data);
j_sb = (struct jfs_superblock *)bh->b_data;
/*
* validate superblock
......@@ -414,8 +416,7 @@ static int chkSuper(struct super_block *sb)
sbi->ait2 = j_sb->s_ait2;
out:
release_metapage(mp);
brelse(bh);
return rc;
}
......@@ -429,7 +430,7 @@ int updateSuper(struct super_block *sb, uint state)
{
struct jfs_superblock *j_sb;
struct jfs_sb_info *sbi = JFS_SBI(sb);
metapage_t *mp;
struct buffer_head *bh;
int rc;
/*
......@@ -438,10 +439,10 @@ int updateSuper(struct super_block *sb, uint state)
if (sbi->state == FM_DIRTY)
return 0;
if ((rc = readSuper(sb, &mp)))
if ((rc = readSuper(sb, &bh)))
return rc;
j_sb = (struct jfs_superblock *) (mp->data);
j_sb = (struct jfs_superblock *)bh->b_data;
j_sb->s_state = cpu_to_le32(state);
sbi->state = state;
......@@ -459,7 +460,10 @@ int updateSuper(struct super_block *sb, uint state)
j_sb->s_flag |= cpu_to_le32(JFS_DASD_PRIME);
}
flush_metapage(mp);
mark_buffer_dirty(bh);
ll_rw_block(WRITE, 1, &bh);
wait_on_buffer(bh);
brelse(bh);
return 0;
}
......@@ -470,18 +474,19 @@ int updateSuper(struct super_block *sb, uint state)
*
* read superblock by raw sector address
*/
int readSuper(struct super_block *sb, metapage_t ** mpp)
int readSuper(struct super_block *sb, struct buffer_head **bpp)
{
/* read in primary superblock */
*mpp = read_metapage(JFS_SBI(sb)->direct_inode,
SUPER1_OFF >> sb->s_blocksize_bits, PSIZE, 1);
if (*mpp == NULL) {
*bpp = sb_bread(sb, SUPER1_OFF >> sb->s_blocksize_bits);
if (bpp)
return 0;
/* read in secondary/replicated superblock */
*mpp = read_metapage(JFS_SBI(sb)->direct_inode,
SUPER2_OFF >> sb->s_blocksize_bits,
PSIZE, 1);
}
return *mpp ? 0 : 1;
*bpp = sb_bread(sb, SUPER2_OFF >> sb->s_blocksize_bits);
if (bpp)
return 0;
return -EIO;
}
......
......@@ -106,7 +106,7 @@ struct jfs_superblock {
};
extern int readSuper(struct super_block *, struct metapage **);
extern int readSuper(struct super_block *, struct buffer_head **);
extern int updateSuper(struct super_block *, uint);
#endif /*_H_JFS_SUPERBLOCK */
......@@ -144,7 +144,6 @@ struct {
*/
extern int lmGroupCommit(log_t * log, tblock_t * tblk);
extern void lmSync(log_t *);
extern int readSuper(struct super_block *sb, metapage_t ** bpp);
extern int jfs_commit_inode(struct inode *, int);
extern int jfs_stop_threads;
......
......@@ -49,13 +49,14 @@
*/
int jfs_umount(struct super_block *sb)
{
int rc = 0;
log_t *log;
struct address_space *bdev_mapping = sb->s_bdev->bd_inode->i_mapping;
struct jfs_sb_info *sbi = JFS_SBI(sb);
struct inode *ipbmap = sbi->ipbmap;
struct inode *ipimap = sbi->ipimap;
struct inode *ipaimap = sbi->ipaimap;
struct inode *ipaimap2 = sbi->ipaimap2;
log_t *log;
int rc = 0;
jFYI(1, ("\n UnMount JFS: sb:0x%p\n", sb));
......@@ -112,8 +113,8 @@ int jfs_umount(struct super_block *sb)
* Make sure all metadata makes it to disk before we mark
* the superblock as clean
*/
filemap_fdatawrite(sbi->direct_inode->i_mapping);
filemap_fdatawait(sbi->direct_inode->i_mapping);
filemap_fdatawrite(bdev_mapping);
filemap_fdatawait(bdev_mapping);
/*
* ensure all file system file pages are propagated to their
......@@ -140,6 +141,7 @@ int jfs_umount(struct super_block *sb)
int jfs_umount_rw(struct super_block *sb)
{
struct address_space *bdev_mapping = sb->s_bdev->bd_inode->i_mapping;
struct jfs_sb_info *sbi = JFS_SBI(sb);
log_t *log = sbi->log;
......@@ -158,8 +160,15 @@ int jfs_umount_rw(struct super_block *sb)
*/
dbSync(sbi->ipbmap);
diSync(sbi->ipimap);
filemap_fdatawrite(sbi->direct_inode->i_mapping);
filemap_fdatawait(sbi->direct_inode->i_mapping);
/*
* Note that we have to do this even if sync_blockdev() will
* do exactly the same a few instructions later: We can't
* mark the superblock clean before everything is flushed to
* disk.
*/
filemap_fdatawrite(bdev_mapping);
filemap_fdatawait(bdev_mapping);
updateSuper(sb, FM_CLEAN);
sbi->log = NULL;
......
......@@ -29,7 +29,6 @@
extern struct inode_operations jfs_file_inode_operations;
extern struct inode_operations jfs_symlink_inode_operations;
extern struct inode_operations jfs_special_inode_operations;
extern struct file_operations jfs_file_operations;
extern struct address_space_operations jfs_aops;
......@@ -1338,7 +1337,7 @@ int jfs_mknod(struct inode *dir, struct dentry *dentry, int mode, int rdev)
if ((rc = dtInsert(tid, dir, &dname, &ino, &btstack)))
goto out3;
ip->i_op = &jfs_special_inode_operations;
ip->i_op = &jfs_file_inode_operations;
init_special_inode(ip, ip->i_mode, rdev);
insert_inode_hash(ip);
......
......@@ -79,9 +79,8 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize)
int log_formatted = 0;
struct inode *iplist[1];
struct jfs_superblock *j_sb, *j_sb2;
metapage_t *sbp, *sb2p;
uint old_agsize;
struct buffer_head *bh;
struct buffer_head *bh, *bh2;
/* If the volume hasn't grown, get out now */
......@@ -230,9 +229,9 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize)
*/
/* read in superblock */
if ((rc = readSuper(sb, &sbp)))
if ((rc = readSuper(sb, &bh)))
goto error_out;
j_sb = (struct jfs_superblock *) (sbp->data);
j_sb = (struct jfs_superblock *)bh->b_data;
/* mark extendfs() in progress */
j_sb->s_state |= cpu_to_le32(FM_EXTENDFS);
......@@ -243,7 +242,10 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize)
PXDlength(&j_sb->s_xlogpxd, newLogSize);
/* synchronously update superblock */
flush_metapage(sbp);
mark_buffer_dirty(bh);
ll_rw_block(WRITE, 1, &bh);
wait_on_buffer(bh);
brelse(bh);
/*
* format new inline log synchronously;
......@@ -474,12 +476,13 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize)
diWriteSpecial(ipbmap2, 1);
diFreeSpecial(ipbmap2);
/*
* update superblock
*/
if ((rc = readSuper(sb, &sbp)))
if ((rc = readSuper(sb, &bh)))
goto error_out;
j_sb = (struct jfs_superblock *) (sbp->data);
j_sb = (struct jfs_superblock *)bh->b_data;
/* mark extendfs() completion */
j_sb->s_state &= cpu_to_le32(~FM_EXTENDFS);
......@@ -503,17 +506,22 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize)
/* sb->s_fsckloglen remains the same */
/* Update secondary superblock */
sb2p = read_metapage(sbi->direct_inode,
SUPER2_OFF >> sb->s_blocksize_bits, PSIZE, 1);
if (sb2p) {
j_sb2 = (struct jfs_superblock *) (sb2p->data);
bh2 = sb_bread(sb, SUPER2_OFF >> sb->s_blocksize_bits);
if (bh2) {
j_sb2 = (struct jfs_superblock *)bh2->b_data;
memcpy(j_sb2, j_sb, sizeof (struct jfs_superblock));
flush_metapage(sb2p);
mark_buffer_dirty(bh);
ll_rw_block(WRITE, 1, &bh2);
wait_on_buffer(bh2);
brelse(bh);
}
/* write primary superblock */
flush_metapage(sbp);
mark_buffer_dirty(bh);
ll_rw_block(WRITE, 1, &bh);
wait_on_buffer(bh);
brelse(bh);
goto resume;
......
......@@ -142,17 +142,6 @@ static void jfs_put_super(struct super_block *sb)
unload_nls(sbi->nls_tab);
sbi->nls_tab = NULL;
/*
* We need to clean out the direct_inode pages since this inode
* is not in the inode hash.
*/
filemap_fdatawrite(sbi->direct_inode->i_mapping);
filemap_fdatawait(sbi->direct_inode->i_mapping);
truncate_inode_pages(sbi->direct_mapping, 0);
iput(sbi->direct_inode);
sbi->direct_inode = NULL;
sbi->direct_mapping = NULL;
kfree(sbi);
}
......@@ -221,7 +210,6 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize)
int jfs_remount(struct super_block *sb, int *flags, char *data)
{
struct jfs_sb_info *sbi = JFS_SBI(sb);
s64 newLVSize = 0;
int rc = 0;
......@@ -239,15 +227,9 @@ int jfs_remount(struct super_block *sb, int *flags, char *data)
return rc;
}
if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY)) {
/*
* Invalidate any previously read metadata. fsck may
* have changed the on-disk data since we mounted r/o
*/
truncate_inode_pages(sbi->direct_mapping, 0);
if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY))
return jfs_mount_rw(sb, 1);
} else if ((!(sb->s_flags & MS_RDONLY)) && (*flags & MS_RDONLY))
else if ((!(sb->s_flags & MS_RDONLY)) && (*flags & MS_RDONLY))
return jfs_umount_rw(sb);
return 0;
......@@ -289,28 +271,13 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
sb->s_op = &jfs_super_operations;
sb->s_export_op = &jfs_export_operations;
/*
* Initialize direct-mapping inode/address-space
*/
inode = new_inode(sb);
if (inode == NULL)
goto out_kfree;
inode->i_ino = 0;
inode->i_nlink = 1;
inode->i_size = 0x0000010000000000LL;
inode->i_mapping->a_ops = &direct_aops;
inode->i_mapping->gfp_mask = GFP_NOFS;
sbi->direct_inode = inode;
sbi->direct_mapping = inode->i_mapping;
rc = jfs_mount(sb);
if (rc) {
if (!silent) {
jERROR(1,
("jfs_mount failed w/return code = %d\n", rc));
}
goto out_mount_failed;
goto out_kfree;
}
if (sb->s_flags & MS_RDONLY)
sbi->log = 0;
......@@ -360,14 +327,6 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
if (rc) {
jERROR(1, ("jfs_umount failed with return code %d\n", rc));
}
out_mount_failed:
filemap_fdatawrite(sbi->direct_inode->i_mapping);
filemap_fdatawait(sbi->direct_inode->i_mapping);
truncate_inode_pages(sbi->direct_mapping, 0);
make_bad_inode(sbi->direct_inode);
iput(sbi->direct_inode);
sbi->direct_inode = NULL;
sbi->direct_mapping = NULL;
out_kfree:
if (sbi->nls_tab)
unload_nls(sbi->nls_tab);
......
......@@ -79,10 +79,10 @@ struct ea_buffer {
#define EA_MALLOC 0x0008
/* Forward references */
void ea_release(struct inode *inode, struct ea_buffer *ea_buf);
static void ea_release(struct inode *inode, struct ea_buffer *ea_buf);
/*
* NAME: jfs_WriteEAInLine
* NAME: ea_write_inline
*
* FUNCTION: Attempt to write an EA inline if area is available
*
......@@ -103,7 +103,7 @@ void ea_release(struct inode *inode, struct ea_buffer *ea_buf);
*
* RETURNS: 0 for successful copy to inline area; -1 if area not available
*/
static int jfs_WriteEAInLine(struct inode *ip, struct jfs_ea_list *ealist,
static int ea_write_inline(struct inode *ip, struct jfs_ea_list *ealist,
int size, dxd_t * ea)
{
struct jfs_inode_info *ji = JFS_IP(ip);
......@@ -144,7 +144,7 @@ static int jfs_WriteEAInLine(struct inode *ip, struct jfs_ea_list *ealist,
}
/*
* NAME: jfs_WriteEA
* NAME: ea_write
*
* FUNCTION: Write an EA for an inode
*
......@@ -162,7 +162,7 @@ static int jfs_WriteEAInLine(struct inode *ip, struct jfs_ea_list *ealist,
*
* RETURNS: 0 for success; Anything else indicates failure
*/
static int jfs_WriteEA(struct inode *ip, struct jfs_ea_list *ealist, int size,
static int ea_write(struct inode *ip, struct jfs_ea_list *ealist, int size,
dxd_t * ea)
{
struct super_block *sb = ip->i_sb;
......@@ -181,7 +181,7 @@ static int jfs_WriteEA(struct inode *ip, struct jfs_ea_list *ealist, int size,
* and empty EAs are all in-linable, provided the space exists.
*/
if (!ealist || size <= sizeof (ji->i_inline_ea)) {
if (!jfs_WriteEAInLine(ip, ealist, size, ea))
if (!ea_write_inline(ip, ealist, size, ea))
return 0;
}
......@@ -257,7 +257,7 @@ static int jfs_WriteEA(struct inode *ip, struct jfs_ea_list *ealist, int size,
}
/*
* NAME: jfs_ReadEAInLine
* NAME: ea_read_inline
*
* FUNCTION: Read an inlined EA into user's buffer
*
......@@ -267,7 +267,7 @@ static int jfs_WriteEA(struct inode *ip, struct jfs_ea_list *ealist, int size,
*
* RETURNS: 0
*/
static int jfs_ReadEAInLine(struct inode *ip, struct jfs_ea_list *ealist)
static int ea_read_inline(struct inode *ip, struct jfs_ea_list *ealist)
{
struct jfs_inode_info *ji = JFS_IP(ip);
int ea_size = sizeDXD(&ji->ea);
......@@ -288,7 +288,7 @@ static int jfs_ReadEAInLine(struct inode *ip, struct jfs_ea_list *ealist)
}
/*
* NAME: jfs_ReadEA
* NAME: ea_read
*
* FUNCTION: copy EA data into user's buffer
*
......@@ -296,11 +296,11 @@ static int jfs_ReadEAInLine(struct inode *ip, struct jfs_ea_list *ealist)
* ip - Inode pointer
* ealist - Pointer to buffer to fill in with EA
*
* NOTES: If EA is inline calls jfs_ReadEAInLine() to copy EA.
* NOTES: If EA is inline calls ea_read_inline() to copy EA.
*
* RETURNS: 0 for success; other indicates failure
*/
static int jfs_ReadEA(struct inode *ip, struct jfs_ea_list *ealist)
static int ea_read(struct inode *ip, struct jfs_ea_list *ealist)
{
struct super_block *sb = ip->i_sb;
struct jfs_inode_info *ji = JFS_IP(ip);
......@@ -315,7 +315,7 @@ static int jfs_ReadEA(struct inode *ip, struct jfs_ea_list *ealist)
/* quick check for in-line EA */
if (ji->ea.flag & DXD_INLINE)
return jfs_ReadEAInLine(ip, ealist);
return ea_read_inline(ip, ealist);
nbytes = sizeDXD(&ji->ea);
assert(nbytes);
......@@ -372,7 +372,7 @@ static int jfs_ReadEA(struct inode *ip, struct jfs_ea_list *ealist)
*
* RETURNS: 0 for success; Other indicates failure
*/
int ea_get(struct inode *inode, struct ea_buffer *ea_buf, int min_size)
static int ea_get(struct inode *inode, struct ea_buffer *ea_buf, int min_size)
{
struct jfs_inode_info *ji = JFS_IP(inode);
struct super_block *sb = inode->i_sb;
......@@ -436,8 +436,7 @@ int ea_get(struct inode *inode, struct ea_buffer *ea_buf, int min_size)
if (ea_size == 0)
return 0;
rc = jfs_ReadEA(inode, ea_buf->xattr);
if (rc) {
if ((rc = ea_read(inode, ea_buf->xattr))) {
kfree(ea_buf->xattr);
ea_buf->xattr = NULL;
return rc;
......@@ -472,8 +471,7 @@ int ea_get(struct inode *inode, struct ea_buffer *ea_buf, int min_size)
~(sb->s_blocksize - 1);
if (ea_size == 0)
return 0;
rc = jfs_ReadEA(inode, ea_buf->xattr);
if (rc) {
if ((rc = ea_read(inode, ea_buf->xattr))) {
discard_metapage(ea_buf->mp);
dbFree(inode, blkno, (s64) blocks_needed);
return rc;
......@@ -500,7 +498,7 @@ int ea_get(struct inode *inode, struct ea_buffer *ea_buf, int min_size)
return ea_size;
}
void ea_release(struct inode *inode, struct ea_buffer *ea_buf)
static void ea_release(struct inode *inode, struct ea_buffer *ea_buf)
{
if (ea_buf->flag & EA_MALLOC)
kfree(ea_buf->xattr);
......@@ -514,7 +512,7 @@ void ea_release(struct inode *inode, struct ea_buffer *ea_buf)
}
}
int ea_put(struct inode *inode, struct ea_buffer *ea_buf, int new_size)
static int ea_put(struct inode *inode, struct ea_buffer *ea_buf, int new_size)
{
struct jfs_inode_info *ji = JFS_IP(inode);
unsigned long old_blocks, new_blocks;
......@@ -532,16 +530,14 @@ int ea_put(struct inode *inode, struct ea_buffer *ea_buf, int new_size)
DXDaddress(&ea_buf->new_ea, 0);
DXDlength(&ea_buf->new_ea, 0);
} else if (ea_buf->flag & EA_MALLOC) {
rc = jfs_WriteEA(inode, ea_buf->xattr, new_size,
&ea_buf->new_ea);
rc = ea_write(inode, ea_buf->xattr, new_size, &ea_buf->new_ea);
kfree(ea_buf->xattr);
} else if (ea_buf->flag & EA_NEW) {
/* We have already allocated a new dxd */
flush_metapage(ea_buf->mp);
} else {
/* ->xattr must point to original ea's metapage */
rc = jfs_WriteEA(inode, ea_buf->xattr, new_size,
&ea_buf->new_ea);
rc = ea_write(inode, ea_buf->xattr, new_size, &ea_buf->new_ea);
discard_metapage(ea_buf->mp);
}
if (rc)
......
......@@ -368,7 +368,7 @@ struct inode {
atomic_t i_count;
dev_t i_dev;
umode_t i_mode;
nlink_t i_nlink;
unsigned int i_nlink;
uid_t i_uid;
gid_t i_gid;
kdev_t i_rdev;
......
......@@ -464,7 +464,6 @@ typedef struct ide_drive_s {
byte nice1; /* flag: give potential excess bandwidth */
unsigned present : 1; /* drive is physically present */
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 forced_geom : 1; /* 1 if hdx=c,h,s was given at boot */
unsigned no_unmask : 1; /* disallow setting unmask bit */
......@@ -506,7 +505,6 @@ typedef struct ide_drive_s {
unsigned long long capacity48; /* total number of sectors */
unsigned int drive_data; /* for use by tuneproc/selectproc as needed */
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_struct *part; /* drive partition table */
char name[4]; /* drive name, such as "hda" */
......
......@@ -455,7 +455,7 @@ extern struct task_struct init_task;
extern struct mm_struct init_mm;
/* PID hashing. (shouldnt this be dynamic?) */
#define PIDHASH_SZ (4096 >> 2)
#define PIDHASH_SZ 8192
extern struct task_struct *pidhash[PIDHASH_SZ];
#define pid_hashfn(x) ((((x) >> 8) ^ (x)) & (PIDHASH_SZ - 1))
......
......@@ -127,6 +127,7 @@ enum
KERN_CORE_USES_PID=52, /* int: use core or core.%pid */
KERN_TAINTED=53, /* int: various kernel tainted flags */
KERN_CADPID=54, /* int: PID of the process to notify on CAD */
KERN_PIDMAX=55, /* int: PID # limit */
};
......
......@@ -19,7 +19,6 @@
/*
* This controls the maximum pid allocated to a process
*/
#define PID_MASK 0x3fffffff
#define PID_MAX (PID_MASK+1)
#define DEFAULT_PID_MAX 0x8000
#endif
......@@ -66,7 +66,8 @@ static void release_task(struct task_struct * p)
atomic_dec(&p->user->processes);
security_ops->task_free_security(p);
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);
release_thread(p);
......@@ -718,8 +719,14 @@ asmlinkage long sys_wait4(pid_t pid,unsigned int * stat_addr, int options, struc
ptrace_unlink(p);
do_notify_parent(p, SIGCHLD);
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);
}
goto end_wait4;
default:
continue;
......
......@@ -46,6 +46,14 @@ int nr_threads;
int max_threads;
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;
struct task_struct *pidhash[PIDHASH_SZ];
......@@ -151,11 +159,8 @@ static struct task_struct *dup_task_struct(struct task_struct *orig)
return tsk;
}
spinlock_t lastpid_lock = SPIN_LOCK_UNLOCKED;
static int get_pid(unsigned long flags)
{
static int next_safe = PID_MAX;
struct task_struct *p;
int pid;
......@@ -163,34 +168,35 @@ static int get_pid(unsigned long flags)
return 0;
spin_lock(&lastpid_lock);
if((++last_pid) & ~PID_MASK) {
if (++last_pid > pid_max) {
last_pid = 300; /* Skip daemons etc. */
goto inside;
}
if(last_pid >= next_safe) {
if (last_pid >= next_safe) {
inside:
next_safe = PID_MAX;
next_safe = pid_max;
read_lock(&tasklist_lock);
repeat:
for_each_task(p) {
if(p->pid == last_pid ||
if (p->pid == last_pid ||
p->pgrp == last_pid ||
p->tgid == last_pid ||
p->session == last_pid) {
if(++last_pid >= next_safe) {
if(last_pid & ~PID_MASK)
if (++last_pid >= next_safe) {
if (last_pid >= pid_max)
last_pid = 300;
next_safe = PID_MAX;
next_safe = pid_max;
}
goto repeat;
}
if(p->pid > last_pid && next_safe > p->pid)
if (p->pid > last_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;
if(p->tgid > last_pid && next_safe > p->tgid)
if (p->tgid > last_pid && 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;
}
read_unlock(&tasklist_lock);
......
......@@ -29,7 +29,7 @@ void __ptrace_link(task_t *child, task_t *new_parent)
if (!list_empty(&child->ptrace_list))
BUG();
if (child->parent == new_parent)
BUG();
return;
list_add(&child->ptrace_list, &child->parent->ptrace_children);
REMOVE_LINKS(child);
child->parent = new_parent;
......
......@@ -51,6 +51,7 @@ extern int max_queued_signals;
extern int sysrq_enabled;
extern int core_uses_pid;
extern int cad_pid;
extern int pid_max;
/* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
static int maxolduid = 65535;
......@@ -255,6 +256,8 @@ static ctl_table kern_table[] = {
{KERN_S390_USER_DEBUG_LOGGING,"userprocess_debug",
&sysctl_userprocess_debug,sizeof(int),0644,NULL,&proc_dointvec},
#endif
{KERN_PIDMAX, "pid_max", &pid_max, sizeof (int),
0600, NULL, &proc_dointvec},
{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