diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
commit | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch) | |
tree | a8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /fs/omfs | |
parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) |
Patched in Tegra support.
Diffstat (limited to 'fs/omfs')
-rw-r--r-- | fs/omfs/dir.c | 10 | ||||
-rw-r--r-- | fs/omfs/file.c | 27 | ||||
-rw-r--r-- | fs/omfs/inode.c | 18 | ||||
-rw-r--r-- | fs/omfs/omfs.h | 6 |
4 files changed, 26 insertions, 35 deletions
diff --git a/fs/omfs/dir.c b/fs/omfs/dir.c index fb5b3ff79dc..98e54427439 100644 --- a/fs/omfs/dir.c +++ b/fs/omfs/dir.c | |||
@@ -255,7 +255,7 @@ static int omfs_remove(struct inode *dir, struct dentry *dentry) | |||
255 | return 0; | 255 | return 0; |
256 | } | 256 | } |
257 | 257 | ||
258 | static int omfs_add_node(struct inode *dir, struct dentry *dentry, umode_t mode) | 258 | static int omfs_add_node(struct inode *dir, struct dentry *dentry, int mode) |
259 | { | 259 | { |
260 | int err; | 260 | int err; |
261 | struct inode *inode = omfs_new_inode(dir, mode); | 261 | struct inode *inode = omfs_new_inode(dir, mode); |
@@ -279,19 +279,19 @@ out_free_inode: | |||
279 | return err; | 279 | return err; |
280 | } | 280 | } |
281 | 281 | ||
282 | static int omfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) | 282 | static int omfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) |
283 | { | 283 | { |
284 | return omfs_add_node(dir, dentry, mode | S_IFDIR); | 284 | return omfs_add_node(dir, dentry, mode | S_IFDIR); |
285 | } | 285 | } |
286 | 286 | ||
287 | static int omfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, | 287 | static int omfs_create(struct inode *dir, struct dentry *dentry, int mode, |
288 | bool excl) | 288 | struct nameidata *nd) |
289 | { | 289 | { |
290 | return omfs_add_node(dir, dentry, mode | S_IFREG); | 290 | return omfs_add_node(dir, dentry, mode | S_IFREG); |
291 | } | 291 | } |
292 | 292 | ||
293 | static struct dentry *omfs_lookup(struct inode *dir, struct dentry *dentry, | 293 | static struct dentry *omfs_lookup(struct inode *dir, struct dentry *dentry, |
294 | unsigned int flags) | 294 | struct nameidata *nd) |
295 | { | 295 | { |
296 | struct buffer_head *bh; | 296 | struct buffer_head *bh; |
297 | struct inode *inode = NULL; | 297 | struct inode *inode = NULL; |
diff --git a/fs/omfs/file.c b/fs/omfs/file.c index e0d9b3e722b..2c6d95257a4 100644 --- a/fs/omfs/file.c +++ b/fs/omfs/file.c | |||
@@ -146,7 +146,8 @@ static int omfs_grow_extent(struct inode *inode, struct omfs_extent *oe, | |||
146 | be64_to_cpu(entry->e_blocks); | 146 | be64_to_cpu(entry->e_blocks); |
147 | 147 | ||
148 | if (omfs_allocate_block(inode->i_sb, new_block)) { | 148 | if (omfs_allocate_block(inode->i_sb, new_block)) { |
149 | be64_add_cpu(&entry->e_blocks, 1); | 149 | entry->e_blocks = |
150 | cpu_to_be64(be64_to_cpu(entry->e_blocks) + 1); | ||
150 | terminator->e_blocks = ~(cpu_to_be64( | 151 | terminator->e_blocks = ~(cpu_to_be64( |
151 | be64_to_cpu(~terminator->e_blocks) + 1)); | 152 | be64_to_cpu(~terminator->e_blocks) + 1)); |
152 | goto out; | 153 | goto out; |
@@ -176,7 +177,7 @@ static int omfs_grow_extent(struct inode *inode, struct omfs_extent *oe, | |||
176 | be64_to_cpu(~terminator->e_blocks) + (u64) new_count)); | 177 | be64_to_cpu(~terminator->e_blocks) + (u64) new_count)); |
177 | 178 | ||
178 | /* write in new entry */ | 179 | /* write in new entry */ |
179 | be32_add_cpu(&oe->e_extent_count, 1); | 180 | oe->e_extent_count = cpu_to_be32(1 + be32_to_cpu(oe->e_extent_count)); |
180 | 181 | ||
181 | out: | 182 | out: |
182 | *ret_block = new_block; | 183 | *ret_block = new_block; |
@@ -306,16 +307,6 @@ omfs_writepages(struct address_space *mapping, struct writeback_control *wbc) | |||
306 | return mpage_writepages(mapping, wbc, omfs_get_block); | 307 | return mpage_writepages(mapping, wbc, omfs_get_block); |
307 | } | 308 | } |
308 | 309 | ||
309 | static void omfs_write_failed(struct address_space *mapping, loff_t to) | ||
310 | { | ||
311 | struct inode *inode = mapping->host; | ||
312 | |||
313 | if (to > inode->i_size) { | ||
314 | truncate_pagecache(inode, to, inode->i_size); | ||
315 | omfs_truncate(inode); | ||
316 | } | ||
317 | } | ||
318 | |||
319 | static int omfs_write_begin(struct file *file, struct address_space *mapping, | 310 | static int omfs_write_begin(struct file *file, struct address_space *mapping, |
320 | loff_t pos, unsigned len, unsigned flags, | 311 | loff_t pos, unsigned len, unsigned flags, |
321 | struct page **pagep, void **fsdata) | 312 | struct page **pagep, void **fsdata) |
@@ -324,8 +315,11 @@ static int omfs_write_begin(struct file *file, struct address_space *mapping, | |||
324 | 315 | ||
325 | ret = block_write_begin(mapping, pos, len, flags, pagep, | 316 | ret = block_write_begin(mapping, pos, len, flags, pagep, |
326 | omfs_get_block); | 317 | omfs_get_block); |
327 | if (unlikely(ret)) | 318 | if (unlikely(ret)) { |
328 | omfs_write_failed(mapping, pos + len); | 319 | loff_t isize = mapping->host->i_size; |
320 | if (pos + len > isize) | ||
321 | vmtruncate(mapping->host, isize); | ||
322 | } | ||
329 | 323 | ||
330 | return ret; | 324 | return ret; |
331 | } | 325 | } |
@@ -357,11 +351,9 @@ static int omfs_setattr(struct dentry *dentry, struct iattr *attr) | |||
357 | 351 | ||
358 | if ((attr->ia_valid & ATTR_SIZE) && | 352 | if ((attr->ia_valid & ATTR_SIZE) && |
359 | attr->ia_size != i_size_read(inode)) { | 353 | attr->ia_size != i_size_read(inode)) { |
360 | error = inode_newsize_ok(inode, attr->ia_size); | 354 | error = vmtruncate(inode, attr->ia_size); |
361 | if (error) | 355 | if (error) |
362 | return error; | 356 | return error; |
363 | truncate_setsize(inode, attr->ia_size); | ||
364 | omfs_truncate(inode); | ||
365 | } | 357 | } |
366 | 358 | ||
367 | setattr_copy(inode, attr); | 359 | setattr_copy(inode, attr); |
@@ -371,6 +363,7 @@ static int omfs_setattr(struct dentry *dentry, struct iattr *attr) | |||
371 | 363 | ||
372 | const struct inode_operations omfs_file_inops = { | 364 | const struct inode_operations omfs_file_inops = { |
373 | .setattr = omfs_setattr, | 365 | .setattr = omfs_setattr, |
366 | .truncate = omfs_truncate | ||
374 | }; | 367 | }; |
375 | 368 | ||
376 | const struct address_space_operations omfs_aops = { | 369 | const struct address_space_operations omfs_aops = { |
diff --git a/fs/omfs/inode.c b/fs/omfs/inode.c index 25d715c7c87..e043c4cb9a9 100644 --- a/fs/omfs/inode.c +++ b/fs/omfs/inode.c | |||
@@ -28,7 +28,7 @@ struct buffer_head *omfs_bread(struct super_block *sb, sector_t block) | |||
28 | return sb_bread(sb, clus_to_blk(sbi, block)); | 28 | return sb_bread(sb, clus_to_blk(sbi, block)); |
29 | } | 29 | } |
30 | 30 | ||
31 | struct inode *omfs_new_inode(struct inode *dir, umode_t mode) | 31 | struct inode *omfs_new_inode(struct inode *dir, int mode) |
32 | { | 32 | { |
33 | struct inode *inode; | 33 | struct inode *inode; |
34 | u64 new_block; | 34 | u64 new_block; |
@@ -184,7 +184,7 @@ int omfs_sync_inode(struct inode *inode) | |||
184 | static void omfs_evict_inode(struct inode *inode) | 184 | static void omfs_evict_inode(struct inode *inode) |
185 | { | 185 | { |
186 | truncate_inode_pages(&inode->i_data, 0); | 186 | truncate_inode_pages(&inode->i_data, 0); |
187 | clear_inode(inode); | 187 | end_writeback(inode); |
188 | 188 | ||
189 | if (inode->i_nlink) | 189 | if (inode->i_nlink) |
190 | return; | 190 | return; |
@@ -391,16 +391,12 @@ static int parse_options(char *options, struct omfs_sb_info *sbi) | |||
391 | case Opt_uid: | 391 | case Opt_uid: |
392 | if (match_int(&args[0], &option)) | 392 | if (match_int(&args[0], &option)) |
393 | return 0; | 393 | return 0; |
394 | sbi->s_uid = make_kuid(current_user_ns(), option); | 394 | sbi->s_uid = option; |
395 | if (!uid_valid(sbi->s_uid)) | ||
396 | return 0; | ||
397 | break; | 395 | break; |
398 | case Opt_gid: | 396 | case Opt_gid: |
399 | if (match_int(&args[0], &option)) | 397 | if (match_int(&args[0], &option)) |
400 | return 0; | 398 | return 0; |
401 | sbi->s_gid = make_kgid(current_user_ns(), option); | 399 | sbi->s_gid = option; |
402 | if (!gid_valid(sbi->s_gid)) | ||
403 | return 0; | ||
404 | break; | 400 | break; |
405 | case Opt_umask: | 401 | case Opt_umask: |
406 | if (match_octal(&args[0], &option)) | 402 | if (match_octal(&args[0], &option)) |
@@ -543,9 +539,11 @@ static int omfs_fill_super(struct super_block *sb, void *data, int silent) | |||
543 | goto out_brelse_bh2; | 539 | goto out_brelse_bh2; |
544 | } | 540 | } |
545 | 541 | ||
546 | sb->s_root = d_make_root(root); | 542 | sb->s_root = d_alloc_root(root); |
547 | if (!sb->s_root) | 543 | if (!sb->s_root) { |
544 | iput(root); | ||
548 | goto out_brelse_bh2; | 545 | goto out_brelse_bh2; |
546 | } | ||
549 | printk(KERN_DEBUG "omfs: Mounted volume %s\n", omfs_rb->r_name); | 547 | printk(KERN_DEBUG "omfs: Mounted volume %s\n", omfs_rb->r_name); |
550 | 548 | ||
551 | ret = 0; | 549 | ret = 0; |
diff --git a/fs/omfs/omfs.h b/fs/omfs/omfs.h index f0f8bc75e60..7d414fef501 100644 --- a/fs/omfs/omfs.h +++ b/fs/omfs/omfs.h | |||
@@ -19,8 +19,8 @@ struct omfs_sb_info { | |||
19 | unsigned long **s_imap; | 19 | unsigned long **s_imap; |
20 | int s_imap_size; | 20 | int s_imap_size; |
21 | struct mutex s_bitmap_lock; | 21 | struct mutex s_bitmap_lock; |
22 | kuid_t s_uid; | 22 | int s_uid; |
23 | kgid_t s_gid; | 23 | int s_gid; |
24 | int s_dmask; | 24 | int s_dmask; |
25 | int s_fmask; | 25 | int s_fmask; |
26 | }; | 26 | }; |
@@ -60,7 +60,7 @@ extern int omfs_shrink_inode(struct inode *inode); | |||
60 | /* inode.c */ | 60 | /* inode.c */ |
61 | extern struct buffer_head *omfs_bread(struct super_block *sb, sector_t block); | 61 | extern struct buffer_head *omfs_bread(struct super_block *sb, sector_t block); |
62 | extern struct inode *omfs_iget(struct super_block *sb, ino_t inode); | 62 | extern struct inode *omfs_iget(struct super_block *sb, ino_t inode); |
63 | extern struct inode *omfs_new_inode(struct inode *dir, umode_t mode); | 63 | extern struct inode *omfs_new_inode(struct inode *dir, int mode); |
64 | extern int omfs_reserve_block(struct super_block *sb, sector_t block); | 64 | extern int omfs_reserve_block(struct super_block *sb, sector_t block); |
65 | extern int omfs_find_empty_block(struct super_block *sb, int mode, ino_t *ino); | 65 | extern int omfs_find_empty_block(struct super_block *sb, int mode, ino_t *ino); |
66 | extern int omfs_sync_inode(struct inode *inode); | 66 | extern int omfs_sync_inode(struct inode *inode); |