patch-2.4.25 linux-2.4.25/fs/fat/inode.c
Next file: linux-2.4.25/fs/fat/misc.c
Previous file: linux-2.4.25/fs/fat/dir.c
Back to the patch index
Back to the overall index
- Lines: 205
- Date:
2004-02-18 05:36:31.000000000 -0800
- Orig file:
linux-2.4.24/fs/fat/inode.c
- Orig date:
2003-08-25 04:44:43.000000000 -0700
diff -urN linux-2.4.24/fs/fat/inode.c linux-2.4.25/fs/fat/inode.c
@@ -83,17 +83,17 @@
}
}
-static inline unsigned long fat_hash(struct super_block *sb, int i_pos)
+static inline unsigned long fat_hash(struct super_block *sb, loff_t i_pos)
{
unsigned long tmp = (unsigned long)i_pos | (unsigned long) sb;
tmp = tmp + (tmp >> FAT_HASH_BITS) + (tmp >> FAT_HASH_BITS * 2);
return tmp & FAT_HASH_MASK;
}
-void fat_attach(struct inode *inode, int i_pos)
+void fat_attach(struct inode *inode, loff_t i_pos)
{
spin_lock(&fat_inode_lock);
- MSDOS_I(inode)->i_location = i_pos;
+ MSDOS_I(inode)->i_pos = i_pos;
list_add(&MSDOS_I(inode)->i_fat_hash,
fat_inode_hashtable + fat_hash(inode->i_sb, i_pos));
spin_unlock(&fat_inode_lock);
@@ -102,13 +102,13 @@
void fat_detach(struct inode *inode)
{
spin_lock(&fat_inode_lock);
- MSDOS_I(inode)->i_location = 0;
+ MSDOS_I(inode)->i_pos = 0;
list_del(&MSDOS_I(inode)->i_fat_hash);
INIT_LIST_HEAD(&MSDOS_I(inode)->i_fat_hash);
spin_unlock(&fat_inode_lock);
}
-struct inode *fat_iget(struct super_block *sb, int i_pos)
+struct inode *fat_iget(struct super_block *sb, loff_t i_pos)
{
struct list_head *p = fat_inode_hashtable + fat_hash(sb, i_pos);
struct list_head *walk;
@@ -120,7 +120,7 @@
i = list_entry(walk, struct msdos_inode_info, i_fat_hash);
if (i->i_fat_inode->i_sb != sb)
continue;
- if (i->i_location != i_pos)
+ if (i->i_pos != i_pos)
continue;
inode = igrab(i->i_fat_inode);
if (inode)
@@ -133,11 +133,11 @@
static void fat_fill_inode(struct inode *inode, struct msdos_dir_entry *de);
struct inode *fat_build_inode(struct super_block *sb,
- struct msdos_dir_entry *de, int ino, int *res)
+ struct msdos_dir_entry *de, loff_t i_pos, int *res)
{
struct inode *inode;
*res = 0;
- inode = fat_iget(sb, ino);
+ inode = fat_iget(sb, i_pos);
if (inode)
goto out;
inode = new_inode(sb);
@@ -147,7 +147,7 @@
*res = 0;
inode->i_ino = iunique(sb, MSDOS_ROOT_INO);
fat_fill_inode(inode, de);
- fat_attach(inode, ino);
+ fat_attach(inode, i_pos);
insert_inode_hash(inode);
out:
return inode;
@@ -379,7 +379,7 @@
int nr;
INIT_LIST_HEAD(&MSDOS_I(inode)->i_fat_hash);
- MSDOS_I(inode)->i_location = 0;
+ MSDOS_I(inode)->i_pos = 0;
MSDOS_I(inode)->i_fat_inode = inode;
inode->i_uid = sbi->options.fs_uid;
inode->i_gid = sbi->options.fs_gid;
@@ -421,9 +421,10 @@
* 0/ i_ino - for fast, reliable lookup if still in the cache
* 1/ i_generation - to see if i_ino is still valid
* bit 0 == 0 iff directory
- * 2/ i_location - if ino has changed, but still in cache
- * 3/ i_logstart - to semi-verify inode found at i_location
- * 4/ parent->i_logstart - maybe used to hunt for the file on disc
+ * 2/ i_pos - if ino has changed, but still in cache (hi)
+ * 3/ i_pos - if ino has changed, but still in cache (low)
+ * 4/ i_logstart - to semi-verify inode found at i_location
+ * 5/ parent->i_logstart - maybe used to hunt for the file on disc
*
*/
struct dentry *fat_fh_to_dentry(struct super_block *sb, __u32 *fh,
@@ -435,7 +436,7 @@
if (fhtype != 3)
return ERR_PTR(-ESTALE);
- if (len < 5)
+ if (len < 6)
return ERR_PTR(-ESTALE);
/* We cannot find the parent,
It better just *be* there */
@@ -449,13 +450,15 @@
inode = NULL;
}
if (!inode) {
- /* try 2 - see if i_location is in F-d-c
+ loff_t i_pos = ((loff_t)fh[2] << 32) | fh[3];
+
+ /* try 2 - see if i_pos is in F-d-c
* require i_logstart to be the same
* Will fail if you truncate and then re-write
*/
- inode = fat_iget(sb, fh[2]);
- if (inode && MSDOS_I(inode)->i_logstart != fh[3]) {
+ inode = fat_iget(sb, i_pos);
+ if (inode && MSDOS_I(inode)->i_logstart != fh[4]) {
iput(inode);
inode = NULL;
}
@@ -514,14 +517,15 @@
int len = *lenp;
struct inode *inode = de->d_inode;
- if (len < 5)
+ if (len < 6)
return 255; /* no room */
- *lenp = 5;
+ *lenp = 6;
fh[0] = inode->i_ino;
fh[1] = inode->i_generation;
- fh[2] = MSDOS_I(inode)->i_location;
- fh[3] = MSDOS_I(inode)->i_logstart;
- fh[4] = MSDOS_I(de->d_parent->d_inode)->i_logstart;
+ fh[2] = (__u32)(MSDOS_I(inode)->i_pos >> 32);
+ fh[3] = (__u32)MSDOS_I(inode)->i_pos;
+ fh[4] = MSDOS_I(inode)->i_logstart;
+ fh[5] = MSDOS_I(de->d_parent->d_inode)->i_logstart;
return 3;
}
@@ -891,7 +895,7 @@
int nr;
INIT_LIST_HEAD(&MSDOS_I(inode)->i_fat_hash);
- MSDOS_I(inode)->i_location = 0;
+ MSDOS_I(inode)->i_pos = 0;
MSDOS_I(inode)->i_fat_inode = inode;
inode->i_uid = sbi->options.fs_uid;
inode->i_gid = sbi->options.fs_gid;
@@ -906,10 +910,9 @@
inode->i_fop = &fat_dir_operations;
MSDOS_I(inode)->i_start = CF_LE_W(de->start);
- if (sbi->fat_bits == 32) {
- MSDOS_I(inode)->i_start |=
- (CF_LE_W(de->starthi) << 16);
- }
+ if (sbi->fat_bits == 32)
+ MSDOS_I(inode)->i_start |= (CF_LE_W(de->starthi) << 16);
+
MSDOS_I(inode)->i_logstart = MSDOS_I(inode)->i_start;
inode->i_nlink = fat_subdirs(inode);
/* includes .., compensating for "self" */
@@ -937,10 +940,9 @@
? S_IRUGO|S_IWUGO : S_IRWXUGO)
& ~sbi->options.fs_umask) | S_IFREG;
MSDOS_I(inode)->i_start = CF_LE_W(de->start);
- if (sbi->fat_bits == 32) {
- MSDOS_I(inode)->i_start |=
- (CF_LE_W(de->starthi) << 16);
- }
+ if (sbi->fat_bits == 32)
+ MSDOS_I(inode)->i_start |= (CF_LE_W(de->starthi) << 16);
+
MSDOS_I(inode)->i_logstart = MSDOS_I(inode)->i_start;
inode->i_size = CF_LE_L(de->size);
inode->i_op = &fat_file_inode_operations;
@@ -970,22 +972,22 @@
struct super_block *sb = inode->i_sb;
struct buffer_head *bh;
struct msdos_dir_entry *raw_entry;
- unsigned int i_pos;
+ loff_t i_pos;
retry:
- i_pos = MSDOS_I(inode)->i_location;
+ i_pos = MSDOS_I(inode)->i_pos;
if (inode->i_ino == MSDOS_ROOT_INO || !i_pos) {
return;
}
lock_kernel();
if (!(bh = fat_bread(sb, i_pos >> MSDOS_SB(sb)->dir_per_block_bits))) {
- printk("dev = %s, ino = %d\n", kdevname(inode->i_dev), i_pos);
+ printk("dev = %s, i_pos = %llu\n", kdevname(inode->i_dev), i_pos);
fat_fs_panic(sb, "msdos_write_inode: unable to read i-node block");
unlock_kernel();
return;
}
spin_lock(&fat_inode_lock);
- if (i_pos != MSDOS_I(inode)->i_location) {
+ if (i_pos != MSDOS_I(inode)->i_pos) {
spin_unlock(&fat_inode_lock);
fat_brelse(sb, bh);
unlock_kernel();
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)