📄 1011.udf.patch
字号:
DQUOT_FREE_INODE(inode);+#else+ DQUOT_INIT(inode);+ DQUOT_FREE_INODE(sb, inode);+#endif DQUOT_DROP(inode); lock_super(sb);@@ -69,7 +75,11 @@ udf_free_blocks(sb, NULL, UDF_I_LOCATION(inode), 0, 1); } +#ifndef OLD_QUOTA struct inode * udf_new_inode (struct inode *dir, int mode, int * err)+#else+struct inode * udf_new_inode (const struct inode *dir, int mode, int * err)+#endif { struct super_block *sb; struct inode * inode;@@ -95,6 +105,11 @@ } lock_super(sb); + UDF_I_UNIQUE(inode) = 0;+ UDF_I_LENEXTENTS(inode) = 0;+ UDF_I_NEXT_ALLOC_BLOCK(inode) = 0;+ UDF_I_NEXT_ALLOC_GOAL(inode) = 0;+ UDF_I_STRAT4096(inode) = 0; if (UDF_SB_LVIDBH(sb)) { struct logicalVolHeaderDesc *lvhd;@@ -130,13 +145,20 @@ inode->i_blocks = 0; UDF_I_LENEATTR(inode) = 0; UDF_I_LENALLOC(inode) = 0;+ UDF_I_USE(inode) = 0; if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_EXTENDED_FE)) {- UDF_I_EXTENDED_FE(inode) = 1;+ UDF_I_EFE(inode) = 1; UDF_UPDATE_UDFREV(inode->i_sb, UDF_VERS_USE_EXTENDED_FE);+ UDF_I_DATA(inode) = kmalloc(inode->i_sb->s_blocksize - sizeof(struct extendedFileEntry), GFP_KERNEL);+ memset(UDF_I_DATA(inode), 0x00, inode->i_sb->s_blocksize - sizeof(struct extendedFileEntry)); } else- UDF_I_EXTENDED_FE(inode) = 0;+ {+ UDF_I_EFE(inode) = 0;+ UDF_I_DATA(inode) = kmalloc(inode->i_sb->s_blocksize - sizeof(struct fileEntry), GFP_KERNEL);+ memset(UDF_I_DATA(inode), 0x00, inode->i_sb->s_blocksize - sizeof(struct fileEntry));+ } if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_AD_IN_ICB)) UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_IN_ICB; else if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD))@@ -147,15 +169,20 @@ UDF_I_CRTIME(inode) = CURRENT_TIME; UDF_I_UMTIME(inode) = UDF_I_UCTIME(inode) = UDF_I_UCRTIME(inode) = CURRENT_UTIME;- UDF_I_NEW_INODE(inode) = 1; insert_inode_hash(inode); mark_inode_dirty(inode); unlock_super(sb);+#ifndef OLD_QUOTA if (DQUOT_ALLOC_INODE(inode))+#else+ if (DQUOT_ALLOC_INODE(sb, inode))+#endif { DQUOT_DROP(inode);+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,10) inode->i_flags |= S_NOQUOTA;+#endif inode->i_nlink = 0; iput(inode); *err = -EDQUOT;diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/fs/udf/inode.c linuxmips-2.4.30/fs/udf/inode.c--- linuxmips-2.4.30.ref/fs/udf/inode.c 2002-06-26 15:36:22.000000000 -0700+++ linuxmips-2.4.30/fs/udf/inode.c 2007-05-10 10:49:29.000000000 -0700@@ -16,7 +16,7 @@ * Each contributing author retains all rights to their own work. * * (C) 1998 Dave Boynton- * (C) 1998-2001 Ben Fennema+ * (C) 1998-2003 Ben Fennema * (C) 1999-2000 Stelias Computing Inc * * HISTORY@@ -38,13 +38,17 @@ #include <linux/mm.h> #include <linux/smp_lock.h> #include <linux/module.h>+#include <linux/pagemap.h>+#include <linux/slab.h> #include "udf_i.h" #include "udf_sb.h" MODULE_AUTHOR("Ben Fennema"); MODULE_DESCRIPTION("Universal Disk Format Filesystem");+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,10) MODULE_LICENSE("GPL");+#endif #define EXTENT_MERGE_SIZE 5 @@ -105,30 +109,26 @@ */ void udf_delete_inode(struct inode * inode) {- lock_kernel();- if (is_bad_inode(inode)) goto no_delete; inode->i_size = 0; udf_truncate(inode);+ lock_kernel();+ udf_update_inode(inode, IS_SYNC(inode)); udf_free_inode(inode); unlock_kernel(); return; no_delete:- unlock_kernel(); clear_inode(inode); } -void udf_discard_prealloc(struct inode * inode)+void udf_clear_inode(struct inode *inode) {- if (inode->i_size && inode->i_size != UDF_I_LENEXTENTS(inode) &&- UDF_I_ALLOCTYPE(inode) != ICBTAG_FLAG_AD_IN_ICB)- {- udf_truncate_extents(inode);- }+ kfree(UDF_I_DATA(inode));+ UDF_I_DATA(inode) = NULL; } static int udf_writepage(struct page *page)@@ -152,20 +152,18 @@ } struct address_space_operations udf_aops = {- readpage: udf_readpage,- writepage: udf_writepage,- sync_page: block_sync_page,- prepare_write: udf_prepare_write,- commit_write: generic_commit_write,- bmap: udf_bmap,+ .readpage = udf_readpage,+ .writepage = udf_writepage,+ .sync_page = block_sync_page,+ .prepare_write = udf_prepare_write,+ .commit_write = generic_commit_write,+ .bmap = udf_bmap, }; void udf_expand_file_adinicb(struct inode * inode, int newsize, int * err) {- struct buffer_head *bh = NULL; struct page *page; char *kaddr;- int block; /* from now on we have normal address_space methods */ inode->i_data.a_ops = &udf_aops;@@ -180,10 +178,6 @@ return; } - block = udf_get_lb_pblock(inode->i_sb, UDF_I_LOCATION(inode), 0);- bh = udf_tread(inode->i_sb, block);- if (!bh)- return; page = grab_cache_page(inode->i_mapping, 0); if (!PageLocked(page)) PAGE_BUG(page);@@ -192,21 +186,19 @@ kaddr = kmap(page); memset(kaddr + UDF_I_LENALLOC(inode), 0x00, PAGE_CACHE_SIZE - UDF_I_LENALLOC(inode));- memcpy(kaddr, bh->b_data + udf_file_entry_alloc_offset(inode),+ memcpy(kaddr, UDF_I_DATA(inode) + UDF_I_LENEATTR(inode), UDF_I_LENALLOC(inode)); flush_dcache_page(page); SetPageUptodate(page); kunmap(page); }- memset(bh->b_data + udf_file_entry_alloc_offset(inode),- 0, UDF_I_LENALLOC(inode));+ memset(UDF_I_DATA(inode) + UDF_I_LENEATTR(inode), 0x00,+ UDF_I_LENALLOC(inode)); UDF_I_LENALLOC(inode) = 0; if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD)) UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_SHORT; else UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_LONG;- mark_buffer_dirty_inode(bh, inode);- udf_release_data(bh); inode->i_data.a_ops->writepage(page); page_cache_release(page);@@ -221,18 +213,21 @@ struct buffer_head *sbh = NULL, *dbh = NULL; lb_addr bloc, eloc; uint32_t elen, extoffset;+ uint8_t alloctype; struct udf_fileident_bh sfibh, dfibh; loff_t f_pos = udf_ext0_offset(inode) >> 2; int size = (udf_ext0_offset(inode) + inode->i_size) >> 2; struct fileIdentDesc cfi, *sfi, *dfi; + if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD))+ alloctype = ICBTAG_FLAG_AD_SHORT;+ else+ alloctype = ICBTAG_FLAG_AD_LONG;+ if (!inode->i_size) {- if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD))- UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_SHORT;- else- UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_LONG;+ UDF_I_ALLOCTYPE(inode) = alloctype; mark_inode_dirty(inode); return NULL; }@@ -248,9 +243,6 @@ UDF_I_LOCATION(inode).partitionReferenceNum, 0); if (!newblock) return NULL;- sbh = udf_tread(inode->i_sb, inode->i_ino);- if (!sbh)- return NULL; dbh = udf_tgetblk(inode->i_sb, newblock); if (!dbh) return NULL;@@ -261,18 +253,19 @@ mark_buffer_dirty_inode(dbh, inode); sfibh.soffset = sfibh.eoffset = (f_pos & ((inode->i_sb->s_blocksize - 1) >> 2)) << 2;- sfibh.sbh = sfibh.ebh = sbh;+ sbh = sfibh.sbh = sfibh.ebh = NULL; dfibh.soffset = dfibh.eoffset = 0; dfibh.sbh = dfibh.ebh = dbh; while ( (f_pos < size) ) {+ UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_IN_ICB; sfi = udf_fileident_read(inode, &f_pos, &sfibh, &cfi, NULL, NULL, NULL, NULL, NULL, NULL); if (!sfi) {- udf_release_data(sbh); udf_release_data(dbh); return NULL; }+ UDF_I_ALLOCTYPE(inode) = alloctype; sfi->descTag.tagLocation = *block; dfibh.soffset = dfibh.eoffset; dfibh.eoffset += (sfibh.eoffset - sfibh.soffset);@@ -280,21 +273,15 @@ if (udf_write_fi(inode, sfi, dfi, &dfibh, sfi->impUse, sfi->fileIdent + sfi->lengthOfImpUse)) {- udf_release_data(sbh);+ UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_IN_ICB; udf_release_data(dbh); return NULL; } } mark_buffer_dirty_inode(dbh, inode); - memset(sbh->b_data + udf_file_entry_alloc_offset(inode),- 0, UDF_I_LENALLOC(inode));-+ memset(UDF_I_DATA(inode) + UDF_I_LENEATTR(inode), 0, UDF_I_LENALLOC(inode)); UDF_I_LENALLOC(inode) = 0;- if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD))- UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_SHORT;- else- UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_LONG; bloc = UDF_I_LOCATION(inode); eloc.logicalBlockNum = *block; eloc.partitionReferenceNum = UDF_I_LOCATION(inode).partitionReferenceNum;@@ -304,7 +291,9 @@ udf_add_aext(inode, &bloc, &extoffset, eloc, elen, &sbh, 0); /* UniqueID stuff */ - mark_buffer_dirty(sbh);+#ifdef OLD_QUOTA+ inode->i_blocks = inode->i_sb->s_blocksize / 512;+#endif udf_release_data(sbh); mark_inode_dirty(inode); inode->i_version ++;@@ -526,11 +515,8 @@ else lastblock = 1; }+ udf_release_data(cbh); udf_release_data(nbh);- if (!pbh)- pbh = cbh;- else- udf_release_data(cbh); /* if the current extent is not recorded but allocated, get the block in the extent corresponding to the requested block */@@ -589,6 +575,9 @@ UDF_I_NEXT_ALLOC_GOAL(inode) = newblocknum; inode->i_ctime = CURRENT_TIME; UDF_I_UCTIME(inode) = CURRENT_UTIME;+#ifdef OLD_QUOTA+ inode->i_blocks += inode->i_sb->s_blocksize / 512;+#endif if (IS_SYNC(inode)) udf_sync_inode(inode);@@ -606,7 +595,7 @@ int curr = *c; int blen = ((laarr[curr].extLength & UDF_EXTENT_LENGTH_MASK) + inode->i_sb->s_blocksize - 1) >> inode->i_sb->s_blocksize_bits;- int type = laarr[curr].extLength & ~UDF_EXTENT_LENGTH_MASK;+ int8_t etype = (laarr[curr].extLength >> 30); if (blen == 1) ;@@ -623,7 +612,7 @@ if (offset) {- if ((type >> 30) == (EXT_NOT_RECORDED_ALLOCATED >> 30))+ if (etype == (EXT_NOT_RECORDED_ALLOCATED >> 30)) { udf_free_blocks(inode->i_sb, inode, laarr[curr].extLocation, 0, offset); laarr[curr].extLength = EXT_NOT_RECORDED_NOT_ALLOCATED |@@ -632,7 +621,7 @@ laarr[curr].extLocation.partitionReferenceNum = 0; } else- laarr[curr].extLength = type |+ laarr[curr].extLength = (etype << 30) | (offset << inode->i_sb->s_blocksize_bits); curr ++; (*c) ++;@@ -640,7 +629,7 @@ } laarr[curr].extLocation.logicalBlockNum = newblocknum;- if ((type >> 30) == (EXT_NOT_RECORDED_NOT_ALLOCATED >> 30))+ if (etype == (EXT_NOT_RECORDED_NOT_ALLOCATED >> 30)) laarr[curr].extLocation.partitionReferenceNum = UDF_I_LOCATION(inode).partitionReferenceNum; laarr[curr].extLength = EXT_RECORDED_ALLOCATED |@@ -649,9 +638,9 @@ if (blen != offset + 1) {- if ((type >> 30) == (EXT_NOT_RECORDED_ALLOCATED >> 30))+ if (etype == (EXT_NOT_RECORDED_ALLOCATED >> 30)) laarr[curr].extLocation.logicalBlockNum += (offset + 1);- laarr[curr].extLength = type |+ laarr[curr].extLength = (etype << 30) | ((blen - (offset + 1)) << inode->i_sb->s_blocksize_bits); curr ++; (*endnum) ++;@@ -732,7 +721,7 @@ if (elen > numalloc) {- laarr[c].extLength -=+ laarr[i].extLength -= (numalloc << inode->i_sb->s_blocksize_bits); numalloc = 0; }@@ -772,8 +761,8 @@ laarr[i+1].extLength = (laarr[i+1].extLength - (laarr[i].extLength & UDF_EXTENT_LENGTH_MASK) + UDF_EXTENT_LENGTH_MASK) & ~(inode->i_sb->s_blocksize-1);- laarr[i].extLength = (UDF_EXTENT_LENGTH_MASK + 1) -- inode->i_sb->s_blocksize;+ laarr[i].extLength = (laarr[i].extLength & UDF_EXTENT_FLAG_MASK) ++ (UDF_EXTENT_LENGTH_MASK + 1) - inode->i_sb->s_blocksize; laarr[i+1].extLocation.logicalBlockNum = laarr[i].extLocation.logicalBlockNum + ((laarr[i].extLength & UDF_EXTENT_LENGTH_MASK) >>@@ -792,6 +781,47 @@ } } }+ else if (((laarr[i].extLength >> 30) == (EXT_NOT_RECORDED_ALLOCATED >> 30)) &&+ ((laarr[i+1].extLength >> 30) == (EXT_NOT_RECORDED_NOT_ALLOCATED >> 30)))+ {+ udf_free_blocks(inode->i_sb, inode, laarr[i].extLocation, 0,+ ((laarr[i].extLength & UDF_EXTENT_LENGTH_MASK) ++ inode->i_sb->s_blocksize - 1) >> inode->i_sb->s_blocksize_bits);+ laarr[i].extLocation.logicalBlockNum = 0;+ laarr[i].extLocation.partitionReferenceNum = 0;++ if (((laarr[i].extLength & UDF_EXTENT_LENGTH_MASK) ++ (laarr[i+1].extLength & UDF_EXTENT_LENGTH_MASK) ++ inode->i_sb->s_blocksize - 1) & ~UDF_EXTENT_LENGTH_MASK)+ {+ laarr[i+1].extLength = (laarr[i+1].extLength -+ (laarr[i].extLength & UDF_EXTENT_LENGTH_MASK) ++ UDF_EXTENT_LENGTH_MASK) & ~(inode->i_sb->s_blocksize-1);+ laarr[i].extLength = (laarr[i].extLength & UDF_EXTENT_FLAG_MASK) ++ (UDF_EXTENT_LENGTH_MASK + 1) - inode->i_sb->s_blocksize;+ }+ else+ {+ laarr[i].extLength = laarr[i+1].extLength ++ (((laarr[i].extLength & UDF_EXTENT_LENGTH_MASK) ++ inode->i_sb->s_blocksize - 1) & ~(inode->i_sb->s_blocksize-1));+ if (*endnum > (i+2))+ memmove(&laarr[i+1], &laarr[i+2],+ sizeof(long_ad) * (*endnum - (i+2)));+ i --;+ (*endnum) --;+ }+ }+ else if ((laarr[i].extLength >> 30) == (EXT_NOT_RECORDED_ALLOCATED >> 30))+ {+ udf_free_blocks(inode->i_sb, inode, laarr[i].extLocation, 0,+ ((laarr[i].extLength & UDF_EXTENT_LENGTH_MASK) ++ inode->i_sb->s_blocksize - 1) >> inode->i_sb->s_blocksize_bits);+ laarr[i].extLocation.logicalBlockNum = 0;+ laarr[i].extLocation.partitionReferenceNum = 0;+ laarr[i].extLength = (laarr[i].extLength & UDF_EXTENT_LENGTH_MASK) |
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -