diff options
Diffstat (limited to 'fs/ext3')
-rw-r--r-- | fs/ext3/dir.c | 3 | ||||
-rw-r--r-- | fs/ext3/file.c | 10 | ||||
-rw-r--r-- | fs/ext3/inode.c | 5 | ||||
-rw-r--r-- | fs/ext3/ioctl.c | 55 | ||||
-rw-r--r-- | fs/ext3/namei.c | 25 |
5 files changed, 79 insertions, 19 deletions
diff --git a/fs/ext3/dir.c b/fs/ext3/dir.c index 429acbb4e064..d0b54f30b914 100644 --- a/fs/ext3/dir.c +++ b/fs/ext3/dir.c | |||
@@ -44,6 +44,9 @@ const struct file_operations ext3_dir_operations = { | |||
44 | .read = generic_read_dir, | 44 | .read = generic_read_dir, |
45 | .readdir = ext3_readdir, /* we take BKL. needed?*/ | 45 | .readdir = ext3_readdir, /* we take BKL. needed?*/ |
46 | .ioctl = ext3_ioctl, /* BKL held */ | 46 | .ioctl = ext3_ioctl, /* BKL held */ |
47 | #ifdef CONFIG_COMPAT | ||
48 | .compat_ioctl = ext3_compat_ioctl, | ||
49 | #endif | ||
47 | .fsync = ext3_sync_file, /* BKL held */ | 50 | .fsync = ext3_sync_file, /* BKL held */ |
48 | #ifdef CONFIG_EXT3_INDEX | 51 | #ifdef CONFIG_EXT3_INDEX |
49 | .release = ext3_release_dir, | 52 | .release = ext3_release_dir, |
diff --git a/fs/ext3/file.c b/fs/ext3/file.c index 994efd189f4e..e96c388047e0 100644 --- a/fs/ext3/file.c +++ b/fs/ext3/file.c | |||
@@ -48,14 +48,15 @@ static int ext3_release_file (struct inode * inode, struct file * filp) | |||
48 | } | 48 | } |
49 | 49 | ||
50 | static ssize_t | 50 | static ssize_t |
51 | ext3_file_write(struct kiocb *iocb, const char __user *buf, size_t count, loff_t pos) | 51 | ext3_file_write(struct kiocb *iocb, const struct iovec *iov, |
52 | unsigned long nr_segs, loff_t pos) | ||
52 | { | 53 | { |
53 | struct file *file = iocb->ki_filp; | 54 | struct file *file = iocb->ki_filp; |
54 | struct inode *inode = file->f_dentry->d_inode; | 55 | struct inode *inode = file->f_dentry->d_inode; |
55 | ssize_t ret; | 56 | ssize_t ret; |
56 | int err; | 57 | int err; |
57 | 58 | ||
58 | ret = generic_file_aio_write(iocb, buf, count, pos); | 59 | ret = generic_file_aio_write(iocb, iov, nr_segs, pos); |
59 | 60 | ||
60 | /* | 61 | /* |
61 | * Skip flushing if there was an error, or if nothing was written. | 62 | * Skip flushing if there was an error, or if nothing was written. |
@@ -111,9 +112,10 @@ const struct file_operations ext3_file_operations = { | |||
111 | .write = do_sync_write, | 112 | .write = do_sync_write, |
112 | .aio_read = generic_file_aio_read, | 113 | .aio_read = generic_file_aio_read, |
113 | .aio_write = ext3_file_write, | 114 | .aio_write = ext3_file_write, |
114 | .readv = generic_file_readv, | ||
115 | .writev = generic_file_writev, | ||
116 | .ioctl = ext3_ioctl, | 115 | .ioctl = ext3_ioctl, |
116 | #ifdef CONFIG_COMPAT | ||
117 | .compat_ioctl = ext3_compat_ioctl, | ||
118 | #endif | ||
117 | .mmap = generic_file_mmap, | 119 | .mmap = generic_file_mmap, |
118 | .open = generic_file_open, | 120 | .open = generic_file_open, |
119 | .release = ext3_release_file, | 121 | .release = ext3_release_file, |
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c index dcf4f1dd108b..03ba5bcab186 100644 --- a/fs/ext3/inode.c +++ b/fs/ext3/inode.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/writeback.h> | 36 | #include <linux/writeback.h> |
37 | #include <linux/mpage.h> | 37 | #include <linux/mpage.h> |
38 | #include <linux/uio.h> | 38 | #include <linux/uio.h> |
39 | #include <linux/bio.h> | ||
39 | #include "xattr.h" | 40 | #include "xattr.h" |
40 | #include "acl.h" | 41 | #include "acl.h" |
41 | 42 | ||
@@ -1073,7 +1074,7 @@ struct buffer_head *ext3_bread(handle_t *handle, struct inode *inode, | |||
1073 | return bh; | 1074 | return bh; |
1074 | if (buffer_uptodate(bh)) | 1075 | if (buffer_uptodate(bh)) |
1075 | return bh; | 1076 | return bh; |
1076 | ll_rw_block(READ, 1, &bh); | 1077 | ll_rw_block(READ_META, 1, &bh); |
1077 | wait_on_buffer(bh); | 1078 | wait_on_buffer(bh); |
1078 | if (buffer_uptodate(bh)) | 1079 | if (buffer_uptodate(bh)) |
1079 | return bh; | 1080 | return bh; |
@@ -2540,7 +2541,7 @@ make_io: | |||
2540 | */ | 2541 | */ |
2541 | get_bh(bh); | 2542 | get_bh(bh); |
2542 | bh->b_end_io = end_buffer_read_sync; | 2543 | bh->b_end_io = end_buffer_read_sync; |
2543 | submit_bh(READ, bh); | 2544 | submit_bh(READ_META, bh); |
2544 | wait_on_buffer(bh); | 2545 | wait_on_buffer(bh); |
2545 | if (!buffer_uptodate(bh)) { | 2546 | if (!buffer_uptodate(bh)) { |
2546 | ext3_error(inode->i_sb, "ext3_get_inode_loc", | 2547 | ext3_error(inode->i_sb, "ext3_get_inode_loc", |
diff --git a/fs/ext3/ioctl.c b/fs/ext3/ioctl.c index 3a6b012d120c..12daa6869572 100644 --- a/fs/ext3/ioctl.c +++ b/fs/ext3/ioctl.c | |||
@@ -13,9 +13,10 @@ | |||
13 | #include <linux/ext3_fs.h> | 13 | #include <linux/ext3_fs.h> |
14 | #include <linux/ext3_jbd.h> | 14 | #include <linux/ext3_jbd.h> |
15 | #include <linux/time.h> | 15 | #include <linux/time.h> |
16 | #include <linux/compat.h> | ||
17 | #include <linux/smp_lock.h> | ||
16 | #include <asm/uaccess.h> | 18 | #include <asm/uaccess.h> |
17 | 19 | ||
18 | |||
19 | int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, | 20 | int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, |
20 | unsigned long arg) | 21 | unsigned long arg) |
21 | { | 22 | { |
@@ -252,3 +253,55 @@ flags_err: | |||
252 | return -ENOTTY; | 253 | return -ENOTTY; |
253 | } | 254 | } |
254 | } | 255 | } |
256 | |||
257 | #ifdef CONFIG_COMPAT | ||
258 | long ext3_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | ||
259 | { | ||
260 | struct inode *inode = file->f_dentry->d_inode; | ||
261 | int ret; | ||
262 | |||
263 | /* These are just misnamed, they actually get/put from/to user an int */ | ||
264 | switch (cmd) { | ||
265 | case EXT3_IOC32_GETFLAGS: | ||
266 | cmd = EXT3_IOC_GETFLAGS; | ||
267 | break; | ||
268 | case EXT3_IOC32_SETFLAGS: | ||
269 | cmd = EXT3_IOC_SETFLAGS; | ||
270 | break; | ||
271 | case EXT3_IOC32_GETVERSION: | ||
272 | cmd = EXT3_IOC_GETVERSION; | ||
273 | break; | ||
274 | case EXT3_IOC32_SETVERSION: | ||
275 | cmd = EXT3_IOC_SETVERSION; | ||
276 | break; | ||
277 | case EXT3_IOC32_GROUP_EXTEND: | ||
278 | cmd = EXT3_IOC_GROUP_EXTEND; | ||
279 | break; | ||
280 | case EXT3_IOC32_GETVERSION_OLD: | ||
281 | cmd = EXT3_IOC_GETVERSION_OLD; | ||
282 | break; | ||
283 | case EXT3_IOC32_SETVERSION_OLD: | ||
284 | cmd = EXT3_IOC_SETVERSION_OLD; | ||
285 | break; | ||
286 | #ifdef CONFIG_JBD_DEBUG | ||
287 | case EXT3_IOC32_WAIT_FOR_READONLY: | ||
288 | cmd = EXT3_IOC_WAIT_FOR_READONLY; | ||
289 | break; | ||
290 | #endif | ||
291 | case EXT3_IOC32_GETRSVSZ: | ||
292 | cmd = EXT3_IOC_GETRSVSZ; | ||
293 | break; | ||
294 | case EXT3_IOC32_SETRSVSZ: | ||
295 | cmd = EXT3_IOC_SETRSVSZ; | ||
296 | break; | ||
297 | case EXT3_IOC_GROUP_ADD: | ||
298 | break; | ||
299 | default: | ||
300 | return -ENOIOCTLCMD; | ||
301 | } | ||
302 | lock_kernel(); | ||
303 | ret = ext3_ioctl(inode, file, cmd, (unsigned long) compat_ptr(arg)); | ||
304 | unlock_kernel(); | ||
305 | return ret; | ||
306 | } | ||
307 | #endif | ||
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c index 85d132c37ee0..906731a20f1a 100644 --- a/fs/ext3/namei.c +++ b/fs/ext3/namei.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/string.h> | 35 | #include <linux/string.h> |
36 | #include <linux/quotaops.h> | 36 | #include <linux/quotaops.h> |
37 | #include <linux/buffer_head.h> | 37 | #include <linux/buffer_head.h> |
38 | #include <linux/bio.h> | ||
38 | #include <linux/smp_lock.h> | 39 | #include <linux/smp_lock.h> |
39 | 40 | ||
40 | #include "namei.h" | 41 | #include "namei.h" |
@@ -870,7 +871,7 @@ restart: | |||
870 | bh = ext3_getblk(NULL, dir, b++, 0, &err); | 871 | bh = ext3_getblk(NULL, dir, b++, 0, &err); |
871 | bh_use[ra_max] = bh; | 872 | bh_use[ra_max] = bh; |
872 | if (bh) | 873 | if (bh) |
873 | ll_rw_block(READ, 1, &bh); | 874 | ll_rw_block(READ_META, 1, &bh); |
874 | } | 875 | } |
875 | } | 876 | } |
876 | if ((bh = bh_use[ra_ptr++]) == NULL) | 877 | if ((bh = bh_use[ra_ptr++]) == NULL) |
@@ -1615,12 +1616,12 @@ static int ext3_delete_entry (handle_t *handle, | |||
1615 | */ | 1616 | */ |
1616 | static inline void ext3_inc_count(handle_t *handle, struct inode *inode) | 1617 | static inline void ext3_inc_count(handle_t *handle, struct inode *inode) |
1617 | { | 1618 | { |
1618 | inode->i_nlink++; | 1619 | inc_nlink(inode); |
1619 | } | 1620 | } |
1620 | 1621 | ||
1621 | static inline void ext3_dec_count(handle_t *handle, struct inode *inode) | 1622 | static inline void ext3_dec_count(handle_t *handle, struct inode *inode) |
1622 | { | 1623 | { |
1623 | inode->i_nlink--; | 1624 | drop_nlink(inode); |
1624 | } | 1625 | } |
1625 | 1626 | ||
1626 | static int ext3_add_nondir(handle_t *handle, | 1627 | static int ext3_add_nondir(handle_t *handle, |
@@ -1742,7 +1743,7 @@ retry: | |||
1742 | inode->i_size = EXT3_I(inode)->i_disksize = inode->i_sb->s_blocksize; | 1743 | inode->i_size = EXT3_I(inode)->i_disksize = inode->i_sb->s_blocksize; |
1743 | dir_block = ext3_bread (handle, inode, 0, 1, &err); | 1744 | dir_block = ext3_bread (handle, inode, 0, 1, &err); |
1744 | if (!dir_block) { | 1745 | if (!dir_block) { |
1745 | inode->i_nlink--; /* is this nlink == 0? */ | 1746 | drop_nlink(inode); /* is this nlink == 0? */ |
1746 | ext3_mark_inode_dirty(handle, inode); | 1747 | ext3_mark_inode_dirty(handle, inode); |
1747 | iput (inode); | 1748 | iput (inode); |
1748 | goto out_stop; | 1749 | goto out_stop; |
@@ -1774,7 +1775,7 @@ retry: | |||
1774 | iput (inode); | 1775 | iput (inode); |
1775 | goto out_stop; | 1776 | goto out_stop; |
1776 | } | 1777 | } |
1777 | dir->i_nlink++; | 1778 | inc_nlink(dir); |
1778 | ext3_update_dx_flag(dir); | 1779 | ext3_update_dx_flag(dir); |
1779 | ext3_mark_inode_dirty(handle, dir); | 1780 | ext3_mark_inode_dirty(handle, dir); |
1780 | d_instantiate(dentry, inode); | 1781 | d_instantiate(dentry, inode); |
@@ -2044,7 +2045,7 @@ static int ext3_rmdir (struct inode * dir, struct dentry *dentry) | |||
2044 | "empty directory has nlink!=2 (%d)", | 2045 | "empty directory has nlink!=2 (%d)", |
2045 | inode->i_nlink); | 2046 | inode->i_nlink); |
2046 | inode->i_version++; | 2047 | inode->i_version++; |
2047 | inode->i_nlink = 0; | 2048 | clear_nlink(inode); |
2048 | /* There's no need to set i_disksize: the fact that i_nlink is | 2049 | /* There's no need to set i_disksize: the fact that i_nlink is |
2049 | * zero will ensure that the right thing happens during any | 2050 | * zero will ensure that the right thing happens during any |
2050 | * recovery. */ | 2051 | * recovery. */ |
@@ -2052,7 +2053,7 @@ static int ext3_rmdir (struct inode * dir, struct dentry *dentry) | |||
2052 | ext3_orphan_add(handle, inode); | 2053 | ext3_orphan_add(handle, inode); |
2053 | inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC; | 2054 | inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC; |
2054 | ext3_mark_inode_dirty(handle, inode); | 2055 | ext3_mark_inode_dirty(handle, inode); |
2055 | dir->i_nlink--; | 2056 | drop_nlink(dir); |
2056 | ext3_update_dx_flag(dir); | 2057 | ext3_update_dx_flag(dir); |
2057 | ext3_mark_inode_dirty(handle, dir); | 2058 | ext3_mark_inode_dirty(handle, dir); |
2058 | 2059 | ||
@@ -2103,7 +2104,7 @@ static int ext3_unlink(struct inode * dir, struct dentry *dentry) | |||
2103 | dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC; | 2104 | dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC; |
2104 | ext3_update_dx_flag(dir); | 2105 | ext3_update_dx_flag(dir); |
2105 | ext3_mark_inode_dirty(handle, dir); | 2106 | ext3_mark_inode_dirty(handle, dir); |
2106 | inode->i_nlink--; | 2107 | drop_nlink(inode); |
2107 | if (!inode->i_nlink) | 2108 | if (!inode->i_nlink) |
2108 | ext3_orphan_add(handle, inode); | 2109 | ext3_orphan_add(handle, inode); |
2109 | inode->i_ctime = dir->i_ctime; | 2110 | inode->i_ctime = dir->i_ctime; |
@@ -2325,7 +2326,7 @@ static int ext3_rename (struct inode * old_dir, struct dentry *old_dentry, | |||
2325 | } | 2326 | } |
2326 | 2327 | ||
2327 | if (new_inode) { | 2328 | if (new_inode) { |
2328 | new_inode->i_nlink--; | 2329 | drop_nlink(new_inode); |
2329 | new_inode->i_ctime = CURRENT_TIME_SEC; | 2330 | new_inode->i_ctime = CURRENT_TIME_SEC; |
2330 | } | 2331 | } |
2331 | old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME_SEC; | 2332 | old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME_SEC; |
@@ -2336,11 +2337,11 @@ static int ext3_rename (struct inode * old_dir, struct dentry *old_dentry, | |||
2336 | PARENT_INO(dir_bh->b_data) = cpu_to_le32(new_dir->i_ino); | 2337 | PARENT_INO(dir_bh->b_data) = cpu_to_le32(new_dir->i_ino); |
2337 | BUFFER_TRACE(dir_bh, "call ext3_journal_dirty_metadata"); | 2338 | BUFFER_TRACE(dir_bh, "call ext3_journal_dirty_metadata"); |
2338 | ext3_journal_dirty_metadata(handle, dir_bh); | 2339 | ext3_journal_dirty_metadata(handle, dir_bh); |
2339 | old_dir->i_nlink--; | 2340 | drop_nlink(old_dir); |
2340 | if (new_inode) { | 2341 | if (new_inode) { |
2341 | new_inode->i_nlink--; | 2342 | drop_nlink(new_inode); |
2342 | } else { | 2343 | } else { |
2343 | new_dir->i_nlink++; | 2344 | inc_nlink(new_dir); |
2344 | ext3_update_dx_flag(new_dir); | 2345 | ext3_update_dx_flag(new_dir); |
2345 | ext3_mark_inode_dirty(handle, new_dir); | 2346 | ext3_mark_inode_dirty(handle, new_dir); |
2346 | } | 2347 | } |