aboutsummaryrefslogtreecommitdiffstats
path: root/fs/udf/file.c
diff options
context:
space:
mode:
authorMarcin Slusarz <marcin.slusarz@gmail.com>2008-02-08 07:20:44 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-08 12:22:35 -0500
commit48d6d8ff7dca804536298e517298182c4a51c421 (patch)
tree8566ae59bdd01fb3568b6441b909d035dba7b61b /fs/udf/file.c
parentc0b344385fa05f6bea462e707fcba89f9e2776c2 (diff)
udf: cache struct udf_inode_info
cache UDF_I(struct inode *) return values when there are at least 2 uses in one function Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Acked-by: Jan Kara <jack@suse.cz> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/udf/file.c')
-rw-r--r--fs/udf/file.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/fs/udf/file.c b/fs/udf/file.c
index a1e07a131623..97c71ae7c689 100644
--- a/fs/udf/file.c
+++ b/fs/udf/file.c
@@ -45,13 +45,13 @@ static int udf_adinicb_readpage(struct file *file, struct page *page)
45{ 45{
46 struct inode *inode = page->mapping->host; 46 struct inode *inode = page->mapping->host;
47 char *kaddr; 47 char *kaddr;
48 struct udf_inode_info *iinfo = UDF_I(inode);
48 49
49 BUG_ON(!PageLocked(page)); 50 BUG_ON(!PageLocked(page));
50 51
51 kaddr = kmap(page); 52 kaddr = kmap(page);
52 memset(kaddr, 0, PAGE_CACHE_SIZE); 53 memset(kaddr, 0, PAGE_CACHE_SIZE);
53 memcpy(kaddr, UDF_I(inode)->i_ext.i_data + UDF_I(inode)->i_lenEAttr, 54 memcpy(kaddr, iinfo->i_ext.i_data + iinfo->i_lenEAttr, inode->i_size);
54 inode->i_size);
55 flush_dcache_page(page); 55 flush_dcache_page(page);
56 SetPageUptodate(page); 56 SetPageUptodate(page);
57 kunmap(page); 57 kunmap(page);
@@ -65,12 +65,12 @@ static int udf_adinicb_writepage(struct page *page,
65{ 65{
66 struct inode *inode = page->mapping->host; 66 struct inode *inode = page->mapping->host;
67 char *kaddr; 67 char *kaddr;
68 struct udf_inode_info *iinfo = UDF_I(inode);
68 69
69 BUG_ON(!PageLocked(page)); 70 BUG_ON(!PageLocked(page));
70 71
71 kaddr = kmap(page); 72 kaddr = kmap(page);
72 memcpy(UDF_I(inode)->i_ext.i_data + UDF_I(inode)->i_lenEAttr, kaddr, 73 memcpy(iinfo->i_ext.i_data + iinfo->i_lenEAttr, kaddr, inode->i_size);
73 inode->i_size);
74 mark_inode_dirty(inode); 74 mark_inode_dirty(inode);
75 SetPageUptodate(page); 75 SetPageUptodate(page);
76 kunmap(page); 76 kunmap(page);
@@ -87,9 +87,10 @@ static int udf_adinicb_write_end(struct file *file,
87 struct inode *inode = mapping->host; 87 struct inode *inode = mapping->host;
88 unsigned offset = pos & (PAGE_CACHE_SIZE - 1); 88 unsigned offset = pos & (PAGE_CACHE_SIZE - 1);
89 char *kaddr; 89 char *kaddr;
90 struct udf_inode_info *iinfo = UDF_I(inode);
90 91
91 kaddr = kmap_atomic(page, KM_USER0); 92 kaddr = kmap_atomic(page, KM_USER0);
92 memcpy(UDF_I(inode)->i_ext.i_data + UDF_I(inode)->i_lenEAttr + offset, 93 memcpy(iinfo->i_ext.i_data + iinfo->i_lenEAttr + offset,
93 kaddr + offset, copied); 94 kaddr + offset, copied);
94 kunmap_atomic(kaddr, KM_USER0); 95 kunmap_atomic(kaddr, KM_USER0);
95 96
@@ -112,8 +113,9 @@ static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
112 struct inode *inode = file->f_path.dentry->d_inode; 113 struct inode *inode = file->f_path.dentry->d_inode;
113 int err, pos; 114 int err, pos;
114 size_t count = iocb->ki_left; 115 size_t count = iocb->ki_left;
116 struct udf_inode_info *iinfo = UDF_I(inode);
115 117
116 if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { 118 if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) {
117 if (file->f_flags & O_APPEND) 119 if (file->f_flags & O_APPEND)
118 pos = inode->i_size; 120 pos = inode->i_size;
119 else 121 else
@@ -123,16 +125,15 @@ static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
123 (udf_file_entry_alloc_offset(inode) + 125 (udf_file_entry_alloc_offset(inode) +
124 pos + count)) { 126 pos + count)) {
125 udf_expand_file_adinicb(inode, pos + count, &err); 127 udf_expand_file_adinicb(inode, pos + count, &err);
126 if (UDF_I(inode)->i_alloc_type == 128 if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) {
127 ICBTAG_FLAG_AD_IN_ICB) {
128 udf_debug("udf_expand_adinicb: err=%d\n", err); 129 udf_debug("udf_expand_adinicb: err=%d\n", err);
129 return err; 130 return err;
130 } 131 }
131 } else { 132 } else {
132 if (pos + count > inode->i_size) 133 if (pos + count > inode->i_size)
133 UDF_I(inode)->i_lenAlloc = pos + count; 134 iinfo->i_lenAlloc = pos + count;
134 else 135 else
135 UDF_I(inode)->i_lenAlloc = inode->i_size; 136 iinfo->i_lenAlloc = inode->i_size;
136 } 137 }
137 } 138 }
138 139