* mark copy_to_dinode static
* move to completions, provide back-compat for pre-2.4.7
* remove dead code
* add kdev_t conversation, that should have been in 2.4 anyway
* move one-time inode initialization into the slab constructor
diff -uNr -Xdontdiff ref/jfs24/fs/jfs/jfs_compat.h jfs24-syncup/fs/jfs/jfs_compat.h
--- ref/jfs24/fs/jfs/jfs_compat.h Tue Feb 12 16:18:20 2002
+++ jfs24-syncup/fs/jfs/jfs_compat.h Fri Mar 1 18:39:32 2002
@@ -57,6 +57,17 @@
#undef max
#endif
+/*
+ * Completions are new in 2.4.7.
+ */
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,6))
+#define DECLARE_COMPLETION(c) DECLARE_MUTEX_LOCKED(c)
+#define complete(c) up(c)
+#define wait_for_completion(c) down(c)
+/* must be last to not mess up the namespace */
+#define completion semaphore
+#endif
+
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,9))
#define min(x,y) ({ \
const typeof(x) _x = (x); \
diff -uNr -Xdontdiff ref/jfs24/fs/jfs/jfs_imap.c jfs24-syncup/fs/jfs/jfs_imap.c
--- ref/jfs24/fs/jfs/jfs_imap.c Wed Feb 13 19:57:00 2002
+++ jfs24-syncup/fs/jfs/jfs_imap.c Fri Mar 1 18:39:32 2002
@@ -94,7 +94,7 @@
static int diIAGRead(imap_t * imap, int, metapage_t **);
static int copy_from_dinode(dinode_t *, struct inode *);
-void copy_to_dinode(dinode_t *, struct inode *);
+static void copy_to_dinode(dinode_t *, struct inode *);
/*
* debug code for double-checking inode map
@@ -1379,15 +1379,11 @@
/*
* There are several places in the diAlloc* routines where we initialize
- * the inode. We also need to take a reference on the page containing the
- * inode extent. This way we can write the inode without having to allocate
- * a page from the page cache if that page had been swapped out. This can
- * cause a deadlock if jfs_write_inode had been by kupdate or kswapd.
+ * the inode.
*/
static inline void
diInitInode(struct inode *ip, int iagno, int ino, int extno, iag_t * iagp)
{
- s64 blkno;
struct jfs_sb_info *sbi = JFS_SBI(ip->i_sb);
struct jfs_inode_info *jfs_ip = JFS_IP(ip);
@@ -1395,28 +1391,6 @@
DBG_DIALLOC(JFS_IP(ipimap)->i_imap, ip->i_ino);
jfs_ip->ixpxd = iagp->inoext[extno];
jfs_ip->agno = BLKTOAG(le64_to_cpu(iagp->agstart), sbi);
-
- /* Now grab a reference on the extent page */
- blkno = INOPBLK(&iagp->inoext[extno], ino, sbi->l2nbperpage);
-#ifndef _JFS_4K
- {
- /* If volume shared with OS/2, inode extent may not be
- * page-aligned
- */
- int block_offset;
- int inodes_left;
- int rel_inode;
-
- if ((block_offset = (blkno & (sbi->nbperpage - 1)))) {
- rel_inode = ino & (INOSPERPAGE - 1);
- inodes_left =
- (sbi->nbperpage - block_offset) << sbi->l2niperblk;
-
- if (rel_inode >= inodes_left)
- blkno += sbi->nbperpage;
- }
- }
-#endif
}
@@ -3098,15 +3072,13 @@
jfs_ip->acl = dip->di_acl; /* as are dxd's */
jfs_ip->ea = dip->di_ea;
jfs_ip->next_index = le32_to_cpu(dip->di_next_index);
- if (!S_ISFIFO(ip->i_mode)) {
- jfs_ip->otime = le32_to_cpu(dip->di_otime.tv_sec);
- jfs_ip->acltype = le32_to_cpu(dip->di_acltype);
- }
+ jfs_ip->otime = le32_to_cpu(dip->di_otime.tv_sec);
+ jfs_ip->acltype = le32_to_cpu(dip->di_acltype);
/*
* We may only need to do this for "special" inodes (dmap, imap)
*/
if (S_ISCHR(ip->i_mode) || S_ISBLK(ip->i_mode))
- ip->i_rdev = le32_to_cpu(dip->di_rdev);
+ ip->i_rdev = to_kdev_t(le32_to_cpu(dip->di_rdev));
else if (S_ISDIR(ip->i_mode)) {
memcpy(&jfs_ip->i_dirtable, &dip->di_dirtable, 384);
} else if (!S_ISFIFO(ip->i_mode)) {
@@ -3120,7 +3092,7 @@
*
* FUNCTION: Copies inode info from in-memory inode to disk inode
*/
-void copy_to_dinode(dinode_t * dip, struct inode *ip)
+static void copy_to_dinode(dinode_t * dip, struct inode *ip)
{
struct jfs_inode_info *jfs_ip = JFS_IP(ip);
@@ -3148,14 +3120,12 @@
dip->di_acl = jfs_ip->acl; /* as are dxd's */
dip->di_ea = jfs_ip->ea;
dip->di_next_index = cpu_to_le32(jfs_ip->next_index);
- if (!S_ISFIFO(ip->i_mode)) {
- dip->di_otime.tv_sec = cpu_to_le32(jfs_ip->otime);
- dip->di_otime.tv_nsec = 0;
- dip->di_acltype = cpu_to_le32(jfs_ip->acltype);
- }
+ dip->di_otime.tv_sec = cpu_to_le32(jfs_ip->otime);
+ dip->di_otime.tv_nsec = 0;
+ dip->di_acltype = cpu_to_le32(jfs_ip->acltype);
if (S_ISCHR(ip->i_mode) || S_ISBLK(ip->i_mode))
- dip->di_rdev = cpu_to_le32(ip->i_rdev);
+ dip->di_rdev = cpu_to_le32(kdev_t_to_nr(ip->i_rdev));
}
void diClearExtension(struct inode *ip)
diff -uNr -Xdontdiff ref/jfs24/fs/jfs/jfs_incore.h jfs24-syncup/fs/jfs/jfs_incore.h
--- ref/jfs24/fs/jfs/jfs_incore.h Tue Feb 12 16:18:20 2002
+++ jfs24-syncup/fs/jfs/jfs_incore.h Fri Mar 1 18:39:32 2002
@@ -43,29 +43,28 @@
*/
struct jfs_inode_info {
struct inode *inode; /* pointer back to fs-independent inode */
- int fileset; /* 4: fileset number (always 16)*/
- uint mode2; /* 4: jfs-specific mode */
- pxd_t ixpxd; /* 8: inode extent descriptor */
- dxd_t acl; /* 16: dxd describing acl */
- dxd_t ea; /* 16: dxd describing ea */
- time_t otime; /* 4: time created */
- uint next_index; /* 4: next available directory entry index */
- int acltype; /* 4: Type of ACL */
- short btorder; /* 2: access order */
- short btindex; /* 2: btpage entry index*/
- struct inode *ipimap; /* 4: inode map */
- long cflag; /* 4: commit flags */
- u16 bxflag; /* 2: xflag of pseudo buffer? */
- u16 unused; /* 2: */
- lid_t blid; /* 2: lid of pseudo buffer? */
- lid_t atlhead; /* 2: anonymous tlock list head */
- lid_t atltail; /* 2: anonymous tlock list tail */
+ int fileset; /* fileset number (always 16)*/
+ uint mode2; /* jfs-specific mode */
+ pxd_t ixpxd; /* inode extent descriptor */
+ dxd_t acl; /* dxd describing acl */
+ dxd_t ea; /* dxd describing ea */
+ time_t otime; /* time created */
+ uint next_index; /* next available directory entry index */
+ int acltype; /* Type of ACL */
+ short btorder; /* access order */
+ short btindex; /* btpage entry index*/
+ struct inode *ipimap; /* inode map */
+ long cflag; /* commit flags */
+ u16 bxflag; /* xflag of pseudo buffer? */
+ unchar agno; /* ag number */
+ unchar pad; /* pad */
+ lid_t blid; /* lid of pseudo buffer? */
+ lid_t atlhead; /* anonymous tlock list head */
+ lid_t atltail; /* anonymous tlock list tail */
struct list_head anon_inode_list; /* inodes having anonymous txns */
struct list_head mp_list; /* metapages in inode's address space */
- jfs_rwlock_t rdwrlock; /* 12/20: read/write lock */
- lid_t xtlid; /* 2: lid of xtree lock on directory */
- unchar agno; /* 1: ag number */
- unchar pad; /* 1: pad */
+ jfs_rwlock_t rdwrlock; /* read/write lock */
+ lid_t xtlid; /* lid of xtree lock on directory */
union {
struct {
xtpage_t _xtroot; /* 288: xtree root */
diff -uNr -Xdontdiff ref/jfs24/fs/jfs/jfs_inode.c jfs24-syncup/fs/jfs/jfs_inode.c
--- ref/jfs24/fs/jfs/jfs_inode.c Wed Feb 13 19:57:01 2002
+++ jfs24-syncup/fs/jfs/jfs_inode.c Fri Mar 1 18:39:45 2002
@@ -80,15 +80,8 @@
jfs_inode->mode2 = INLINEEA | ISPARSE | mode;
inode->i_blksize = sb->s_blocksize;
inode->i_blocks = 0;
- inode->i_mtime = inode->i_atime = inode->i_ctime =
- CURRENT_TIME;
- /*
- * otime is an OS/2 thing. In 2.2 kernels, we can't afford
- * the space in a FIFO inode, because the same space is used used
- * by the pipe code. OS/2 won't recognize a pipe anyway.
- */
- if (!S_ISFIFO(mode))
- jfs_inode->otime = inode->i_ctime;
+ inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
+ jfs_inode->otime = inode->i_ctime;
inode->i_version = ++event;
inode->i_generation = JFS_SBI(sb)->gengen++;
@@ -152,9 +145,6 @@
return -ENOSPC;
memset(jfs_inode, 0, sizeof(struct jfs_inode_info));
jfs_inode->inode = inode;
- INIT_LIST_HEAD(&jfs_inode->anon_inode_list);
- INIT_LIST_HEAD(&jfs_inode->mp_list);
- RDWRLOCK_INIT(&jfs_inode->rdwrlock);
return 0;
}
diff -uNr -Xdontdiff ref/jfs24/fs/jfs/jfs_logmgr.c jfs24-syncup/fs/jfs/jfs_logmgr.c
--- ref/jfs24/fs/jfs/jfs_logmgr.c Wed Feb 13 19:57:04 2002
+++ jfs24-syncup/fs/jfs/jfs_logmgr.c Fri Mar 1 18:39:32 2002
@@ -163,7 +163,7 @@
extern void txLazyUnlock(tblock_t * tblk);
extern int jfs_thread_stopped(void);
extern struct task_struct *jfsIOtask;
-extern struct semaphore jfsIOsem;
+extern struct completion jfsIOwait;
/*
* forward references
@@ -1366,7 +1366,6 @@
log->cqueue.head = log->cqueue.tail = 0;
log->count = 0;
- log->yah = NULL;
/*
* initialize for lazy/group commit
@@ -2257,7 +2256,7 @@
| sigmask(SIGCONT));
spin_unlock_irq(¤t->sigmask_lock);
- up(&jfsIOsem);
+ complete(&jfsIOwait);
do {
spin_lock_irq(&log_redrive_lock);
@@ -2275,7 +2274,7 @@
} while (!jfs_thread_stopped());
jFYI(1,("jfsIOWait being killed!\n"));
- up(&jfsIOsem);
+ complete(&jfsIOwait);
return 0;
}
diff -uNr -Xdontdiff ref/jfs24/fs/jfs/jfs_logmgr.h jfs24-syncup/fs/jfs/jfs_logmgr.h
--- ref/jfs24/fs/jfs/jfs_logmgr.h Tue Feb 12 16:18:20 2002
+++ jfs24-syncup/fs/jfs/jfs_logmgr.h Fri Mar 1 18:39:32 2002
@@ -411,7 +411,6 @@
struct list_head synclist; /* 8: logsynclist anchor */
spinlock_t synclock; /* 4: synclist lock */
struct lbuf *wqueue; /* 4: log pageout queue */
- struct buffer_head *yah; /* 4: marker */
int count; /* 4: count */
} log_t;
diff -uNr -Xdontdiff ref/jfs24/fs/jfs/jfs_mount.c jfs24-syncup/fs/jfs/jfs_mount.c
--- ref/jfs24/fs/jfs/jfs_mount.c Wed Feb 13 19:57:04 2002
+++ jfs24-syncup/fs/jfs/jfs_mount.c Fri Mar 1 18:39:32 2002
@@ -473,7 +473,8 @@
if (state == FM_MOUNT) {
/* record log's dev_t and mount serial number */
- j_sb->s_logdev = cpu_to_le32(JFS_SBI(sb)->log->dev);
+ j_sb->s_logdev =
+ cpu_to_le32(kdev_t_to_nr(JFS_SBI(sb)->log->dev));
j_sb->s_logserial = cpu_to_le32(JFS_SBI(sb)->log->serial);
} else if (state == FM_CLEAN) {
/*
@@ -533,7 +534,7 @@
lrd.backchain = 0;
lrd.type = cpu_to_le16(LOG_MOUNT);
lrd.length = 0;
- lrd.aggregate = cpu_to_le32(sb->s_dev);
+ lrd.aggregate = cpu_to_le32(kdev_t_to_nr(sb->s_dev));
lmLog(log, NULL, &lrd, NULL);
return 0;
diff -uNr -Xdontdiff ref/jfs24/fs/jfs/jfs_txnmgr.c jfs24-syncup/fs/jfs/jfs_txnmgr.c
--- ref/jfs24/fs/jfs/jfs_txnmgr.c Wed Feb 13 19:57:05 2002
+++ jfs24-syncup/fs/jfs/jfs_txnmgr.c Fri Mar 1 18:39:32 2002
@@ -146,7 +146,7 @@
extern int jfs_thread_stopped(void);
extern struct task_struct *jfsCommitTask;
-extern struct semaphore jfsIOsem;
+extern struct completion jfsIOwait;
extern struct task_struct *jfsSyncTask;
/*
@@ -1309,7 +1309,7 @@
/* initialize lrd common */
ip = tlck->ip;
- lrd->aggregate = cpu_to_le32(ip->i_dev);
+ lrd->aggregate = cpu_to_le32(kdev_t_to_nr(ip->i_dev));
lrd->log.redopage.fileset = cpu_to_le32(JFS_IP(ip)->fileset);
lrd->log.redopage.inode = cpu_to_le32(ip->i_ino);
@@ -2774,7 +2774,7 @@
LAZY_LOCK_INIT();
TxAnchor.unlock_queue = TxAnchor.unlock_tail = 0;
- up(&jfsIOsem);
+ complete(&jfsIOwait);
do {
restart:
@@ -2819,7 +2819,7 @@
jERROR(1, ("jfs_lazycommit being killed with pending transactions!\n"));
else
jFYI(1, ("jfs_lazycommit being killed\n"));
- up(&jfsIOsem);
+ complete(&jfsIOwait);
return 0;
}
@@ -2891,7 +2891,7 @@
| sigmask(SIGCONT));
spin_unlock_irq(¤t->sigmask_lock);
- up(&jfsIOsem);
+ complete(&jfsIOwait);
do {
/*
@@ -2959,7 +2959,7 @@
} while (!jfs_thread_stopped());
jFYI(1, ("jfs_sync being killed\n"));
- up(&jfsIOsem);
+ complete(&jfsIOwait);
return 0;
}
diff -uNr -Xdontdiff ref/jfs24/fs/jfs/namei.c jfs24-syncup/fs/jfs/namei.c
--- ref/jfs24/fs/jfs/namei.c Wed Feb 13 19:57:08 2002
+++ jfs24-syncup/fs/jfs/namei.c Fri Mar 1 18:39:32 2002
@@ -818,8 +818,6 @@
jFYI(1,
("jfs_link: %s %s\n", old_dentry->d_name.name,
dentry->d_name.name));
-/* The checks for links between filesystems and permissions are
- handled by the VFS layer */
/* JFS does NOT support link() on directories */
if (S_ISDIR(ip->i_mode))
diff -uNr -Xdontdiff ref/jfs24/fs/jfs/super.c jfs24-syncup/fs/jfs/super.c
--- ref/jfs24/fs/jfs/super.c Wed Feb 13 19:57:08 2002
+++ jfs24-syncup/fs/jfs/super.c Fri Mar 1 18:39:32 2002
@@ -42,7 +42,7 @@
struct task_struct *jfsIOtask;
struct task_struct *jfsCommitTask;
struct task_struct *jfsSyncTask;
-DECLARE_MUTEX_LOCKED(jfsIOsem);
+DECLARE_COMPLETION(jfsIOwait);
#ifdef CONFIG_JFS_DEBUG
int jfsloglevel = 1;
@@ -354,6 +354,18 @@
extern void txExit(void);
extern void metapage_exit(void);
+static void init_once(void * foo, kmem_cache_t * cachep, unsigned long flags)
+{
+ struct jfs_inode_info *jfs_ip = (struct jfs_inode_info *) foo;
+
+ if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) ==
+ SLAB_CTOR_CONSTRUCTOR) {
+ INIT_LIST_HEAD(&jfs_ip->anon_inode_list);
+ INIT_LIST_HEAD(&jfs_ip->mp_list);
+ RDWRLOCK_INIT(&jfs_ip->rdwrlock);
+ }
+}
+
static int __init init_jfs_fs(void)
{
int rc;
@@ -363,7 +375,7 @@
jfs_inode_cachep =
kmem_cache_create("jfs_ip",
sizeof(struct jfs_inode_info),
- 0, 0, NULL, NULL);
+ 0, 0, init_once, NULL);
if (jfs_inode_cachep == NULL)
return -ENOMEM;
@@ -397,7 +409,7 @@
jfsIOthread));
goto end_txmngr;
}
- down(&jfsIOsem); /* Wait until IO thread starts */
+ wait_for_completion(&jfsIOwait); /* Wait until IO thread starts */
jfsCommitThread = kernel_thread(jfs_lazycommit, 0,
CLONE_FS | CLONE_FILES |
@@ -408,7 +420,7 @@
jfsCommitThread));
goto kill_iotask;
}
- down(&jfsIOsem); /* Wait until IO thread starts */
+ wait_for_completion(&jfsIOwait); /* Wait until IO thread starts */
jfsSyncThread = kernel_thread(jfs_sync, 0,
CLONE_FS | CLONE_FILES |
@@ -419,7 +431,7 @@
jfsSyncThread));
goto kill_committask;
}
- down(&jfsIOsem); /* Wait until IO thread starts */
+ wait_for_completion(&jfsIOwait); /* Wait until IO thread starts */
#if defined(CONFIG_JFS_DEBUG) && defined(CONFIG_PROC_FS)
jfs_proc_init();
@@ -430,10 +442,10 @@
kill_committask:
send_sig(SIGKILL, jfsCommitTask, 1);
- down(&jfsIOsem); /* Wait until Commit thread exits */
+ wait_for_completion(&jfsIOwait); /* Wait until Commit thread exits */
kill_iotask:
send_sig(SIGKILL, jfsIOtask, 1);
- down(&jfsIOsem); /* Wait until IO thread exits */
+ wait_for_completion(&jfsIOwait); /* Wait until IO thread exits */
end_txmngr:
txExit();
free_metapage:
@@ -451,11 +463,11 @@
txExit();
metapage_exit();
send_sig(SIGKILL, jfsIOtask, 1);
- down(&jfsIOsem); /* Wait until IO thread exits */
+ wait_for_completion(&jfsIOwait); /* Wait until IO thread exits */
send_sig(SIGKILL, jfsCommitTask, 1);
- down(&jfsIOsem); /* Wait until Commit thread exits */
+ wait_for_completion(&jfsIOwait); /* Wait until Commit thread exits */
send_sig(SIGKILL, jfsSyncTask, 1);
- down(&jfsIOsem); /* Wait until Sync thread exits */
+ wait_for_completion(&jfsIOwait); /* Wait until Sync thread exits */
#if defined(CONFIG_JFS_DEBUG) && defined(CONFIG_PROC_FS)
jfs_proc_clean();
#endif
|