Commit a81ac254 authored by Anton Altaparmakov's avatar Anton Altaparmakov

Merge cantab.net:/home/src/bklinux-2.6

into cantab.net:/home/src/ntfs-2.6
parents 6300f690 df8781b5
......@@ -37,7 +37,7 @@
#define curptr g6
#define NR_SYSCALLS 272 /* Each OS is different... */
#define NR_SYSCALLS 273 /* Each OS is different... */
/* These are just handy. */
#define _SV save %sp, -STACKFRAME_SZ, %sp
......
......@@ -26,7 +26,7 @@
#define curptr g6
#define NR_SYSCALLS 272 /* Each OS is different... */
#define NR_SYSCALLS 273 /* Each OS is different... */
.text
.align 32
......
......@@ -1640,9 +1640,8 @@ random_read(struct file * file, char * buf, size_t nbytes, loff_t *ppos)
/*
* If we gave the user some bytes, update the access time.
*/
if (count != 0) {
update_atime(file->f_dentry->d_inode);
}
if (count)
file_accessed(file);
return (count ? count : retval);
}
......
......@@ -539,6 +539,7 @@ static struct pci_device_id aec62xx_pci_tbl[] = {
{ PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP865R, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4 },
{ 0, },
};
MODULE_DEVICE_TABLE(pci, aec62xx_pci_tbl);
static struct pci_driver driver = {
.name = "AEC62xx IDE",
......
......@@ -880,6 +880,7 @@ static struct pci_device_id alim15x3_pci_tbl[] = {
{ PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M5229, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
{ 0, },
};
MODULE_DEVICE_TABLE(pci, alim15x3_pci_tbl);
static struct pci_driver driver = {
.name = "ALI15x3 IDE",
......
......@@ -467,6 +467,7 @@ static struct pci_device_id amd74xx_pci_tbl[] = {
{ PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 12 },
{ 0, },
};
MODULE_DEVICE_TABLE(pci, amd74xx_pci_tbl);
static struct pci_driver driver = {
.name = "AMD IDE",
......
......@@ -493,6 +493,7 @@ static struct pci_device_id atiixp_pci_tbl[] = {
{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
{ 0, },
};
MODULE_DEVICE_TABLE(pci, atiixp_pci_tbl);
static struct pci_driver driver = {
.name = "ATIIXP IDE",
......
......@@ -760,6 +760,7 @@ static struct pci_device_id cmd64x_pci_tbl[] = {
{ PCI_VENDOR_ID_CMD, PCI_DEVICE_ID_CMD_649, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 3},
{ 0, },
};
MODULE_DEVICE_TABLE(pci, cmd64x_pci_tbl);
static struct pci_driver driver = {
.name = "CMD64x IDE",
......
......@@ -299,6 +299,7 @@ static struct pci_device_id cs5520_pci_tbl[] = {
{ PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5520, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1},
{ 0, },
};
MODULE_DEVICE_TABLE(pci, cs5520_pci_tbl);
static struct pci_driver driver = {
.name = "CyrixIDE",
......
......@@ -417,6 +417,7 @@ static struct pci_device_id cs5530_pci_tbl[] = {
{ PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5530_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
{ 0, },
};
MODULE_DEVICE_TABLE(pci, cs5530_pci_tbl);
static struct pci_driver driver = {
.name = "CS5530 IDE",
......
......@@ -441,6 +441,7 @@ static struct pci_device_id cy82c693_pci_tbl[] = {
{ PCI_VENDOR_ID_CONTAQ, PCI_DEVICE_ID_CONTAQ_82C693, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
{ 0, },
};
MODULE_DEVICE_TABLE(pci, cy82c693_pci_tbl);
static struct pci_driver driver = {
.name = "Cypress IDE",
......
......@@ -134,6 +134,7 @@ static struct pci_device_id generic_pci_tbl[] = {
{ PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237_SATA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 9},
{ 0, },
};
MODULE_DEVICE_TABLE(pci, generic_pci_tbl);
static struct pci_driver driver = {
.name = "PCI IDE",
......
......@@ -336,6 +336,7 @@ static struct pci_device_id hpt34x_pci_tbl[] = {
{ PCI_VENDOR_ID_TTI, PCI_DEVICE_ID_TTI_HPT343, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
{ 0, },
};
MODULE_DEVICE_TABLE(pci, hpt34x_pci_tbl);
static struct pci_driver driver = {
.name = "HPT34x IDE",
......
......@@ -1255,6 +1255,7 @@ static struct pci_device_id hpt366_pci_tbl[] = {
{ PCI_VENDOR_ID_TTI, PCI_DEVICE_ID_TTI_HPT374, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4},
{ 0, },
};
MODULE_DEVICE_TABLE(pci, hpt366_pci_tbl);
static struct pci_driver driver = {
.name = "HPT366 IDE",
......
......@@ -300,6 +300,7 @@ static struct pci_device_id it8172_pci_tbl[] = {
{ PCI_VENDOR_ID_ITE, PCI_DEVICE_ID_ITE_IT8172G, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
{ 0, },
};
MODULE_DEVICE_TABLE(pci, it8172_pci_tbl);
static struct pci_driver driver = {
.name = "IT8172IDE",
......
......@@ -230,6 +230,7 @@ static struct pci_device_id ns87415_pci_tbl[] = {
{ PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87415, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
{ 0, },
};
MODULE_DEVICE_TABLE(pci, ns87415_pci_tbl);
static struct pci_driver driver = {
.name = "NS87415IDE",
......
......@@ -367,6 +367,7 @@ static struct pci_device_id opti621_pci_tbl[] = {
{ PCI_VENDOR_ID_OPTI, PCI_DEVICE_ID_OPTI_82C825, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1},
{ 0, },
};
MODULE_DEVICE_TABLE(pci, opti621_pci_tbl);
static struct pci_driver driver = {
.name = "Opti621 IDE",
......
......@@ -530,6 +530,7 @@ static struct pci_device_id pdc202new_pci_tbl[] = {
{ PCI_VENDOR_ID_PROMISE, PCI_DEVICE_ID_PROMISE_20277, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 6},
{ 0, },
};
MODULE_DEVICE_TABLE(pci, pdc202new_pci_tbl);
static struct pci_driver driver = {
.name = "Promise IDE",
......
......@@ -898,6 +898,7 @@ static struct pci_device_id pdc202xx_pci_tbl[] = {
{ PCI_VENDOR_ID_PROMISE, PCI_DEVICE_ID_PROMISE_20267, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4},
{ 0, },
};
MODULE_DEVICE_TABLE(pci, pdc202xx_pci_tbl);
static struct pci_driver driver = {
.name = "Promise Old IDE",
......
......@@ -807,6 +807,7 @@ static struct pci_device_id piix_pci_tbl[] = {
{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 20},
{ 0, },
};
MODULE_DEVICE_TABLE(pci, piix_pci_tbl);
static struct pci_driver driver = {
.name = "PIIX IDE",
......
......@@ -68,6 +68,7 @@ static struct pci_device_id rz1000_pci_tbl[] = {
{ PCI_VENDOR_ID_PCTECH, PCI_DEVICE_ID_PCTECH_RZ1001, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1},
{ 0, },
};
MODULE_DEVICE_TABLE(pci, rz1000_pci_tbl);
static struct pci_driver driver = {
.name = "RZ1000 IDE",
......
......@@ -558,6 +558,7 @@ static struct pci_device_id sc1200_pci_tbl[] = {
{ PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SCx200_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
{ 0, },
};
MODULE_DEVICE_TABLE(pci, sc1200_pci_tbl);
static struct pci_driver driver = {
.name = "SC1200 IDE",
......
......@@ -809,6 +809,7 @@ static struct pci_device_id svwks_pci_tbl[] = {
{ PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 3},
{ 0, },
};
MODULE_DEVICE_TABLE(pci, svwks_pci_tbl);
static struct pci_driver driver = {
.name = "Serverworks IDE",
......
......@@ -790,6 +790,7 @@ static struct pci_device_id sgiioc4_pci_tbl[] = {
PCI_ANY_ID, 0x0b4000, 0xFFFFFF, 0},
{0}
};
MODULE_DEVICE_TABLE(pci, sgiioc4_pci_tbl);
static struct pci_driver driver = {
.name = "SGI-IOC4 IDE",
......
......@@ -1196,6 +1196,7 @@ static struct pci_device_id siimage_pci_tbl[] = {
{ PCI_VENDOR_ID_CMD, PCI_DEVICE_ID_SII_1210SA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2},
{ 0, },
};
MODULE_DEVICE_TABLE(pci, siimage_pci_tbl);
static struct pci_driver driver = {
.name = "SiI IDE",
......
......@@ -957,6 +957,7 @@ static struct pci_device_id sis5513_pci_tbl[] = {
{ PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_5513, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
{ 0, },
};
MODULE_DEVICE_TABLE(pci, sis5513_pci_tbl);
static struct pci_driver driver = {
.name = "SIS IDE",
......
......@@ -494,6 +494,7 @@ static struct pci_device_id sl82c105_pci_tbl[] = {
{ PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
{ 0, },
};
MODULE_DEVICE_TABLE(pci, sl82c105_pci_tbl);
static struct pci_driver driver = {
.name = "W82C105 IDE",
......
......@@ -377,6 +377,7 @@ static struct pci_device_id slc90e66_pci_tbl[] = {
{ PCI_VENDOR_ID_EFAR, PCI_DEVICE_ID_EFAR_SLC90E66_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
{ 0, },
};
MODULE_DEVICE_TABLE(pci, slc90e66_pci_tbl);
static struct pci_driver driver = {
.name = "SLC90e66 IDE",
......
......@@ -37,5 +37,6 @@ static struct pci_device_id triflex_pci_tbl[] = {
PCI_ANY_ID, 0, 0, 0 },
{ 0, },
};
MODULE_DEVICE_TABLE(pci, triflex_pci_tbl);
#endif /* TRIFLEX_H */
......@@ -408,6 +408,7 @@ static struct pci_device_id trm290_pci_tbl[] = {
{ PCI_VENDOR_ID_TEKRAM, PCI_DEVICE_ID_TEKRAM_DC290, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
{ 0, },
};
MODULE_DEVICE_TABLE(pci, trm290_pci_tbl);
static struct pci_driver driver = {
.name = "TRM290 IDE",
......
......@@ -621,6 +621,7 @@ static struct pci_device_id via_pci_tbl[] = {
{ PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1},
{ 0, },
};
MODULE_DEVICE_TABLE(pci, via_pci_tbl);
static struct pci_driver driver = {
.name = "VIA IDE",
......
......@@ -512,7 +512,7 @@ int coda_readdir(struct file *coda_file, void *dirent, filldir_t filldir)
ret = -ENOENT;
if (!IS_DEADDIR(host_inode)) {
ret = host_file->f_op->readdir(host_file, filldir, dirent);
update_atime(host_inode);
file_accessed(host_file);
}
}
out:
......
......@@ -293,11 +293,11 @@ static long do_fcntl(unsigned int fd, unsigned int cmd,
err = dupfd(filp, arg);
break;
case F_GETFD:
err = get_close_on_exec(fd);
err = get_close_on_exec(fd) ? FD_CLOEXEC : 0;
break;
case F_SETFD:
err = 0;
set_close_on_exec(fd, arg&1);
set_close_on_exec(fd, arg & FD_CLOEXEC);
break;
case F_GETFL:
err = filp->f_flags;
......
......@@ -6,7 +6,6 @@
* HPFS bitmap operations
*/
#include <linux/buffer_head.h>
#include "hpfs_fn.h"
/*
......
......@@ -6,7 +6,6 @@
* handling HPFS anode tree that contains file allocation info
*/
#include <linux/buffer_head.h>
#include "hpfs_fn.h"
/* Find a sector in allocation tree */
......
......@@ -6,8 +6,6 @@
* general buffer i/o
*/
#include <linux/buffer_head.h>
#include <linux/string.h>
#include "hpfs_fn.h"
void hpfs_lock_creation(struct super_block *s)
......@@ -26,108 +24,6 @@ void hpfs_unlock_creation(struct super_block *s)
up(&hpfs_sb(s)->hpfs_creation_de);
}
void hpfs_lock_iget(struct super_block *s, int mode)
{
#ifdef DEBUG_LOCKS
printk("lock iget\n");
#endif
while (hpfs_sb(s)->sb_rd_inode) sleep_on(&hpfs_sb(s)->sb_iget_q);
hpfs_sb(s)->sb_rd_inode = mode;
}
void hpfs_unlock_iget(struct super_block *s)
{
#ifdef DEBUG_LOCKS
printk("unlock iget\n");
#endif
hpfs_sb(s)->sb_rd_inode = 0;
wake_up(&hpfs_sb(s)->sb_iget_q);
}
void hpfs_lock_inode(struct inode *i)
{
if (i) {
struct hpfs_inode_info *hpfs_inode = hpfs_i(i);
down(&hpfs_inode->i_sem);
}
}
void hpfs_unlock_inode(struct inode *i)
{
if (i) {
struct hpfs_inode_info *hpfs_inode = hpfs_i(i);
up(&hpfs_inode->i_sem);
}
}
void hpfs_lock_2inodes(struct inode *i1, struct inode *i2)
{
if (!i2 || i1 == i2) {
hpfs_lock_inode(i1);
} else if (!i1) {
hpfs_lock_inode(i2);
} else {
struct hpfs_inode_info *hpfs_i1 = hpfs_i(i1);
struct hpfs_inode_info *hpfs_i2 = hpfs_i(i2);
if (i1->i_ino < i2->i_ino) {
down(&hpfs_i1->i_sem);
down(&hpfs_i2->i_sem);
} else {
down(&hpfs_i2->i_sem);
down(&hpfs_i1->i_sem);
}
}
}
void hpfs_unlock_2inodes(struct inode *i1, struct inode *i2)
{
/* order of up() doesn't matter here */
hpfs_unlock_inode(i1);
hpfs_unlock_inode(i2);
}
void hpfs_lock_3inodes(struct inode *i1, struct inode *i2, struct inode *i3)
{
if (!i1) { hpfs_lock_2inodes(i2, i3); return; }
if (!i2) { hpfs_lock_2inodes(i1, i3); return; }
if (!i3) { hpfs_lock_2inodes(i1, i2); return; }
if (i1->i_ino < i2->i_ino && i1->i_ino < i3->i_ino) {
struct hpfs_inode_info *hpfs_i1 = hpfs_i(i1);
down(&hpfs_i1->i_sem);
hpfs_lock_2inodes(i2, i3);
} else if (i2->i_ino < i1->i_ino && i2->i_ino < i3->i_ino) {
struct hpfs_inode_info *hpfs_i2 = hpfs_i(i2);
down(&hpfs_i2->i_sem);
hpfs_lock_2inodes(i1, i3);
} else if (i3->i_ino < i1->i_ino && i3->i_ino < i2->i_ino) {
struct hpfs_inode_info *hpfs_i3 = hpfs_i(i3);
down(&hpfs_i3->i_sem);
hpfs_lock_2inodes(i1, i2);
} else if (i1->i_ino != i2->i_ino) hpfs_lock_2inodes(i1, i2);
else hpfs_lock_2inodes(i1, i3);
}
void hpfs_unlock_3inodes(struct inode *i1, struct inode *i2, struct inode *i3)
{
if (!i1) { hpfs_unlock_2inodes(i2, i3); return; }
if (!i2) { hpfs_unlock_2inodes(i1, i3); return; }
if (!i3) { hpfs_unlock_2inodes(i1, i2); return; }
if (i1->i_ino < i2->i_ino && i1->i_ino < i3->i_ino) {
struct hpfs_inode_info *hpfs_i1 = hpfs_i(i1);
hpfs_unlock_2inodes(i2, i3);
up(&hpfs_i1->i_sem);
} else if (i2->i_ino < i1->i_ino && i2->i_ino < i3->i_ino) {
struct hpfs_inode_info *hpfs_i2 = hpfs_i(i2);
hpfs_unlock_2inodes(i1, i3);
up(&hpfs_i2->i_sem);
} else if (i3->i_ino < i1->i_ino && i3->i_ino < i2->i_ino) {
struct hpfs_inode_info *hpfs_i3 = hpfs_i(i3);
hpfs_unlock_2inodes(i1, i2);
up(&hpfs_i3->i_sem);
} else if (i1->i_ino != i2->i_ino) hpfs_unlock_2inodes(i1, i2);
else hpfs_unlock_2inodes(i1, i3);
}
/* Map a sector into a buffer and return pointers to it and to the buffer. */
void *hpfs_map_sector(struct super_block *s, unsigned secno, struct buffer_head **bhp,
......@@ -174,7 +70,7 @@ void *hpfs_map_4sectors(struct super_block *s, unsigned secno, struct quad_buffe
return 0;
}
qbh->data = data = (char *)kmalloc(2048, GFP_KERNEL);
qbh->data = data = (char *)kmalloc(2048, GFP_NOFS);
if (!data) {
printk("HPFS: hpfs_map_4sectors: out of memory\n");
goto bail;
......@@ -226,7 +122,7 @@ void *hpfs_get_4sectors(struct super_block *s, unsigned secno,
}
/*return hpfs_map_4sectors(s, secno, qbh, 0);*/
if (!(qbh->data = kmalloc(2048, GFP_KERNEL))) {
if (!(qbh->data = kmalloc(2048, GFP_NOFS))) {
printk("HPFS: hpfs_get_4sectors: out of memory\n");
return NULL;
}
......
......@@ -7,11 +7,8 @@
*/
#include "hpfs_fn.h"
#include <linux/buffer_head.h>
#include <linux/time.h>
#include <linux/smp_lock.h>
int hpfs_dir_release(struct inode *inode, struct file *filp)
static int hpfs_dir_release(struct inode *inode, struct file *filp)
{
lock_kernel();
hpfs_del_pos(inode, &filp->f_pos);
......@@ -22,7 +19,7 @@ int hpfs_dir_release(struct inode *inode, struct file *filp)
/* This is slow, but it's not used often */
loff_t hpfs_dir_lseek(struct file *filp, loff_t off, int whence)
static loff_t hpfs_dir_lseek(struct file *filp, loff_t off, int whence)
{
loff_t new_off = off + (whence == 1 ? filp->f_pos : 0);
loff_t pos;
......@@ -35,25 +32,25 @@ loff_t hpfs_dir_lseek(struct file *filp, loff_t off, int whence)
/*printk("dir lseek\n");*/
if (new_off == 0 || new_off == 1 || new_off == 11 || new_off == 12 || new_off == 13) goto ok;
hpfs_lock_inode(i);
down(&i->i_sem);
pos = ((loff_t) hpfs_de_as_down_as_possible(s, hpfs_inode->i_dno) << 4) + 1;
while (pos != new_off) {
if (map_pos_dirent(i, &pos, &qbh)) hpfs_brelse4(&qbh);
else goto fail;
if (pos == 12) goto fail;
}
hpfs_unlock_inode(i);
ok:
up(&i->i_sem);
ok:
unlock_kernel();
return filp->f_pos = new_off;
fail:
hpfs_unlock_inode(i);
fail:
up(&i->i_sem);
/*printk("illegal lseek: %016llx\n", new_off);*/
unlock_kernel();
return -ESPIPE;
}
int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
static int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
{
struct inode *inode = filp->f_dentry->d_inode;
struct hpfs_inode_info *hpfs_inode = hpfs_i(inode);
......@@ -109,8 +106,6 @@ int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
goto out;
}
hpfs_lock_inode(inode);
while (1) {
again:
/* This won't work when cycle is longer than number of dirents
......@@ -118,31 +113,23 @@ int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
maybe killall -9 ls helps */
if (hpfs_sb(inode->i_sb)->sb_chk)
if (hpfs_stop_cycles(inode->i_sb, filp->f_pos, &c1, &c2, "hpfs_readdir")) {
hpfs_unlock_inode(inode);
ret = -EFSERROR;
goto out;
}
if (filp->f_pos == 12) {
hpfs_unlock_inode(inode);
if (filp->f_pos == 12)
goto out;
}
if (filp->f_pos == 3 || filp->f_pos == 4 || filp->f_pos == 5) {
printk("HPFS: warning: pos==%d\n",(int)filp->f_pos);
hpfs_unlock_inode(inode);
goto out;
}
if (filp->f_pos == 0) {
if (filldir(dirent, ".", 1, filp->f_pos, inode->i_ino, DT_DIR) < 0) {
hpfs_unlock_inode(inode);
if (filldir(dirent, ".", 1, filp->f_pos, inode->i_ino, DT_DIR) < 0)
goto out;
}
filp->f_pos = 11;
}
if (filp->f_pos == 11) {
if (filldir(dirent, "..", 2, filp->f_pos, hpfs_inode->i_parent_dir, DT_DIR) < 0) {
hpfs_unlock_inode(inode);
if (filldir(dirent, "..", 2, filp->f_pos, hpfs_inode->i_parent_dir, DT_DIR) < 0)
goto out;
}
filp->f_pos = 1;
}
if (filp->f_pos == 1) {
......@@ -150,14 +137,8 @@ int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
hpfs_add_pos(inode, &filp->f_pos);
filp->f_version = inode->i_version;
}
/*if (filp->f_version != inode->i_version) {
hpfs_unlock_inode(inode);
ret = -ENOENT;
goto out;
}*/
old_pos = filp->f_pos;
if (!(de = map_pos_dirent(inode, &filp->f_pos, &qbh))) {
hpfs_unlock_inode(inode);
ret = -EIOERROR;
goto out;
}
......@@ -174,7 +155,6 @@ int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
filp->f_pos = old_pos;
if (tempname != (char *)de->name) kfree(tempname);
hpfs_brelse4(&qbh);
hpfs_unlock_inode(inode);
goto out;
}
if (tempname != (char *)de->name) kfree(tempname);
......@@ -220,7 +200,6 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, struct name
goto end_add;
}
hpfs_lock_inode(dir);
/*
* '.' and '..' will never be passed here.
*/
......@@ -243,15 +222,28 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, struct name
* Go find or make an inode.
*/
hpfs_lock_iget(dir->i_sb, de->directory || (de->ea_size && hpfs_sb(dir->i_sb)->sb_eas) ? 1 : 2);
if (!(result = iget(dir->i_sb, ino))) {
hpfs_unlock_iget(dir->i_sb);
result = iget_locked(dir->i_sb, ino);
if (!result) {
hpfs_error(dir->i_sb, "hpfs_lookup: can't get inode");
goto bail1;
}
if (result->i_state & I_NEW) {
hpfs_init_inode(result);
if (de->directory)
hpfs_read_inode(result);
else if (de->ea_size && hpfs_sb(dir->i_sb)->sb_eas)
hpfs_read_inode(result);
else {
result->i_mode |= S_IFREG;
result->i_mode &= ~0111;
result->i_op = &hpfs_file_iops;
result->i_fop = &hpfs_file_ops;
result->i_nlink = 1;
}
unlock_new_inode(result);
}
hpfs_result = hpfs_i(result);
if (!de->directory) hpfs_result->i_parent_dir = dir->i_ino;
hpfs_unlock_iget(dir->i_sb);
hpfs_decide_conv(result, (char *)name, len);
......@@ -299,7 +291,6 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, struct name
*/
end:
hpfs_unlock_inode(dir);
end_add:
hpfs_set_dentry_operations(dentry);
unlock_kernel();
......@@ -315,7 +306,15 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, struct name
/*bail:*/
hpfs_unlock_inode(dir);
unlock_kernel();
return ERR_PTR(-ENOENT);
}
struct file_operations hpfs_dir_ops =
{
.llseek = hpfs_dir_lseek,
.read = generic_read_dir,
.readdir = hpfs_readdir,
.release = hpfs_dir_release,
.fsync = hpfs_file_fsync,
};
......@@ -6,7 +6,6 @@
* handling directory dnode tree - adding, deleteing & searching for dirents
*/
#include <linux/buffer_head.h>
#include "hpfs_fn.h"
static loff_t get_pos(struct dnode *d, struct hpfs_dirent *fde)
......@@ -32,7 +31,7 @@ void hpfs_add_pos(struct inode *inode, loff_t *pos)
for (; hpfs_inode->i_rddir_off[i]; i++)
if (hpfs_inode->i_rddir_off[i] == pos) return;
if (!(i&0x0f)) {
if (!(ppos = kmalloc((i+0x11) * sizeof(loff_t*), GFP_KERNEL))) {
if (!(ppos = kmalloc((i+0x11) * sizeof(loff_t*), GFP_NOFS))) {
printk("HPFS: out of memory for position list\n");
return;
}
......@@ -236,7 +235,7 @@ int hpfs_add_to_dnode(struct inode *i, dnode_secno dno, unsigned char *name, uns
struct buffer_head *bh;
struct fnode *fnode;
int c1, c2 = 0;
if (!(nname = kmalloc(256, GFP_KERNEL))) {
if (!(nname = kmalloc(256, GFP_NOFS))) {
printk("HPFS: out of memory, can't add to dnode\n");
return 1;
}
......@@ -273,7 +272,7 @@ int hpfs_add_to_dnode(struct inode *i, dnode_secno dno, unsigned char *name, uns
kfree(nname);
return 0;
}
if (!nd) if (!(nd = kmalloc(0x924, GFP_KERNEL))) {
if (!nd) if (!(nd = kmalloc(0x924, GFP_NOFS))) {
/* 0x924 is a max size of dnode after adding a dirent with
max name length. We alloc this only once. There must
not be any error while splitting dnodes, otherwise the
......@@ -478,7 +477,7 @@ static secno move_to_top(struct inode *i, dnode_secno from, dnode_secno to)
t = get_pos(dnode, de);
for_all_poss(i, hpfs_pos_subst, t, 4);
for_all_poss(i, hpfs_pos_subst, t + 1, 5);
if (!(nde = kmalloc(de->length, GFP_KERNEL))) {
if (!(nde = kmalloc(de->length, GFP_NOFS))) {
hpfs_error(i->i_sb, "out of memory for dirent - directory will be corrupted");
hpfs_brelse4(&qbh);
return 0;
......@@ -588,7 +587,7 @@ static void delete_empty_dnode(struct inode *i, dnode_secno dno)
struct quad_buffer_head qbh1;
if (!de_next->down) goto endm;
ndown = de_down_pointer(de_next);
if (!(de_cp = kmalloc(de->length, GFP_KERNEL))) {
if (!(de_cp = kmalloc(de->length, GFP_NOFS))) {
printk("HPFS: out of memory for dtree balancing\n");
goto endm;
}
......@@ -650,7 +649,7 @@ static void delete_empty_dnode(struct inode *i, dnode_secno dno)
} else if (down)
*(dnode_secno *) ((void *) del + del->length - 4) = down;
} else goto endm;
if (!(de_cp = kmalloc(de_prev->length, GFP_KERNEL))) {
if (!(de_cp = kmalloc(de_prev->length, GFP_NOFS))) {
printk("HPFS: out of memory for dtree balancing\n");
hpfs_brelse4(&qbh1);
goto endm;
......@@ -994,7 +993,7 @@ struct hpfs_dirent *map_fnode_dirent(struct super_block *s, fnode_secno fno,
int c1, c2 = 0;
int d1, d2 = 0;
name1 = f->name;
if (!(name2 = kmalloc(256, GFP_KERNEL))) {
if (!(name2 = kmalloc(256, GFP_NOFS))) {
printk("HPFS: out of memory, can't map dirent\n");
return NULL;
}
......
......@@ -6,8 +6,6 @@
* handling extended attributes
*/
#include <linux/buffer_head.h>
#include <linux/string.h>
#include "hpfs_fn.h"
/* Remove external extended attributes. ano specifies whether a is a
......@@ -52,7 +50,7 @@ void hpfs_ea_ext_remove(struct super_block *s, secno a, int ano, unsigned len)
static char *get_indirect_ea(struct super_block *s, int ano, secno a, int size)
{
char *ret;
if (!(ret = kmalloc(size + 1, GFP_KERNEL))) {
if (!(ret = kmalloc(size + 1, GFP_NOFS))) {
printk("HPFS: out of memory for EA\n");
return NULL;
}
......@@ -140,7 +138,7 @@ char *hpfs_get_ea(struct super_block *s, struct fnode *fnode, char *key, int *si
if (!strcmp(ea->name, key)) {
if (ea->indirect)
return get_indirect_ea(s, ea->anode, ea_sec(ea), *size = ea_len(ea));
if (!(ret = kmalloc((*size = ea->valuelen) + 1, GFP_KERNEL))) {
if (!(ret = kmalloc((*size = ea->valuelen) + 1, GFP_NOFS))) {
printk("HPFS: out of memory for EA\n");
return NULL;
}
......@@ -166,7 +164,7 @@ char *hpfs_get_ea(struct super_block *s, struct fnode *fnode, char *key, int *si
if (!strcmp(ea->name, key)) {
if (ea->indirect)
return get_indirect_ea(s, ea->anode, ea_sec(ea), *size = ea_len(ea));
if (!(ret = kmalloc((*size = ea->valuelen) + 1, GFP_KERNEL))) {
if (!(ret = kmalloc((*size = ea->valuelen) + 1, GFP_NOFS))) {
printk("HPFS: out of memory for EA\n");
return NULL;
}
......
......@@ -6,27 +6,11 @@
* file VFS functions
*/
#include <linux/buffer_head.h>
#include <linux/string.h>
#include <linux/time.h>
#include <linux/smp_lock.h>
#include <linux/pagemap.h>
#include "hpfs_fn.h"
#define BLOCKS(size) (((size) + 511) >> 9)
/* HUH? */
int hpfs_open(struct inode *i, struct file *f)
{
lock_kernel();
hpfs_lock_inode(i);
hpfs_unlock_inode(i); /* make sure nobody is deleting the file */
unlock_kernel();
if (!i->i_nlink) return -ENOENT;
return 0;
}
int hpfs_file_release(struct inode *inode, struct file *file)
static int hpfs_file_release(struct inode *inode, struct file *file)
{
lock_kernel();
hpfs_write_if_changed(inode);
......@@ -45,7 +29,7 @@ int hpfs_file_fsync(struct file *file, struct dentry *dentry, int datasync)
* so we must ignore such errors.
*/
secno hpfs_bmap(struct inode *inode, unsigned file_secno)
static secno hpfs_bmap(struct inode *inode, unsigned file_secno)
{
struct hpfs_inode_info *hpfs_inode = hpfs_i(inode);
unsigned n, disk_secno;
......@@ -61,7 +45,7 @@ secno hpfs_bmap(struct inode *inode, unsigned file_secno)
return disk_secno;
}
void hpfs_truncate(struct inode *i)
static void hpfs_truncate(struct inode *i)
{
if (IS_IMMUTABLE(i)) return /*-EPERM*/;
lock_kernel();
......@@ -74,7 +58,7 @@ void hpfs_truncate(struct inode *i)
unlock_kernel();
}
int hpfs_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create)
static int hpfs_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create)
{
secno s;
s = hpfs_bmap(inode, iblock);
......@@ -124,7 +108,7 @@ struct address_space_operations hpfs_aops = {
.bmap = _hpfs_bmap
};
ssize_t hpfs_file_write(struct file *file, const char __user *buf,
static ssize_t hpfs_file_write(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{
ssize_t retval;
......@@ -138,3 +122,19 @@ ssize_t hpfs_file_write(struct file *file, const char __user *buf,
return retval;
}
struct file_operations hpfs_file_ops =
{
.llseek = generic_file_llseek,
.read = generic_file_read,
.write = hpfs_file_write,
.mmap = generic_file_mmap,
.release = hpfs_file_release,
.fsync = hpfs_file_fsync,
.sendfile = generic_file_sendfile,
};
struct inode_operations hpfs_file_iops =
{
.truncate = hpfs_truncate,
.setattr = hpfs_notify_change,
};
......@@ -9,28 +9,14 @@
//#define DBG
//#define DEBUG_LOCKS
#include <linux/pagemap.h>
#include <linux/buffer_head.h>
#include <linux/fs.h>
#include <linux/hpfs_fs.h>
#include <linux/hpfs_fs_i.h>
#include <linux/hpfs_fs_sb.h>
#include <linux/errno.h>
#include <linux/slab.h>
#include <linux/kernel.h>
#include <linux/time.h>
#include <linux/stat.h>
#include <linux/string.h>
#include <asm/bitops.h>
#include <asm/uaccess.h>
#include <linux/smp_lock.h>
#include <stdarg.h>
#include "hpfs.h"
#define memcpy_tofs memcpy
#define memcpy_fromfs memcpy
#define EIOERROR EIO
#define EFSERROR EPERM
#define EMEMERROR ENOMEM
......@@ -56,7 +42,56 @@
#define PRINTK(x)
#endif
typedef void nonconst; /* What this is for ? */
struct hpfs_inode_info {
loff_t mmu_private;
ino_t i_parent_dir; /* (directories) gives fnode of parent dir */
unsigned i_dno; /* (directories) root dnode */
unsigned i_dpos; /* (directories) temp for readdir */
unsigned i_dsubdno; /* (directories) temp for readdir */
unsigned i_file_sec; /* (files) minimalist cache of alloc info */
unsigned i_disk_sec; /* (files) minimalist cache of alloc info */
unsigned i_n_secs; /* (files) minimalist cache of alloc info */
unsigned i_ea_size; /* size of extended attributes */
unsigned i_conv : 2; /* (files) crlf->newline hackery */
unsigned i_ea_mode : 1; /* file's permission is stored in ea */
unsigned i_ea_uid : 1; /* file's uid is stored in ea */
unsigned i_ea_gid : 1; /* file's gid is stored in ea */
unsigned i_dirty : 1;
struct semaphore i_sem;
struct semaphore i_parent;
loff_t **i_rddir_off;
struct inode vfs_inode;
};
struct hpfs_sb_info {
ino_t sb_root; /* inode number of root dir */
unsigned sb_fs_size; /* file system size, sectors */
unsigned sb_bitmaps; /* sector number of bitmap list */
unsigned sb_dirband_start; /* directory band start sector */
unsigned sb_dirband_size; /* directory band size, dnodes */
unsigned sb_dmap; /* sector number of dnode bit map */
unsigned sb_n_free; /* free blocks for statfs, or -1 */
unsigned sb_n_free_dnodes; /* free dnodes for statfs, or -1 */
uid_t sb_uid; /* uid from mount options */
gid_t sb_gid; /* gid from mount options */
umode_t sb_mode; /* mode from mount options */
unsigned sb_conv : 2; /* crlf->newline hackery */
unsigned sb_eas : 2; /* eas: 0-ignore, 1-ro, 2-rw */
unsigned sb_err : 2; /* on errs: 0-cont, 1-ro, 2-panic */
unsigned sb_chk : 2; /* checks: 0-no, 1-normal, 2-strict */
unsigned sb_lowercase : 1; /* downcase filenames hackery */
unsigned sb_was_error : 1; /* there was an error, set dirty flag */
unsigned sb_chkdsk : 2; /* chkdsk: 0-no, 1-on errs, 2-allways */
unsigned char *sb_cp_table; /* code page tables: */
/* 128 bytes uppercasing table & */
/* 128 bytes lowercasing table */
unsigned *sb_bmp_dir; /* main bitmap directory */
unsigned sb_c_bitmap; /* current bitmap */
struct semaphore hpfs_creation_de; /* when creating dirents, nobody else
can alloc blocks */
/*unsigned sb_mounting : 1;*/
int sb_timeshift;
};
/*
* conv= options
......@@ -162,8 +197,6 @@ static inline unsigned tstbits(unsigned *bmp, unsigned b, unsigned n)
return 0;
}
struct statfs;
/* alloc.c */
int hpfs_chk_sectors(struct super_block *, secno, int, char *);
......@@ -192,14 +225,6 @@ void hpfs_remove_fnode(struct super_block *, fnode_secno fno);
void hpfs_lock_creation(struct super_block *);
void hpfs_unlock_creation(struct super_block *);
void hpfs_lock_iget(struct super_block *, int);
void hpfs_unlock_iget(struct super_block *);
void hpfs_lock_inode(struct inode *);
void hpfs_unlock_inode(struct inode *);
void hpfs_lock_2inodes(struct inode *, struct inode *);
void hpfs_unlock_2inodes(struct inode *, struct inode *);
void hpfs_lock_3inodes(struct inode *, struct inode *, struct inode *);
void hpfs_unlock_3inodes(struct inode *, struct inode *, struct inode *);
void *hpfs_map_sector(struct super_block *, unsigned, struct buffer_head **, int);
void *hpfs_get_sector(struct super_block *, unsigned, struct buffer_head **);
void *hpfs_map_4sectors(struct super_block *, unsigned, struct quad_buffer_head *, int);
......@@ -213,10 +238,8 @@ void hpfs_set_dentry_operations(struct dentry *);
/* dir.c */
int hpfs_dir_release(struct inode *, struct file *);
loff_t hpfs_dir_lseek(struct file *, loff_t, int);
int hpfs_readdir(struct file *, void *, filldir_t);
struct dentry *hpfs_lookup(struct inode *, struct dentry *, struct nameidata *);
extern struct file_operations hpfs_dir_ops;
/* dnode.c */
......@@ -243,16 +266,14 @@ void hpfs_set_ea(struct inode *, struct fnode *, char *, char *, int);
/* file.c */
int hpfs_file_release(struct inode *, struct file *);
int hpfs_open(struct inode *, struct file *);
int hpfs_file_fsync(struct file *, struct dentry *, int);
secno hpfs_bmap(struct inode *, unsigned);
void hpfs_truncate(struct inode *);
int hpfs_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create);
ssize_t hpfs_file_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos);
extern struct file_operations hpfs_file_ops;
extern struct inode_operations hpfs_file_iops;
extern struct address_space_operations hpfs_aops;
/* inode.c */
void hpfs_init_inode(struct inode *);
void hpfs_read_inode(struct inode *);
void hpfs_write_inode_ea(struct inode *, struct fnode *);
void hpfs_write_inode(struct inode *);
......@@ -284,14 +305,8 @@ void hpfs_decide_conv(struct inode *, unsigned char *, unsigned);
/* namei.c */
int hpfs_mkdir(struct inode *, struct dentry *, int);
int hpfs_create(struct inode *, struct dentry *, int, struct nameidata *);
int hpfs_mknod(struct inode *, struct dentry *, int, dev_t);
int hpfs_symlink(struct inode *, struct dentry *, const char *);
int hpfs_unlink(struct inode *, struct dentry *);
int hpfs_rmdir(struct inode *, struct dentry *);
int hpfs_symlink_readpage(struct file *, struct page *);
int hpfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
extern struct inode_operations hpfs_dir_iops;
extern struct address_space_operations hpfs_symlink_aops;
static inline struct hpfs_inode_info *hpfs_i(struct inode *inode)
{
......@@ -307,12 +322,7 @@ static inline struct hpfs_sb_info *hpfs_sb(struct super_block *sb)
void hpfs_error(struct super_block *, char *, ...);
int hpfs_stop_cycles(struct super_block *, int, int *, int *, char *);
int hpfs_remount_fs(struct super_block *, int *, char *);
void hpfs_put_super(struct super_block *);
unsigned hpfs_count_one_bitmap(struct super_block *, secno);
int hpfs_statfs(struct super_block *, struct kstatfs *);
extern struct address_space_operations hpfs_aops;
/*
* local time (HPFS) to GMT (Unix)
......@@ -329,4 +339,3 @@ static inline time_t gmt_to_local(struct super_block *s, time_t t)
extern struct timezone sys_tz;
return t - sys_tz.tz_minuteswest * 60 - hpfs_sb(s)->sb_timeshift;
}
......@@ -6,65 +6,12 @@
* inode VFS functions
*/
#include <linux/fs.h>
#include <linux/time.h>
#include <linux/smp_lock.h>
#include <linux/buffer_head.h>
#include "hpfs_fn.h"
static struct file_operations hpfs_file_ops =
void hpfs_init_inode(struct inode *i)
{
.llseek = generic_file_llseek,
.read = generic_file_read,
.write = hpfs_file_write,
.mmap = generic_file_mmap,
.open = hpfs_open,
.release = hpfs_file_release,
.fsync = hpfs_file_fsync,
.sendfile = generic_file_sendfile,
};
static struct inode_operations hpfs_file_iops =
{
.truncate = hpfs_truncate,
.setattr = hpfs_notify_change,
};
static struct file_operations hpfs_dir_ops =
{
.llseek = hpfs_dir_lseek,
.read = generic_read_dir,
.readdir = hpfs_readdir,
.open = hpfs_open,
.release = hpfs_dir_release,
.fsync = hpfs_file_fsync,
};
static struct inode_operations hpfs_dir_iops =
{
.create = hpfs_create,
.lookup = hpfs_lookup,
.unlink = hpfs_unlink,
.symlink = hpfs_symlink,
.mkdir = hpfs_mkdir,
.rmdir = hpfs_rmdir,
.mknod = hpfs_mknod,
.rename = hpfs_rename,
.setattr = hpfs_notify_change,
};
struct address_space_operations hpfs_symlink_aops = {
.readpage = hpfs_symlink_readpage
};
void hpfs_read_inode(struct inode *i)
{
struct buffer_head *bh;
struct fnode *fnode;
struct super_block *sb = i->i_sb;
struct hpfs_inode_info *hpfs_inode = hpfs_i(i);
unsigned char *ea;
int ea_size;
i->i_uid = hpfs_sb(sb)->sb_uid;
i->i_gid = hpfs_sb(sb)->sb_gid;
......@@ -91,17 +38,17 @@ void hpfs_read_inode(struct inode *i)
i->i_ctime.tv_sec = i->i_ctime.tv_nsec = 0;
i->i_mtime.tv_sec = i->i_mtime.tv_nsec = 0;
i->i_atime.tv_sec = i->i_atime.tv_nsec = 0;
}
void hpfs_read_inode(struct inode *i)
{
struct buffer_head *bh;
struct fnode *fnode;
struct super_block *sb = i->i_sb;
struct hpfs_inode_info *hpfs_inode = hpfs_i(i);
unsigned char *ea;
int ea_size;
if (!hpfs_sb(i->i_sb)->sb_rd_inode)
hpfs_error(i->i_sb, "read_inode: sb_rd_inode == 0");
if (hpfs_sb(i->i_sb)->sb_rd_inode == 2) {
i->i_mode |= S_IFREG;
i->i_mode &= ~0111;
i->i_op = &hpfs_file_iops;
i->i_fop = &hpfs_file_ops;
i->i_nlink = 1;
return;
}
if (!(fnode = hpfs_map_fnode(sb, i->i_ino, &bh))) {
/*i->i_mode |= S_IFREG;
i->i_mode &= ~0111;
......@@ -233,21 +180,33 @@ void hpfs_write_inode(struct inode *i)
{
struct hpfs_inode_info *hpfs_inode = hpfs_i(i);
struct inode *parent;
if (!i->i_nlink) return;
if (i->i_ino == hpfs_sb(i->i_sb)->sb_root) return;
if (hpfs_inode->i_rddir_off && !atomic_read(&i->i_count)) {
if (*hpfs_inode->i_rddir_off) printk("HPFS: write_inode: some position still there\n");
kfree(hpfs_inode->i_rddir_off);
hpfs_inode->i_rddir_off = NULL;
}
down(&hpfs_inode->i_parent);
if (!i->i_nlink) {
up(&hpfs_inode->i_parent);
return;
}
parent = iget_locked(i->i_sb, hpfs_inode->i_parent_dir);
if (parent) {
hpfs_inode->i_dirty = 0;
hpfs_lock_iget(i->i_sb, 1);
parent = iget(i->i_sb, hpfs_inode->i_parent_dir);
hpfs_unlock_iget(i->i_sb);
hpfs_lock_inode(parent);
if (parent->i_state & I_NEW) {
hpfs_init_inode(parent);
hpfs_read_inode(parent);
unlock_new_inode(parent);
}
down(&hpfs_inode->i_sem);
hpfs_write_inode_nolock(i);
hpfs_unlock_inode(parent);
up(&hpfs_inode->i_sem);
iput(parent);
} else {
mark_inode_dirty(i);
}
up(&hpfs_inode->i_parent);
}
void hpfs_write_inode_nolock(struct inode *i)
......
......@@ -6,7 +6,6 @@
* mapping structures to memory with some minimal checks
*/
#include <linux/buffer_head.h>
#include "hpfs_fn.h"
unsigned *hpfs_map_dnode_bitmap(struct super_block *s, struct quad_buffer_head *qbh)
......
......@@ -6,7 +6,6 @@
* operations with filenames
*/
#include <linux/string.h>
#include "hpfs_fn.h"
char *text_postfix[]={
......
This diff is collapsed.
......@@ -6,13 +6,11 @@
* mounting, unmounting, error handling
*/
#include <linux/buffer_head.h>
#include <linux/string.h>
#include "hpfs_fn.h"
#include <linux/module.h>
#include <linux/parser.h>
#include <linux/init.h>
#include <linux/vfs.h>
#include <linux/statfs.h>
/* Mark the filesystem dirty, so that chkdsk checks it when os/2 booted */
......@@ -101,7 +99,7 @@ int hpfs_stop_cycles(struct super_block *s, int key, int *c1, int *c2,
return 0;
}
void hpfs_put_super(struct super_block *s)
static void hpfs_put_super(struct super_block *s)
{
struct hpfs_sb_info *sbi = hpfs_sb(s);
if (sbi->sb_cp_table) kfree(sbi->sb_cp_table);
......@@ -137,7 +135,7 @@ static unsigned count_bitmaps(struct super_block *s)
return count;
}
int hpfs_statfs(struct super_block *s, struct kstatfs *buf)
static int hpfs_statfs(struct super_block *s, struct kstatfs *buf)
{
struct hpfs_sb_info *sbi = hpfs_sb(s);
lock_kernel();
......@@ -165,7 +163,7 @@ static kmem_cache_t * hpfs_inode_cachep;
static struct inode *hpfs_alloc_inode(struct super_block *sb)
{
struct hpfs_inode_info *ei;
ei = (struct hpfs_inode_info *)kmem_cache_alloc(hpfs_inode_cachep, SLAB_KERNEL);
ei = (struct hpfs_inode_info *)kmem_cache_alloc(hpfs_inode_cachep, SLAB_NOFS);
if (!ei)
return NULL;
ei->vfs_inode.i_version = 1;
......@@ -184,6 +182,7 @@ static void init_once(void * foo, kmem_cache_t * cachep, unsigned long flags)
if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) ==
SLAB_CTOR_CONSTRUCTOR) {
init_MUTEX(&ei->i_sem);
init_MUTEX(&ei->i_parent);
inode_init_once(&ei->vfs_inode);
}
}
......@@ -205,19 +204,6 @@ static void destroy_inodecache(void)
printk(KERN_INFO "hpfs_inode_cache: not all structures were freed\n");
}
/* Super operations */
static struct super_operations hpfs_sops =
{
.alloc_inode = hpfs_alloc_inode,
.destroy_inode = hpfs_destroy_inode,
.read_inode = hpfs_read_inode,
.delete_inode = hpfs_delete_inode,
.put_super = hpfs_put_super,
.statfs = hpfs_statfs,
.remount_fs = hpfs_remount_fs,
};
/*
* A tiny parser for option strings, stolen from dosfs.
* Stolen again from read-only hpfs.
......@@ -397,7 +383,7 @@ HPFS filesystem options:\n\
\n");
}
int hpfs_remount_fs(struct super_block *s, int *flags, char *data)
static int hpfs_remount_fs(struct super_block *s, int *flags, char *data)
{
uid_t uid;
gid_t gid;
......@@ -441,6 +427,18 @@ int hpfs_remount_fs(struct super_block *s, int *flags, char *data)
return 0;
}
/* Super operations */
static struct super_operations hpfs_sops =
{
.alloc_inode = hpfs_alloc_inode,
.destroy_inode = hpfs_destroy_inode,
.delete_inode = hpfs_delete_inode,
.put_super = hpfs_put_super,
.statfs = hpfs_statfs,
.remount_fs = hpfs_remount_fs,
};
static int hpfs_fill_super(struct super_block *s, void *options, int silent)
{
struct buffer_head *bh0, *bh1, *bh2;
......@@ -470,9 +468,7 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
sbi->sb_bmp_dir = NULL;
sbi->sb_cp_table = NULL;
sbi->sb_rd_inode = 0;
init_MUTEX(&sbi->hpfs_creation_de);
init_waitqueue_head(&sbi->sb_iget_q);
uid = current->uid;
gid = current->gid;
......@@ -613,9 +609,12 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
brelse(bh1);
brelse(bh0);
hpfs_lock_iget(s, 1);
root = iget(s, sbi->sb_root);
hpfs_unlock_iget(s);
root = iget_locked(s, sbi->sb_root);
if (!root)
goto bail0;
hpfs_init_inode(root);
hpfs_read_inode(root);
unlock_new_inode(root);
s->s_root = d_alloc_root(root);
if (!s->s_root) {
iput(root);
......
......@@ -62,7 +62,7 @@ static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma)
vma_len = (loff_t)(vma->vm_end - vma->vm_start);
down(&inode->i_sem);
update_atime(inode);
file_accessed(file);
vma->vm_flags |= VM_HUGETLB | VM_RESERVED;
vma->vm_ops = &hugetlb_vm_ops;
ret = hugetlb_prefault(mapping, vma);
......
......@@ -412,7 +412,7 @@ static inline int do_follow_link(struct dentry *dentry, struct nameidata *nd)
goto loop;
current->link_count++;
current->total_link_count++;
update_atime(dentry->d_inode);
touch_atime(nd->mnt, dentry);
err = dentry->d_inode->i_op->follow_link(dentry, nd);
current->link_count--;
return err;
......@@ -1368,7 +1368,7 @@ int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd)
error = security_inode_follow_link(dentry, nd);
if (error)
goto exit_dput;
update_atime(dentry->d_inode);
touch_atime(nd->mnt, dentry);
error = dentry->d_inode->i_op->follow_link(dentry, nd);
dput(dentry);
if (error)
......
......@@ -681,6 +681,10 @@ static int do_add_mount(struct nameidata *nd, char *type, int flags,
if (nd->mnt->mnt_sb == mnt->mnt_sb && nd->mnt->mnt_root == nd->dentry)
goto unlock;
err = -EINVAL;
if (S_ISLNK(mnt->mnt_root->d_inode->i_mode))
goto unlock;
mnt->mnt_flags = mnt_flags;
err = graft_tree(mnt, nd);
unlock:
......
......@@ -1143,7 +1143,7 @@ nfsd_readlink(struct svc_rqst *rqstp, struct svc_fh *fhp, char *buf, int *lenp)
if (!inode->i_op || !inode->i_op->readlink)
goto out;
update_atime(inode);
touch_atime(fhp->fh_export->ex_mnt, dentry);
/* N.B. Why does this call need a get_fs()??
* Remove the set_fs and watch the fireworks:-) --okir
*/
......
......@@ -165,7 +165,7 @@ pipe_readv(struct file *filp, const struct iovec *_iov,
kill_fasync(PIPE_FASYNC_WRITERS(*inode), SIGIO, POLL_OUT);
}
if (ret > 0)
update_atime(inode);
file_accessed(filp);
return ret;
}
......
......@@ -32,7 +32,7 @@ int vfs_readdir(struct file *file, filldir_t filler, void *buf)
res = -ENOENT;
if (!IS_DEADDIR(inode)) {
res = file->f_op->readdir(file, buf, filler);
update_atime(inode);
file_accessed(file);
}
up(&inode->i_sem);
out:
......
......@@ -272,7 +272,7 @@ asmlinkage long sys_readlink(const char __user * path, char __user * buf, int bu
if (inode->i_op && inode->i_op->readlink) {
error = security_inode_readlink(nd.dentry);
if (!error) {
update_atime(inode);
touch_atime(nd.mnt, nd.dentry);
error = inode->i_op->readlink(nd.dentry, buf, bufsiz);
}
}
......
......@@ -48,7 +48,7 @@ typedef struct {
#define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d))
#define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d))
#define __FD_ISSET(d, set) ((set)->fds_bits[__FDELT(d)] & __FDMASK(d))
#define __FD_ISSET(d, set) (((set)->fds_bits[__FDELT(d)] & __FDMASK(d)) != 0)
#define __FD_ZERO(set) \
((void) memset ((__ptr_t) (set), 0, sizeof (__kernel_fd_set)))
......
......@@ -914,6 +914,17 @@ static inline void mark_inode_dirty_sync(struct inode *inode)
__mark_inode_dirty(inode, I_DIRTY_SYNC);
}
static inline void touch_atime(struct vfsmount *mnt, struct dentry *dentry)
{
/* per-mountpoint checks will go here */
update_atime(dentry->d_inode);
}
static inline void file_accessed(struct file *file)
{
touch_atime(file->f_vfsmnt, file->f_dentry);
}
/**
* &export_operations - for nfsd to communicate with file systems
......@@ -1321,7 +1332,8 @@ extern ssize_t do_sync_write(struct file *filp, const char __user *buf, size_t l
ssize_t generic_file_write_nolock(struct file *file, const struct iovec *iov,
unsigned long nr_segs, loff_t *ppos);
extern ssize_t generic_file_sendfile(struct file *, loff_t *, size_t, read_actor_t, void __user *);
extern void do_generic_mapping_read(struct address_space *, struct file_ra_state *, struct file *,
extern void do_generic_mapping_read(struct address_space *mapping,
struct file_ra_state *, struct file *,
loff_t *, read_descriptor_t *, read_actor_t);
extern void
file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping);
......
#ifndef _HPFS_FS_I
#define _HPFS_FS_I
struct hpfs_inode_info {
loff_t mmu_private;
ino_t i_parent_dir; /* (directories) gives fnode of parent dir */
unsigned i_dno; /* (directories) root dnode */
unsigned i_dpos; /* (directories) temp for readdir */
unsigned i_dsubdno; /* (directories) temp for readdir */
unsigned i_file_sec; /* (files) minimalist cache of alloc info */
unsigned i_disk_sec; /* (files) minimalist cache of alloc info */
unsigned i_n_secs; /* (files) minimalist cache of alloc info */
unsigned i_ea_size; /* size of extended attributes */
unsigned i_conv : 2; /* (files) crlf->newline hackery */
unsigned i_ea_mode : 1; /* file's permission is stored in ea */
unsigned i_ea_uid : 1; /* file's uid is stored in ea */
unsigned i_ea_gid : 1; /* file's gid is stored in ea */
unsigned i_dirty : 1;
struct semaphore i_sem; /* semaphore */
loff_t **i_rddir_off;
struct inode vfs_inode;
};
#endif
#ifndef _HPFS_FS_SB
#define _HPFS_FS_SB
struct hpfs_sb_info {
ino_t sb_root; /* inode number of root dir */
unsigned sb_fs_size; /* file system size, sectors */
unsigned sb_bitmaps; /* sector number of bitmap list */
unsigned sb_dirband_start; /* directory band start sector */
unsigned sb_dirband_size; /* directory band size, dnodes */
unsigned sb_dmap; /* sector number of dnode bit map */
unsigned sb_n_free; /* free blocks for statfs, or -1 */
unsigned sb_n_free_dnodes; /* free dnodes for statfs, or -1 */
uid_t sb_uid; /* uid from mount options */
gid_t sb_gid; /* gid from mount options */
umode_t sb_mode; /* mode from mount options */
unsigned sb_conv : 2; /* crlf->newline hackery */
unsigned sb_eas : 2; /* eas: 0-ignore, 1-ro, 2-rw */
unsigned sb_err : 2; /* on errs: 0-cont, 1-ro, 2-panic */
unsigned sb_chk : 2; /* checks: 0-no, 1-normal, 2-strict */
unsigned sb_lowercase : 1; /* downcase filenames hackery */
unsigned sb_was_error : 1; /* there was an error, set dirty flag */
unsigned sb_chkdsk : 2; /* chkdsk: 0-no, 1-on errs, 2-allways */
unsigned sb_rd_fnode : 2; /* read fnode 0-no 1-dirs 2-all */
unsigned sb_rd_inode : 2; /* lookup tells read_inode: 1-read fnode
2-don't read fnode, file
3-don't read fnode, direcotry */
wait_queue_head_t sb_iget_q;
unsigned char *sb_cp_table; /* code page tables: */
/* 128 bytes uppercasing table & */
/* 128 bytes lowercasing table */
unsigned *sb_bmp_dir; /* main bitmap directory */
unsigned sb_c_bitmap; /* current bitmap */
struct semaphore hpfs_creation_de; /* when creating dirents, nobody else
can alloc blocks */
/*unsigned sb_mounting : 1;*/
int sb_timeshift;
};
#endif
......@@ -547,6 +547,8 @@ extern void node_nr_running_init(void);
#define node_nr_running_init() {}
#endif
/* Move tasks off this (offline) CPU onto another. */
extern void migrate_all_tasks(void);
extern void set_user_nice(task_t *p, long nice);
extern int task_prio(task_t *p);
extern int task_nice(task_t *p);
......
......@@ -149,7 +149,7 @@ static void shm_close (struct vm_area_struct *shmd)
static int shm_mmap(struct file * file, struct vm_area_struct * vma)
{
update_atime(file->f_dentry->d_inode);
file_accessed(file);
vma->vm_ops = &shm_vm_ops;
shm_inc(file->f_dentry->d_inode->i_ino);
return 0;
......
......@@ -9,6 +9,7 @@
#include <linux/sched.h>
#include <linux/unistd.h>
#include <linux/cpu.h>
#include <linux/module.h>
#include <asm/semaphore.h>
/* This protects CPUs going up and down... */
......@@ -19,13 +20,23 @@ static struct notifier_block *cpu_chain;
/* Need to know about CPUs going up/down? */
int register_cpu_notifier(struct notifier_block *nb)
{
return notifier_chain_register(&cpu_chain, nb);
int ret;
if ((ret = down_interruptible(&cpucontrol)) != 0)
return ret;
ret = notifier_chain_register(&cpu_chain, nb);
up(&cpucontrol);
return ret;
}
EXPORT_SYMBOL(register_cpu_notifier);
void unregister_cpu_notifier(struct notifier_block *nb)
{
notifier_chain_unregister(&cpu_chain,nb);
down(&cpucontrol);
notifier_chain_unregister(&cpu_chain, nb);
up(&cpucontrol);
}
EXPORT_SYMBOL(unregister_cpu_notifier);
int __devinit cpu_up(unsigned int cpu)
{
......
......@@ -2793,6 +2793,63 @@ static int migration_thread(void * data)
return 0;
}
#ifdef CONFIG_HOTPLUG_CPU
/* migrate_all_tasks - function to migrate all the tasks from the
* current cpu caller must have already scheduled this to the target
* cpu via set_cpus_allowed. Machine is stopped. */
void migrate_all_tasks(void)
{
struct task_struct *tsk, *t;
int dest_cpu, src_cpu;
unsigned int node;
/* We're nailed to this CPU. */
src_cpu = smp_processor_id();
/* Not required, but here for neatness. */
write_lock(&tasklist_lock);
/* watch out for per node tasks, let's stay on this node */
node = cpu_to_node(src_cpu);
do_each_thread(t, tsk) {
cpumask_t mask;
if (tsk == current)
continue;
if (task_cpu(tsk) != src_cpu)
continue;
/* Figure out where this task should go (attempting to
* keep it on-node), and check if it can be migrated
* as-is. NOTE that kernel threads bound to more than
* one online cpu will be migrated. */
mask = node_to_cpumask(node);
cpus_and(mask, mask, tsk->cpus_allowed);
dest_cpu = any_online_cpu(mask);
if (dest_cpu == NR_CPUS)
dest_cpu = any_online_cpu(tsk->cpus_allowed);
if (dest_cpu == NR_CPUS) {
cpus_clear(tsk->cpus_allowed);
cpus_complement(tsk->cpus_allowed);
dest_cpu = any_online_cpu(tsk->cpus_allowed);
/* Don't tell them about moving exiting tasks
or kernel threads (both mm NULL), since
they never leave kernel. */
if (tsk->mm && printk_ratelimit())
printk(KERN_INFO "process %d (%s) no "
"longer affine to cpu%d\n",
tsk->pid, tsk->comm, src_cpu);
}
move_task_away(tsk, dest_cpu);
} while_each_thread(t, tsk);
write_unlock(&tasklist_lock);
}
#endif /* CONFIG_HOTPLUG_CPU */
/*
* migration_call - callback that gets triggered when a CPU is added.
* Here we can start up the necessary migration thread for the new CPU.
......
......@@ -725,7 +725,7 @@ void do_generic_mapping_read(struct address_space *mapping,
*ppos = ((loff_t) index << PAGE_CACHE_SHIFT) + offset;
if (cached_page)
page_cache_release(cached_page);
update_atime(inode);
file_accessed(filp);
}
EXPORT_SYMBOL(do_generic_mapping_read);
......@@ -820,7 +820,7 @@ __generic_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
if (retval > 0)
*ppos = pos + retval;
}
update_atime(filp->f_dentry->d_inode);
file_accessed(filp);
goto out;
}
......@@ -1353,11 +1353,10 @@ static struct vm_operations_struct generic_file_vm_ops = {
int generic_file_mmap(struct file * file, struct vm_area_struct * vma)
{
struct address_space *mapping = file->f_mapping;
struct inode *inode = mapping->host;
if (!mapping->a_ops->readpage)
return -ENOEXEC;
update_atime(inode);
file_accessed(file);
vma->vm_ops = &generic_file_vm_ops;
return 0;
}
......
......@@ -1061,14 +1061,8 @@ void shmem_lock(struct file *file, int lock)
static int shmem_mmap(struct file *file, struct vm_area_struct *vma)
{
struct vm_operations_struct *ops;
struct inode *inode = file->f_dentry->d_inode;
ops = &shmem_vm_ops;
if (!S_ISREG(inode->i_mode))
return -EACCES;
update_atime(inode);
vma->vm_ops = ops;
file_accessed(file);
vma->vm_ops = &shmem_vm_ops;
return 0;
}
......@@ -1363,7 +1357,7 @@ static void do_shmem_file_read(struct file *filp, loff_t *ppos, read_descriptor_
}
*ppos = ((loff_t) index << PAGE_CACHE_SHIFT) + offset;
update_atime(inode);
file_accessed(filp);
}
static ssize_t shmem_file_read(struct file *filp, char __user *buf, size_t count, loff_t *ppos)
......
......@@ -691,7 +691,7 @@ static struct sock *unix_find_other(struct sockaddr_un *sunname, int len,
goto put_fail;
if (u->sk_type == type)
update_atime(nd.dentry->d_inode);
touch_atime(nd.mnt, nd.dentry);
path_release(&nd);
......@@ -707,7 +707,7 @@ static struct sock *unix_find_other(struct sockaddr_un *sunname, int len,
struct dentry *dentry;
dentry = unix_sk(u)->dentry;
if (dentry)
update_atime(dentry->d_inode);
touch_atime(unix_sk(u)->mnt, dentry);
} else
goto fail;
}
......
......@@ -1570,8 +1570,8 @@ int snd_cs4231_pcm(cs4231_t *chip)
#ifdef EBUS_SUPPORT
if (chip->flags & CS4231_FLAG_EBUS) {
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_PCI,
snd_dma_pci_data(chip->dev_u.pdev)
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
snd_dma_pci_data(chip->dev_u.pdev),
64*1024, 128*1024);
} else {
#endif
......
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