patch-2.4.13 linux/fs/udf/inode.c
Next file: linux/fs/udf/lowlevel.c
Previous file: linux/fs/udf/ialloc.c
Back to the patch index
Back to the overall index
- Lines: 246
- Date:
Fri Oct 12 13:48:42 2001
- Orig file:
v2.4.12/linux/fs/udf/inode.c
- Orig date:
Tue Jul 3 17:08:21 2001
diff -u --recursive --new-file v2.4.12/linux/fs/udf/inode.c linux/fs/udf/inode.c
@@ -37,10 +37,15 @@
#include <linux/locks.h>
#include <linux/mm.h>
#include <linux/smp_lock.h>
+#include <linux/module.h>
#include "udf_i.h"
#include "udf_sb.h"
+MODULE_AUTHOR("Ben Fennema");
+MODULE_DESCRIPTION("Universal Disk Format Filesystem");
+MODULE_LICENSE("GPL");
+
#define EXTENT_MERGE_SIZE 5
static mode_t udf_convert_permissions(struct FileEntry *);
@@ -236,7 +241,7 @@
}
/* alloc block, and copy data to it */
- *block = udf_new_block(inode,
+ *block = udf_new_block(inode->i_sb, inode,
UDF_I_LOCATION(inode).partitionReferenceNum,
UDF_I_LOCATION(inode).logicalBlockNum, err);
@@ -302,7 +307,6 @@
udf_add_aext(inode, &bloc, &extoffset, eloc, elen, &sbh, 0);
/* UniqueID stuff */
- inode->i_blocks = inode->i_sb->s_blocksize / 512;
mark_buffer_dirty(sbh);
udf_release_data(sbh);
mark_inode_dirty(inode);
@@ -402,14 +406,14 @@
Uint32 elen = 0;
lb_addr eloc, pbloc, cbloc, nbloc;
int c = 1;
- int lbcount = 0, b_off = 0, offset = 0;
- Uint32 newblocknum, newblock;
- char etype;
+ Uint64 lbcount = 0, b_off = 0;
+ Uint32 newblocknum, newblock, offset = 0;
+ Sint8 etype;
int goal = 0, pgoal = UDF_I_LOCATION(inode).logicalBlockNum;
char lastblock = 0;
pextoffset = cextoffset = nextoffset = udf_file_entry_alloc_offset(inode);
- b_off = block << inode->i_sb->s_blocksize_bits;
+ b_off = (Uint64)block << inode->i_sb->s_blocksize_bits;
pbloc = cbloc = nbloc = UDF_I_LOCATION(inode);
/* find the extent which contains the block we are looking for.
@@ -546,7 +550,7 @@
goal = UDF_I_LOCATION(inode).logicalBlockNum + 1;
}
- if (!(newblocknum = udf_new_block(inode,
+ if (!(newblocknum = udf_new_block(inode->i_sb, inode,
UDF_I_LOCATION(inode).partitionReferenceNum, goal, err)))
{
udf_release_data(pbh);
@@ -588,7 +592,7 @@
UDF_I_NEXT_ALLOC_GOAL(inode) = newblocknum;
inode->i_ctime = CURRENT_TIME;
UDF_I_UCTIME(inode) = CURRENT_UTIME;
- inode->i_blocks += inode->i_sb->s_blocksize / 512;
+
if (IS_SYNC(inode))
udf_sync_inode(inode);
else
@@ -622,8 +626,17 @@
if (offset)
{
- laarr[curr].extLength = type |
- (offset << inode->i_sb->s_blocksize_bits);
+ if ((type >> 30) == EXTENT_NOT_RECORDED_ALLOCATED)
+ {
+ udf_free_blocks(inode->i_sb, inode, laarr[curr].extLocation, 0, offset);
+ laarr[curr].extLength = (EXTENT_NOT_RECORDED_NOT_ALLOCATED << 30) |
+ (offset << inode->i_sb->s_blocksize_bits);
+ laarr[curr].extLocation.logicalBlockNum = 0;
+ laarr[curr].extLocation.partitionReferenceNum = 0;
+ }
+ else
+ laarr[curr].extLength = type |
+ (offset << inode->i_sb->s_blocksize_bits);
curr ++;
(*c) ++;
(*endnum) ++;
@@ -692,7 +705,7 @@
int next = laarr[start].extLocation.logicalBlockNum +
(((laarr[start].extLength & UDF_EXTENT_LENGTH_MASK) +
inode->i_sb->s_blocksize - 1) >> inode->i_sb->s_blocksize_bits);
- int numalloc = udf_prealloc_blocks(inode,
+ int numalloc = udf_prealloc_blocks(inode->i_sb, inode,
laarr[start].extLocation.partitionReferenceNum,
next, (UDF_DEFAULT_PREALLOC_BLOCKS > length ? length :
UDF_DEFAULT_PREALLOC_BLOCKS) - currlength);
@@ -825,9 +838,6 @@
int create, int * err)
{
struct buffer_head * bh = NULL;
- int prev_blocks;
-
- prev_blocks = inode->i_blocks;
bh = udf_getblk(inode, block, create, err);
if (!bh)
@@ -1602,7 +1612,7 @@
return inode;
}
-int udf_add_aext(struct inode *inode, lb_addr *bloc, int *extoffset,
+Sint8 udf_add_aext(struct inode *inode, lb_addr *bloc, int *extoffset,
lb_addr eloc, Uint32 elen, struct buffer_head **bh, int inc)
{
int adsize;
@@ -1637,7 +1647,7 @@
int err, loffset;
lb_addr obloc = *bloc;
- if (!(bloc->logicalBlockNum = udf_new_block(inode,
+ if (!(bloc->logicalBlockNum = udf_new_block(inode->i_sb, inode,
obloc.partitionReferenceNum, obloc.logicalBlockNum, &err)))
{
return -1;
@@ -1739,7 +1749,7 @@
return ret;
}
-int udf_write_aext(struct inode *inode, lb_addr bloc, int *extoffset,
+Sint8 udf_write_aext(struct inode *inode, lb_addr bloc, int *extoffset,
lb_addr eloc, Uint32 elen, struct buffer_head *bh, int inc)
{
int adsize;
@@ -1808,12 +1818,12 @@
return (elen >> 30);
}
-int udf_next_aext(struct inode *inode, lb_addr *bloc, int *extoffset,
+Sint8 udf_next_aext(struct inode *inode, lb_addr *bloc, int *extoffset,
lb_addr *eloc, Uint32 *elen, struct buffer_head **bh, int inc)
{
Uint16 tagIdent;
int pos, alen;
- Uint8 etype;
+ Sint8 etype;
if (!(*bh))
{
@@ -1932,11 +1942,11 @@
return -1;
}
-int udf_current_aext(struct inode *inode, lb_addr *bloc, int *extoffset,
+Sint8 udf_current_aext(struct inode *inode, lb_addr *bloc, int *extoffset,
lb_addr *eloc, Uint32 *elen, struct buffer_head **bh, int inc)
{
int pos, alen;
- Uint8 etype;
+ Sint8 etype;
if (!(*bh))
{
@@ -2013,12 +2023,12 @@
return -1;
}
-int udf_insert_aext(struct inode *inode, lb_addr bloc, int extoffset,
+Sint8 udf_insert_aext(struct inode *inode, lb_addr bloc, int extoffset,
lb_addr neloc, Uint32 nelen, struct buffer_head *bh)
{
lb_addr oeloc;
Uint32 oelen;
- int type;
+ Sint8 etype;
if (!bh)
{
@@ -2034,25 +2044,25 @@
else
atomic_inc(&bh->b_count);
- while ((type = udf_next_aext(inode, &bloc, &extoffset, &oeloc, &oelen, &bh, 0)) != -1)
+ while ((etype = udf_next_aext(inode, &bloc, &extoffset, &oeloc, &oelen, &bh, 0)) != -1)
{
udf_write_aext(inode, bloc, &extoffset, neloc, nelen, bh, 1);
neloc = oeloc;
- nelen = (type << 30) | oelen;
+ nelen = (etype << 30) | oelen;
}
udf_add_aext(inode, &bloc, &extoffset, neloc, nelen, &bh, 1);
udf_release_data(bh);
return (nelen >> 30);
}
-int udf_delete_aext(struct inode *inode, lb_addr nbloc, int nextoffset,
+Sint8 udf_delete_aext(struct inode *inode, lb_addr nbloc, int nextoffset,
lb_addr eloc, Uint32 elen, struct buffer_head *nbh)
{
struct buffer_head *obh;
lb_addr obloc;
int oextoffset, adsize;
- char type;
+ Sint8 etype;
struct AllocExtDesc *aed;
if (!(nbh))
@@ -2084,9 +2094,9 @@
if (udf_next_aext(inode, &nbloc, &nextoffset, &eloc, &elen, &nbh, 1) == -1)
return -1;
- while ((type = udf_next_aext(inode, &nbloc, &nextoffset, &eloc, &elen, &nbh, 1)) != -1)
+ while ((etype = udf_next_aext(inode, &nbloc, &nextoffset, &eloc, &elen, &nbh, 1)) != -1)
{
- udf_write_aext(inode, obloc, &oextoffset, eloc, (type << 30) | elen, obh, 1);
+ udf_write_aext(inode, obloc, &oextoffset, eloc, (etype << 30) | elen, obh, 1);
if (memcmp(&nbloc, &obloc, sizeof(lb_addr)))
{
obloc = nbloc;
@@ -2101,7 +2111,7 @@
if (memcmp(&nbloc, &obloc, sizeof(lb_addr)))
{
- udf_free_blocks(inode, nbloc, 0, 1);
+ udf_free_blocks(inode->i_sb, inode, nbloc, 0, 1);
udf_write_aext(inode, obloc, &oextoffset, eloc, elen, obh, 1);
udf_write_aext(inode, obloc, &oextoffset, eloc, elen, obh, 1);
if (!memcmp(&UDF_I_LOCATION(inode), &obloc, sizeof(lb_addr)))
@@ -2147,11 +2157,11 @@
return (elen >> 30);
}
-int inode_bmap(struct inode *inode, int block, lb_addr *bloc, Uint32 *extoffset,
+Sint8 inode_bmap(struct inode *inode, int block, lb_addr *bloc, Uint32 *extoffset,
lb_addr *eloc, Uint32 *elen, Uint32 *offset, struct buffer_head **bh)
{
- Uint64 lbcount = 0, bcount = block << inode->i_sb->s_blocksize_bits;
- char etype;
+ Uint64 lbcount = 0, bcount = (Uint64)block << inode->i_sb->s_blocksize_bits;
+ Sint8 etype;
if (block < 0)
{
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)