Commit c71a4337 authored by Linus Torvalds's avatar Linus Torvalds

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

into home.transmeta.com:/home/torvalds/v2.5/linux
parents 652cbb16 ee1aaacd
......@@ -8,7 +8,7 @@ jfs-objs := super.o file.o inode.o namei.o jfs_mount.o jfs_umount.o \
jfs_xtree.o jfs_imap.o jfs_debug.o jfs_dmap.o \
jfs_unicode.o jfs_dtree.o jfs_inode.o \
jfs_extent.o symlink.o jfs_metapage.o \
jfs_logmgr.o jfs_txnmgr.o jfs_uniupr.o resize.o
jfs_logmgr.o jfs_txnmgr.o jfs_uniupr.o resize.o xattr.o
EXTRA_CFLAGS += -D_JFS_4K
......
......@@ -20,6 +20,7 @@
#include <linux/fs.h>
#include "jfs_incore.h"
#include "jfs_txnmgr.h"
#include "jfs_xattr.h"
#include "jfs_debug.h"
......@@ -98,6 +99,10 @@ static void jfs_truncate(struct inode *ip)
struct inode_operations jfs_file_inode_operations = {
.truncate = jfs_truncate,
.setxattr = jfs_setxattr,
.getxattr = jfs_getxattr,
.listxattr = jfs_listxattr,
.removexattr = jfs_removexattr,
};
struct file_operations jfs_file_operations = {
......@@ -109,3 +114,11 @@ 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,6 +31,7 @@
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;
......@@ -65,6 +66,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;
init_special_inode(inode, inode->i_mode,
kdev_t_to_nr(inode->i_rdev));
}
......@@ -163,8 +165,9 @@ void jfs_dirty_inode(struct inode *inode)
set_cflag(COMMIT_Dirty, inode);
}
static int jfs_get_block(struct inode *ip, sector_t lblock,
struct buffer_head *bh_result, int create)
static int
jfs_get_blocks(struct inode *ip, sector_t lblock, unsigned long max_blocks,
struct buffer_head *bh_result, int create)
{
s64 lblock64 = lblock;
int no_size_check = 0;
......@@ -200,7 +203,7 @@ static int jfs_get_block(struct inode *ip, sector_t lblock,
if ((no_size_check ||
((lblock64 << ip->i_sb->s_blocksize_bits) < ip->i_size)) &&
(xtLookup(ip, lblock64, 1, &xflag, &xaddr, &xlen, no_size_check)
(xtLookup(ip, lblock64, max_blocks, &xflag, &xaddr, &xlen, no_size_check)
== 0) && xlen) {
if (xflag & XAD_NOTRECORDED) {
if (!create)
......@@ -228,6 +231,7 @@ static int jfs_get_block(struct inode *ip, sector_t lblock,
}
map_bh(bh_result, ip->i_sb, xaddr);
bh_result->b_size = xlen << ip->i_blkbits;
goto unlock;
}
if (!create)
......@@ -239,12 +243,13 @@ static int jfs_get_block(struct inode *ip, sector_t lblock,
#ifdef _JFS_4K
if ((rc = extHint(ip, lblock64 << ip->i_sb->s_blocksize_bits, &xad)))
goto unlock;
rc = extAlloc(ip, 1, lblock64, &xad, FALSE);
rc = extAlloc(ip, max_blocks, lblock64, &xad, FALSE);
if (rc)
goto unlock;
set_buffer_new(bh_result);
map_bh(bh_result, ip->i_sb, addressXAD(&xad));
bh_result->b_size = lengthXAD(&xad) << ip->i_blkbits;
#else /* _JFS_4K */
/*
......@@ -267,6 +272,12 @@ static int jfs_get_block(struct inode *ip, sector_t lblock,
return -rc;
}
static int jfs_get_block(struct inode *ip, sector_t lblock,
struct buffer_head *bh_result, int create)
{
return jfs_get_blocks(ip, lblock, 1, bh_result, create);
}
static int jfs_writepage(struct page *page)
{
return block_write_full_page(page, jfs_get_block);
......@@ -299,18 +310,6 @@ static int jfs_bmap(struct address_space *mapping, long block)
return generic_block_bmap(mapping, block, jfs_get_block);
}
static int
jfs_get_blocks(struct inode *inode, sector_t iblock, unsigned long max_blocks,
struct buffer_head *bh_result, int create)
{
int ret;
ret = jfs_get_block(inode, iblock, bh_result, create);
if (ret == 0)
bh_result->b_size = (1 << inode->i_blkbits);
return ret;
}
static int jfs_direct_IO(int rw, struct inode *inode, char *buf,
loff_t offset, size_t count)
{
......
......@@ -815,21 +815,19 @@ int diWrite(tid_t tid, struct inode *ip)
memcpy(&dp->di_fastsymlink, jfs_ip->i_inline, IDATASIZE);
dilinelock->index++;
}
#ifdef _STILL_TO_PORT
/*
* copy inline data from in-memory inode to on-disk inode:
* 128 byte slot granularity
*/
if (test_cflag(COMMIT_Inlineea, ip))
if (test_cflag(COMMIT_Inlineea, ip)) {
lv = (lv_t *) & dilinelock->lv[dilinelock->index];
lv->offset = (dioffset + 3 * 128) >> L2INODESLOTSIZE;
lv->length = 1;
memcpy(&dp->di_inlineea, &ip->i_inlineea, INODESLOTSIZE);
memcpy(&dp->di_inlineea, jfs_ip->i_inline_ea, INODESLOTSIZE);
dilinelock->index++;
clear_cflag(COMMIT_Inlineea, ip);
}
#endif /* _STILL_TO_PORT */
/*
* lock/copy inode base: 128 byte slot granularity
......@@ -914,8 +912,6 @@ int diFree(struct inode *ip)
u32 bitmap, mask;
struct inode *ipimap = JFS_SBI(ip->i_sb)->ipimap;
imap_t *imap = JFS_IP(ipimap)->i_imap;
s64 xaddr;
s64 xlen;
pxd_t freepxd;
tid_t tid;
struct inode *iplist[3];
......@@ -1181,9 +1177,7 @@ int diFree(struct inode *ip)
* invalidate any page of the inode extent freed from buffer cache;
*/
freepxd = iagp->inoext[extno];
xaddr = addressPXD(&iagp->inoext[extno]);
xlen = lengthPXD(&iagp->inoext[extno]);
invalidate_metapages(JFS_SBI(ip->i_sb)->direct_inode, xaddr, xlen);
invalidate_pxd_metapages(JFS_SBI(ip->i_sb)->direct_inode, freepxd);
/*
* update iag list(s) (careful update step 2)
......@@ -3046,16 +3040,17 @@ static int copy_from_dinode(dinode_t * dip, struct inode *ip)
jfs_ip->next_index = le32_to_cpu(dip->di_next_index);
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 = to_kdev_t(le32_to_cpu(dip->di_rdev));
else if (S_ISDIR(ip->i_mode)) {
if (S_ISDIR(ip->i_mode)) {
memcpy(&jfs_ip->i_dirtable, &dip->di_dirtable, 384);
} else if (!S_ISFIFO(ip->i_mode)) {
} else if (S_ISREG(ip->i_mode) || S_ISLNK(ip->i_mode)) {
memcpy(&jfs_ip->i_xtroot, &dip->di_xtroot, 288);
}
} else
memcpy(&jfs_ip->i_inline_ea, &dip->di_inlineea, 128);
/* Zero the in-memory-only stuff */
jfs_ip->cflag = 0;
jfs_ip->btindex = 0;
......
......@@ -82,6 +82,10 @@ struct jfs_inode_info {
unchar _unused[16]; /* 16: */
dxd_t _dxd; /* 16: */
unchar _inline[128]; /* 128: inline symlink */
/* _inline_ea may overlay the last part of
* file._xtroot if maxentry = XTROOTINITSLOT
*/
unchar _inline_ea[128]; /* 128: inline extended attr */
} link;
} u;
struct inode vfs_inode;
......@@ -91,6 +95,7 @@ struct jfs_inode_info {
#define i_dirtable u.dir._table
#define i_dtroot u.dir._dtroot
#define i_inline u.link._inline
#define i_inline_ea u.link._inline_ea
#define IREAD_LOCK(ip) down_read(&JFS_IP(ip)->rdwrlock)
......
......@@ -557,8 +557,7 @@ void release_metapage(metapage_t * mp)
jFYI(1, ("release_metapage: done\n"));
}
void invalidate_metapages(struct inode *ip, unsigned long addr,
unsigned long len)
void __invalidate_metapages(struct inode *ip, s64 addr, int len)
{
metapage_t **hash_ptr;
unsigned long lblock;
......
......@@ -107,9 +107,13 @@ static inline void discard_metapage(metapage_t *mp)
}
/*
* This routine uses hash to explicitly find small number of pages
* This routines invalidate all pages for an extent.
*/
extern void invalidate_metapages(struct inode *, unsigned long, unsigned long);
extern void __invalidate_metapages(struct inode *, s64, int);
#define invalidate_pxd_metapages(ip, pxd) \
__invalidate_metapages((ip), addressPXD(&(pxd)), lengthPXD(&(pxd)))
#define invalidate_dxd_metapages(ip, dxd) \
__invalidate_metapages((ip), addressDXD(&(dxd)), lengthDXD(&(dxd)))
/*
* This one uses mp_list to invalidate all pages for an inode
......
......@@ -144,6 +144,8 @@ typedef struct {
#define DXDaddress PXDaddress
#define lengthDXD lengthPXD
#define addressDXD addressPXD
#define DXDsize(dxd, size32) ((dxd)->size = cpu_to_le32(size32))
#define sizeDXD(dxd) le32_to_cpu((dxd)->size)
/*
* directory entry argument
......
/*
* Copyright (c) International Business Machines Corp., 2000-2002
*
* 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_XATTR
#define H_JFS_XATTR
/*
* jfs_ea_list describe the on-disk format of the extended attributes.
* I know the null-terminator is redundant since namelen is stored, but
* I am maintaining compatibility with OS/2 where possible.
*/
struct jfs_ea {
u8 flag; /* Unused? */
u8 namelen; /* Length of name */
u16 valuelen; /* Length of value */
char name[0]; /* Attribute name (includes null-terminator) */
}; /* Value immediately follows name */
struct jfs_ea_list {
u32 size; /* overall size */
struct jfs_ea ea[0]; /* Variable length list */
};
/* Macros for defining maxiumum number of bytes supported for EAs */
#define MAXEASIZE 65535
#define MAXEALISTSIZE MAXEASIZE
/*
* some macros for dealing with variable length EA lists.
*/
#define EA_SIZE(ea) \
(sizeof (struct jfs_ea) + (ea)->namelen + 1 + \
le16_to_cpu((ea)->valuelen))
#define NEXT_EA(ea) ((struct jfs_ea *) (((char *) (ea)) + (EA_SIZE (ea))))
#define FIRST_EA(ealist) ((ealist)->ea)
#define EALIST_SIZE(ealist) le32_to_cpu((ealist)->size)
#define END_EALIST(ealist) \
((struct jfs_ea *) (((char *) (ealist)) + EALIST_SIZE(ealist)))
extern int jfs_setxattr(struct dentry *, const char *, void *, size_t, int);
extern ssize_t jfs_getxattr(struct dentry *, const char *, void *, size_t);
extern ssize_t jfs_listxattr(struct dentry *, char *, size_t);
extern int jfs_removexattr(struct dentry *, const char *);
#endif /* H_JFS_XATTR */
......@@ -24,10 +24,12 @@
#include "jfs_dmap.h"
#include "jfs_unicode.h"
#include "jfs_metapage.h"
#include "jfs_xattr.h"
#include "jfs_debug.h"
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;
......@@ -672,17 +674,13 @@ int freeZeroLink(struct inode *ip)
* free EA
*/
if (JFS_IP(ip)->ea.flag & DXD_EXTENT) {
s64 xaddr;
int xlen;
s64 xaddr = addressDXD(&JFS_IP(ip)->ea);
int xlen = lengthDXD(&JFS_IP(ip)->ea);
maplock_t maplock; /* maplock for COMMIT_WMAP */
pxdlock_t *pxdlock; /* maplock for COMMIT_WMAP */
/* free EA pages from cache */
xaddr = addressDXD(&JFS_IP(ip)->ea);
xlen = lengthDXD(&JFS_IP(ip)->ea);
#ifdef _STILL_TO_PORT
bmExtentInvalidate(ip, xaddr, xlen);
#endif
invalidate_dxd_metapages(ip, JFS_IP(ip)->ea);
/* free EA extent from working block map */
maplock.index = 1;
......@@ -697,17 +695,12 @@ int freeZeroLink(struct inode *ip)
* free ACL
*/
if (JFS_IP(ip)->acl.flag & DXD_EXTENT) {
s64 xaddr;
int xlen;
s64 xaddr = addressDXD(&JFS_IP(ip)->acl);
int xlen = lengthDXD(&JFS_IP(ip)->acl);
maplock_t maplock; /* maplock for COMMIT_WMAP */
pxdlock_t *pxdlock; /* maplock for COMMIT_WMAP */
/* free ACL pages from cache */
xaddr = addressDXD(&JFS_IP(ip)->acl);
xlen = lengthDXD(&JFS_IP(ip)->acl);
#ifdef _STILL_TO_PORT
bmExtentInvalidate(ip, xaddr, xlen);
#endif
invalidate_dxd_metapages(ip, JFS_IP(ip)->acl);
/* free ACL extent from working block map */
maplock.index = 1;
......@@ -922,6 +915,14 @@ int jfs_symlink(struct inode *dip, struct dentry *dentry, const char *name)
i_fastsymlink = JFS_IP(ip)->i_inline;
memcpy(i_fastsymlink, name, ssize);
ip->i_size = ssize - 1;
/*
* if symlink is > 128 bytes, we don't have the space to
* store inline extended attributes
*/
if (ssize > sizeof (JFS_IP(ip)->i_inline))
JFS_IP(ip)->mode2 &= ~INLINEEA;
jFYI(1,
("jfs_symlink: fast symlink added ssize:%d name:%s \n",
ssize, name));
......@@ -1337,6 +1338,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;
init_special_inode(ip, ip->i_mode, rdev);
insert_inode_hash(ip);
......@@ -1440,6 +1442,10 @@ struct inode_operations jfs_dir_inode_operations = {
.rmdir = jfs_rmdir,
.mknod = jfs_mknod,
.rename = jfs_rename,
.setxattr = jfs_setxattr,
.getxattr = jfs_getxattr,
.listxattr = jfs_listxattr,
.removexattr = jfs_removexattr,
};
struct file_operations jfs_dir_operations = {
......
......@@ -377,6 +377,31 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
return -EINVAL;
}
static void jfs_write_super_lockfs(struct super_block *sb)
{
struct jfs_sb_info *sbi = JFS_SBI(sb);
log_t *log = sbi->log;
if (!(sb->s_flags & MS_RDONLY)) {
txQuiesce(sb);
lmLogShutdown(log);
}
}
static void jfs_unlockfs(struct super_block *sb)
{
struct jfs_sb_info *sbi = JFS_SBI(sb);
log_t *log = sbi->log;
int rc = 0;
if (!(sb->s_flags & MS_RDONLY)) {
if ((rc = lmLogInit(log)))
jERROR(1,
("jfs_unlock failed with return code %d\n", rc));
else
txResume(sb);
}
}
static struct super_block *jfs_get_sb(struct file_system_type *fs_type,
int flags, char *dev_name, void *data)
{
......@@ -390,6 +415,8 @@ static struct super_operations jfs_super_operations = {
.write_inode = jfs_write_inode,
.delete_inode = jfs_delete_inode,
.put_super = jfs_put_super,
.write_super_lockfs = jfs_write_super_lockfs,
.unlockfs = jfs_unlockfs,
.statfs = jfs_statfs,
.remount_fs = jfs_remount,
};
......
......@@ -18,6 +18,7 @@
#include <linux/fs.h>
#include "jfs_incore.h"
#include "jfs_xattr.h"
static int jfs_follow_link(struct dentry *dentry, struct nameidata *nd)
{
......@@ -34,5 +35,9 @@ static int jfs_readlink(struct dentry *dentry, char *buffer, int buflen)
struct inode_operations jfs_symlink_inode_operations = {
.readlink = jfs_readlink,
.follow_link = jfs_follow_link,
.setxattr = jfs_setxattr,
.getxattr = jfs_getxattr,
.listxattr = jfs_listxattr,
.removexattr = jfs_removexattr,
};
This diff is collapsed.
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