diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-02-23 00:40:54 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-02-23 00:40:54 +0000 |
commit | 529c593ece216e4aaffd36bd940cb94f1fa63129 (patch) | |
tree | 78f1c0b805f5656aa7b0417a043c5346f700a2cf /fs/qnx4 | |
parent | 0bd079751d25808d1972baee5c4eaa1db2227257 (diff) |
Merge with 2.3.43. I did ignore all modifications to the qlogicisp.c
driver due to the Origin A64 hacks.
Diffstat (limited to 'fs/qnx4')
-rw-r--r-- | fs/qnx4/Makefile | 3 | ||||
-rw-r--r-- | fs/qnx4/file.c | 129 | ||||
-rw-r--r-- | fs/qnx4/fsync.c | 3 | ||||
-rw-r--r-- | fs/qnx4/inode.c | 40 | ||||
-rw-r--r-- | fs/qnx4/symlinks.c | 26 |
5 files changed, 39 insertions, 162 deletions
diff --git a/fs/qnx4/Makefile b/fs/qnx4/Makefile index 1988bb8ff..943eb1223 100644 --- a/fs/qnx4/Makefile +++ b/fs/qnx4/Makefile @@ -8,8 +8,7 @@ # Note 2! The CFLAGS definitions are now in the main makefile... O_TARGET := qnx4.o -O_OBJS := inode.o dir.o namei.o file.o bitmap.o symlinks.o truncate.o \ -fsync.o +O_OBJS := inode.o dir.o namei.o file.o bitmap.o truncate.o fsync.o M_OBJS := $(O_TARGET) include $(TOPDIR)/Rules.make diff --git a/fs/qnx4/file.c b/fs/qnx4/file.c index 80ab1f590..6eb3ca0a5 100644 --- a/fs/qnx4/file.c +++ b/fs/qnx4/file.c @@ -17,130 +17,6 @@ #include <linux/fs.h> #include <linux/sched.h> #include <linux/qnx4_fs.h> -#include <linux/kernel.h> -#include <linux/errno.h> -#include <linux/malloc.h> -#include <linux/fcntl.h> -#include <linux/stat.h> -#include <linux/locks.h> -#include <linux/mm.h> -#include <linux/pagemap.h> - -#include <asm/segment.h> -#include <asm/system.h> -#include <asm/uaccess.h> - -#define MIN(a,b) (((a)<(b))?(a):(b)) -#define MAX(a,b) (((a)>(b))?(a):(b)) - - -#ifdef CONFIG_QNX4FS_RW -static ssize_t qnx4_file_write(struct file *filp, const char *buf, - size_t count, loff_t * ppos) -{ - struct dentry *dentry = filp->f_dentry; - struct inode *inode = dentry->d_inode; - struct qnx4_inode_info *qnx4_ino; - struct buffer_head *bh; - ssize_t result = -EBUSY, c; - off_t pos; - unsigned long start, block, extent_end; - char *p; - - QNX4DEBUG(("qnx4: file_write(%s/%s (%d), %lu@%lu)\n", - dentry->d_parent->d_name.name, dentry->d_name.name, - inode->i_count, (unsigned long) count, (unsigned long) *ppos)); - if (inode == NULL) { - printk("qnx4: NULL inode for file_write\n"); - return -EINVAL; - } - qnx4_ino = &inode->u.qnx4_i; - if (S_ISREG(inode->i_mode) == 0) { - printk("qnx4: write to non-file, mode %07o\n", inode->i_mode); - return -EINVAL; - } - if (count == 0) { - goto out; - } - if (filp->f_flags & O_APPEND) { - pos = inode->i_size; - } else { - pos = *ppos; - } - start = qnx4_ino->i_first_xtnt.xtnt_blk + ((pos >> 9) * 0) - 1; - result = 0; - extent_end = start + qnx4_ino->i_first_xtnt.xtnt_size - 1; - QNX4DEBUG(("qnx4: extent length : [%lu] bytes\n", - qnx4_ino->i_first_xtnt.xtnt_size)); - while (result < count) { - block = start + pos / QNX4_BLOCK_SIZE; - if (block > extent_end) { - if (qnx4_is_free(inode->i_sb, block) <= 0) { - printk("qnx4: next inode is busy -> write aborted.\n"); - result = -ENOSPC; - break; - } - } - if ((bh = bread(inode->i_dev, block, - QNX4_BLOCK_SIZE)) == NULL) { - printk("qnx4: I/O error on write.\n"); - result = -EIO; - goto out; - } - if (bh == NULL) { - if (result != 0) { - result = -ENOSPC; - } - break; - } - if (block > extent_end) { - qnx4_set_bitmap(inode->i_sb, block, 1); - extent_end++; - qnx4_ino->i_first_xtnt.xtnt_size = extent_end - start + 1; - } - c = QNX4_BLOCK_SIZE - (pos % QNX4_BLOCK_SIZE); - if (c > count - result) { - c = count - result; - } - if (c != QNX4_BLOCK_SIZE && buffer_uptodate(bh) == 0) { - ll_rw_block(WRITE, 1, &bh); - wait_on_buffer(bh); - if (buffer_uptodate(bh) == 0) { - brelse(bh); - if (result != 0) { - result = -EIO; - } - break; - } - } - p = bh->b_data + (pos % QNX4_BLOCK_SIZE); - c -= copy_from_user(p, buf, c); - if (c == 0) { - brelse(bh); - if (result == 0) { - result = -EFAULT; - } - break; - } -// update_vm_cache(inode, pos, p, c); - mark_buffer_uptodate(bh, 1); - mark_buffer_dirty(bh, 0); - brelse(bh); - pos += c; - buf += c; - result += c; - } - if (pos > inode->i_size) { - inode->i_size = pos; - } - inode->i_mtime = inode->i_ctime = CURRENT_TIME; - *ppos = pos; - mark_inode_dirty(inode); - - out: - return result; -} -#endif /* * We have mostly NULL's here: the current defaults are ok for @@ -150,7 +26,7 @@ static struct file_operations qnx4_file_operations = { read: generic_file_read, #ifdef CONFIG_QNX4FS_RW - write: qnx4_file_write, + write: generic_file_write, #endif mmap: generic_file_mmap, #ifdef CONFIG_QNX4FS_RW @@ -161,10 +37,7 @@ static struct file_operations qnx4_file_operations = struct inode_operations qnx4_file_inode_operations = { default_file_ops: &qnx4_file_operations, - get_block: qnx4_get_block, - readpage: block_read_full_page, #ifdef CONFIG_QNX4FS_RW - writepage: block_write_full_page, truncate: qnx4_truncate, #endif }; diff --git a/fs/qnx4/fsync.c b/fs/qnx4/fsync.c index 4cea74fe5..e90291f03 100644 --- a/fs/qnx4/fsync.c +++ b/fs/qnx4/fsync.c @@ -16,6 +16,7 @@ #include <linux/stat.h> #include <linux/fcntl.h> #include <linux/locks.h> +#include <linux/smp_lock.h> #include <linux/fs.h> #include <linux/qnx4_fs.h> @@ -156,10 +157,12 @@ int qnx4_sync_file(struct file *file, struct dentry *dentry) S_ISLNK(inode->i_mode))) return -EINVAL; + lock_kernel(); for (wait = 0; wait <= 1; wait++) { err |= sync_direct(inode, wait); } err |= qnx4_sync_inode(inode); + unlock_kernel(); return (err < 0) ? -EIO : 0; } diff --git a/fs/qnx4/inode.c b/fs/qnx4/inode.c index 5b70d5211..abb6d8260 100644 --- a/fs/qnx4/inode.c +++ b/fs/qnx4/inode.c @@ -423,6 +423,31 @@ static void qnx4_put_super(struct super_block *sb) return; } +static int qnx4_writepage(struct dentry *dentry, struct page *page) +{ + return block_write_full_page(page,qnx4_get_block); +} +static int qnx4_readpage(struct dentry *dentry, struct page *page) +{ + return block_read_full_page(page,qnx4_get_block); +} +static int qnx4_prepare_write(struct page *page, unsigned from, unsigned to) +{ + return cont_prepare_write(page,from,to,qnx4_get_block, + &((struct inode*)page->mapping->host)->u.qnx4_i.mmu_private); +} +static int qnx4_bmap(struct address_space *mapping, long block) +{ + return generic_block_bmap(mapping,block,qnx4_get_block); +} +struct address_space_operations qnx4_aops = { + readpage: qnx4_readpage, + writepage: qnx4_writepage, + prepare_write: qnx4_prepare_write, + commit_write: generic_commit_write, + bmap: qnx4_bmap +}; + static void qnx4_read_inode(struct inode *inode) { struct buffer_head *bh; @@ -461,14 +486,17 @@ static void qnx4_read_inode(struct inode *inode) inode->i_blksize = QNX4_DIR_ENTRY_SIZE; memcpy(&inode->u.qnx4_i, (struct qnx4_inode_info *) raw_inode, QNX4_DIR_ENTRY_SIZE); - inode->i_op = &qnx4_file_inode_operations; - if (S_ISREG(inode->i_mode)) + if (S_ISREG(inode->i_mode)) { inode->i_op = &qnx4_file_inode_operations; - else if (S_ISDIR(inode->i_mode)) + inode->i_mapping->a_ops = &qnx4_aops; + inode->u.qnx4_i.mmu_private = inode->i_size; + } else if (S_ISDIR(inode->i_mode)) inode->i_op = &qnx4_dir_inode_operations; - else if (S_ISLNK(inode->i_mode)) - inode->i_op = &qnx4_symlink_inode_operations; - else + else if (S_ISLNK(inode->i_mode)) { + inode->i_op = &page_symlink_inode_operations; + inode->i_mapping->a_ops = &qnx4_aops; + inode->u.qnx4_i.mmu_private = inode->i_size; + } else /* HUH??? Where is device number? Oh, well... */ init_special_inode(inode, inode->i_mode, 0); diff --git a/fs/qnx4/symlinks.c b/fs/qnx4/symlinks.c deleted file mode 100644 index 4eaf27034..000000000 --- a/fs/qnx4/symlinks.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * QNX4 file system, Linux implementation. - * - * Version : 0.2.1 - * - * Using parts of the xiafs filesystem. - * - * History : - * - * 28-05-1998 by Richard Frowijn : first release. - * 21-06-1998 by Frank Denis : ugly changes to make it compile on Linux 2.1.99+ - */ - -#include <linux/fs.h> -#include <linux/qnx4_fs.h> - -/* - * symlinks can't do much... - */ -struct inode_operations qnx4_symlink_inode_operations = -{ - readlink: page_readlink, - follow_link: page_follow_link, - get_block: qnx4_get_block, - readpage: block_read_full_page, -}; |