aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2011-12-23 08:44:14 -0500
committerDavid Woodhouse <David.Woodhouse@intel.com>2012-01-09 13:24:54 -0500
commit48d3610268cef9cea0704119a74a00d1bf82f536 (patch)
treed58742e663834edf61a58643c2d670b457fee2ea /fs
parentcdfe5ed0f271f1d5693fbd68809cc7e0e6c3af66 (diff)
logfs: rename functions starting with mtd_
We are going to re-work the MTD interface and change 'mtd->write()' to 'mtd_write()', 'mtd->read()' to 'mtd_read()' and so forth for all functions in the 'struct mtd_info' structure. However, logfs has its own 'mtd_read()', 'mtd_write()', etc functions which collide with our changes. This patch renames these logfs functions to 'logfs_mtd_read()', 'logfs_mtd_write()', etc. Additionally, to make the 'fs/logfs/dev_mtd.c' file look consistent, rename similarly all the other functions starting with 'mtd_'. Cc: Jörn Engel <joern@logfs.org> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/logfs/dev_mtd.c61
1 files changed, 32 insertions, 29 deletions
diff --git a/fs/logfs/dev_mtd.c b/fs/logfs/dev_mtd.c
index 339e17e9133d..eb423ebcf538 100644
--- a/fs/logfs/dev_mtd.c
+++ b/fs/logfs/dev_mtd.c
@@ -13,7 +13,8 @@
13 13
14#define PAGE_OFS(ofs) ((ofs) & (PAGE_SIZE-1)) 14#define PAGE_OFS(ofs) ((ofs) & (PAGE_SIZE-1))
15 15
16static int mtd_read(struct super_block *sb, loff_t ofs, size_t len, void *buf) 16static int logfs_mtd_read(struct super_block *sb, loff_t ofs, size_t len,
17 void *buf)
17{ 18{
18 struct mtd_info *mtd = logfs_super(sb)->s_mtd; 19 struct mtd_info *mtd = logfs_super(sb)->s_mtd;
19 size_t retlen; 20 size_t retlen;
@@ -31,7 +32,8 @@ static int mtd_read(struct super_block *sb, loff_t ofs, size_t len, void *buf)
31 return 0; 32 return 0;
32} 33}
33 34
34static int mtd_write(struct super_block *sb, loff_t ofs, size_t len, void *buf) 35static int loffs_mtd_write(struct super_block *sb, loff_t ofs, size_t len,
36 void *buf)
35{ 37{
36 struct logfs_super *super = logfs_super(sb); 38 struct logfs_super *super = logfs_super(sb);
37 struct mtd_info *mtd = super->s_mtd; 39 struct mtd_info *mtd = super->s_mtd;
@@ -60,14 +62,15 @@ static int mtd_write(struct super_block *sb, loff_t ofs, size_t len, void *buf)
60 * asynchronous properties. So just to prevent the first implementor of such 62 * asynchronous properties. So just to prevent the first implementor of such
61 * a thing from breaking logfs in 2350, we do the usual pointless dance to 63 * a thing from breaking logfs in 2350, we do the usual pointless dance to
62 * declare a completion variable and wait for completion before returning 64 * declare a completion variable and wait for completion before returning
63 * from mtd_erase(). What an exercise in futility! 65 * from logfs_mtd_erase(). What an exercise in futility!
64 */ 66 */
65static void logfs_erase_callback(struct erase_info *ei) 67static void logfs_erase_callback(struct erase_info *ei)
66{ 68{
67 complete((struct completion *)ei->priv); 69 complete((struct completion *)ei->priv);
68} 70}
69 71
70static int mtd_erase_mapping(struct super_block *sb, loff_t ofs, size_t len) 72static int logfs_mtd_erase_mapping(struct super_block *sb, loff_t ofs,
73 size_t len)
71{ 74{
72 struct logfs_super *super = logfs_super(sb); 75 struct logfs_super *super = logfs_super(sb);
73 struct address_space *mapping = super->s_mapping_inode->i_mapping; 76 struct address_space *mapping = super->s_mapping_inode->i_mapping;
@@ -84,7 +87,7 @@ static int mtd_erase_mapping(struct super_block *sb, loff_t ofs, size_t len)
84 return 0; 87 return 0;
85} 88}
86 89
87static int mtd_erase(struct super_block *sb, loff_t ofs, size_t len, 90static int logfs_mtd_erase(struct super_block *sb, loff_t ofs, size_t len,
88 int ensure_write) 91 int ensure_write)
89{ 92{
90 struct mtd_info *mtd = logfs_super(sb)->s_mtd; 93 struct mtd_info *mtd = logfs_super(sb)->s_mtd;
@@ -109,10 +112,10 @@ static int mtd_erase(struct super_block *sb, loff_t ofs, size_t len,
109 wait_for_completion(&complete); 112 wait_for_completion(&complete);
110 if (ei.state != MTD_ERASE_DONE) 113 if (ei.state != MTD_ERASE_DONE)
111 return -EIO; 114 return -EIO;
112 return mtd_erase_mapping(sb, ofs, len); 115 return logfs_mtd_erase_mapping(sb, ofs, len);
113} 116}
114 117
115static void mtd_sync(struct super_block *sb) 118static void logfs_mtd_sync(struct super_block *sb)
116{ 119{
117 struct mtd_info *mtd = logfs_super(sb)->s_mtd; 120 struct mtd_info *mtd = logfs_super(sb)->s_mtd;
118 121
@@ -120,12 +123,12 @@ static void mtd_sync(struct super_block *sb)
120 mtd->sync(mtd); 123 mtd->sync(mtd);
121} 124}
122 125
123static int mtd_readpage(void *_sb, struct page *page) 126static int logfs_mtd_readpage(void *_sb, struct page *page)
124{ 127{
125 struct super_block *sb = _sb; 128 struct super_block *sb = _sb;
126 int err; 129 int err;
127 130
128 err = mtd_read(sb, page->index << PAGE_SHIFT, PAGE_SIZE, 131 err = logfs_mtd_read(sb, page->index << PAGE_SHIFT, PAGE_SIZE,
129 page_address(page)); 132 page_address(page));
130 if (err == -EUCLEAN || err == -EBADMSG) { 133 if (err == -EUCLEAN || err == -EBADMSG) {
131 /* -EBADMSG happens regularly on power failures */ 134 /* -EBADMSG happens regularly on power failures */
@@ -143,11 +146,11 @@ static int mtd_readpage(void *_sb, struct page *page)
143 return err; 146 return err;
144} 147}
145 148
146static struct page *mtd_find_first_sb(struct super_block *sb, u64 *ofs) 149static struct page *logfs_mtd_find_first_sb(struct super_block *sb, u64 *ofs)
147{ 150{
148 struct logfs_super *super = logfs_super(sb); 151 struct logfs_super *super = logfs_super(sb);
149 struct address_space *mapping = super->s_mapping_inode->i_mapping; 152 struct address_space *mapping = super->s_mapping_inode->i_mapping;
150 filler_t *filler = mtd_readpage; 153 filler_t *filler = logfs_mtd_readpage;
151 struct mtd_info *mtd = super->s_mtd; 154 struct mtd_info *mtd = super->s_mtd;
152 155
153 if (!mtd->block_isbad) 156 if (!mtd->block_isbad)
@@ -163,11 +166,11 @@ static struct page *mtd_find_first_sb(struct super_block *sb, u64 *ofs)
163 return read_cache_page(mapping, *ofs >> PAGE_SHIFT, filler, sb); 166 return read_cache_page(mapping, *ofs >> PAGE_SHIFT, filler, sb);
164} 167}
165 168
166static struct page *mtd_find_last_sb(struct super_block *sb, u64 *ofs) 169static struct page *logfs_mtd_find_last_sb(struct super_block *sb, u64 *ofs)
167{ 170{
168 struct logfs_super *super = logfs_super(sb); 171 struct logfs_super *super = logfs_super(sb);
169 struct address_space *mapping = super->s_mapping_inode->i_mapping; 172 struct address_space *mapping = super->s_mapping_inode->i_mapping;
170 filler_t *filler = mtd_readpage; 173 filler_t *filler = logfs_mtd_readpage;
171 struct mtd_info *mtd = super->s_mtd; 174 struct mtd_info *mtd = super->s_mtd;
172 175
173 if (!mtd->block_isbad) 176 if (!mtd->block_isbad)
@@ -184,7 +187,7 @@ static struct page *mtd_find_last_sb(struct super_block *sb, u64 *ofs)
184 return read_cache_page(mapping, *ofs >> PAGE_SHIFT, filler, sb); 187 return read_cache_page(mapping, *ofs >> PAGE_SHIFT, filler, sb);
185} 188}
186 189
187static int __mtd_writeseg(struct super_block *sb, u64 ofs, pgoff_t index, 190static int __logfs_mtd_writeseg(struct super_block *sb, u64 ofs, pgoff_t index,
188 size_t nr_pages) 191 size_t nr_pages)
189{ 192{
190 struct logfs_super *super = logfs_super(sb); 193 struct logfs_super *super = logfs_super(sb);
@@ -196,8 +199,8 @@ static int __mtd_writeseg(struct super_block *sb, u64 ofs, pgoff_t index,
196 page = find_lock_page(mapping, index + i); 199 page = find_lock_page(mapping, index + i);
197 BUG_ON(!page); 200 BUG_ON(!page);
198 201
199 err = mtd_write(sb, page->index << PAGE_SHIFT, PAGE_SIZE, 202 err = loffs_mtd_write(sb, page->index << PAGE_SHIFT, PAGE_SIZE,
200 page_address(page)); 203 page_address(page));
201 unlock_page(page); 204 unlock_page(page);
202 page_cache_release(page); 205 page_cache_release(page);
203 if (err) 206 if (err)
@@ -206,7 +209,7 @@ static int __mtd_writeseg(struct super_block *sb, u64 ofs, pgoff_t index,
206 return 0; 209 return 0;
207} 210}
208 211
209static void mtd_writeseg(struct super_block *sb, u64 ofs, size_t len) 212static void logfs_mtd_writeseg(struct super_block *sb, u64 ofs, size_t len)
210{ 213{
211 struct logfs_super *super = logfs_super(sb); 214 struct logfs_super *super = logfs_super(sb);
212 int head; 215 int head;
@@ -227,15 +230,15 @@ static void mtd_writeseg(struct super_block *sb, u64 ofs, size_t len)
227 len += head; 230 len += head;
228 } 231 }
229 len = PAGE_ALIGN(len); 232 len = PAGE_ALIGN(len);
230 __mtd_writeseg(sb, ofs, ofs >> PAGE_SHIFT, len >> PAGE_SHIFT); 233 __logfs_mtd_writeseg(sb, ofs, ofs >> PAGE_SHIFT, len >> PAGE_SHIFT);
231} 234}
232 235
233static void mtd_put_device(struct logfs_super *s) 236static void logfs_mtd_put_device(struct logfs_super *s)
234{ 237{
235 put_mtd_device(s->s_mtd); 238 put_mtd_device(s->s_mtd);
236} 239}
237 240
238static int mtd_can_write_buf(struct super_block *sb, u64 ofs) 241static int logfs_mtd_can_write_buf(struct super_block *sb, u64 ofs)
239{ 242{
240 struct logfs_super *super = logfs_super(sb); 243 struct logfs_super *super = logfs_super(sb);
241 void *buf; 244 void *buf;
@@ -244,7 +247,7 @@ static int mtd_can_write_buf(struct super_block *sb, u64 ofs)
244 buf = kmalloc(super->s_writesize, GFP_KERNEL); 247 buf = kmalloc(super->s_writesize, GFP_KERNEL);
245 if (!buf) 248 if (!buf)
246 return -ENOMEM; 249 return -ENOMEM;
247 err = mtd_read(sb, ofs, super->s_writesize, buf); 250 err = logfs_mtd_read(sb, ofs, super->s_writesize, buf);
248 if (err) 251 if (err)
249 goto out; 252 goto out;
250 if (memchr_inv(buf, 0xff, super->s_writesize)) 253 if (memchr_inv(buf, 0xff, super->s_writesize))
@@ -255,14 +258,14 @@ out:
255} 258}
256 259
257static const struct logfs_device_ops mtd_devops = { 260static const struct logfs_device_ops mtd_devops = {
258 .find_first_sb = mtd_find_first_sb, 261 .find_first_sb = logfs_mtd_find_first_sb,
259 .find_last_sb = mtd_find_last_sb, 262 .find_last_sb = logfs_mtd_find_last_sb,
260 .readpage = mtd_readpage, 263 .readpage = logfs_mtd_readpage,
261 .writeseg = mtd_writeseg, 264 .writeseg = logfs_mtd_writeseg,
262 .erase = mtd_erase, 265 .erase = logfs_mtd_erase,
263 .can_write_buf = mtd_can_write_buf, 266 .can_write_buf = logfs_mtd_can_write_buf,
264 .sync = mtd_sync, 267 .sync = logfs_mtd_sync,
265 .put_device = mtd_put_device, 268 .put_device = logfs_mtd_put_device,
266}; 269};
267 270
268int logfs_get_sb_mtd(struct logfs_super *s, int mtdnr) 271int logfs_get_sb_mtd(struct logfs_super *s, int mtdnr)