diff options
Diffstat (limited to 'fs/xfs/linux-2.6')
| -rw-r--r-- | fs/xfs/linux-2.6/sema.h | 52 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_aops.c | 3 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_buf.c | 16 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_buf.h | 4 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_export.c | 10 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_file.c | 1 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_fs_subr.c | 6 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_ioctl.c | 4 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_iops.c | 192 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_iops.h | 15 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_linux.h | 6 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_lrw.c | 6 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_super.c | 189 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_super.h | 3 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_vnode.c | 22 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_vnode.h | 65 |
16 files changed, 220 insertions, 374 deletions
diff --git a/fs/xfs/linux-2.6/sema.h b/fs/xfs/linux-2.6/sema.h deleted file mode 100644 index 3abe7e9ceb33..000000000000 --- a/fs/xfs/linux-2.6/sema.h +++ /dev/null | |||
| @@ -1,52 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc. | ||
| 3 | * All Rights Reserved. | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or | ||
| 6 | * modify it under the terms of the GNU General Public License as | ||
| 7 | * published by the Free Software Foundation. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope that it would be useful, | ||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | * GNU General Public License for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License | ||
| 15 | * along with this program; if not, write the Free Software Foundation, | ||
| 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 17 | */ | ||
| 18 | #ifndef __XFS_SUPPORT_SEMA_H__ | ||
| 19 | #define __XFS_SUPPORT_SEMA_H__ | ||
| 20 | |||
| 21 | #include <linux/time.h> | ||
| 22 | #include <linux/wait.h> | ||
| 23 | #include <linux/semaphore.h> | ||
| 24 | #include <asm/atomic.h> | ||
| 25 | |||
| 26 | /* | ||
| 27 | * sema_t structure just maps to struct semaphore in Linux kernel. | ||
| 28 | */ | ||
| 29 | |||
| 30 | typedef struct semaphore sema_t; | ||
| 31 | |||
| 32 | #define initnsema(sp, val, name) sema_init(sp, val) | ||
| 33 | #define psema(sp, b) down(sp) | ||
| 34 | #define vsema(sp) up(sp) | ||
| 35 | #define freesema(sema) do { } while (0) | ||
| 36 | |||
| 37 | static inline int issemalocked(sema_t *sp) | ||
| 38 | { | ||
| 39 | return down_trylock(sp) || (up(sp), 0); | ||
| 40 | } | ||
| 41 | |||
| 42 | /* | ||
| 43 | * Map cpsema (try to get the sema) to down_trylock. We need to switch | ||
| 44 | * the return values since cpsema returns 1 (acquired) 0 (failed) and | ||
| 45 | * down_trylock returns the reverse 0 (acquired) 1 (failed). | ||
| 46 | */ | ||
| 47 | static inline int cpsema(sema_t *sp) | ||
| 48 | { | ||
| 49 | return down_trylock(sp) ? 0 : 1; | ||
| 50 | } | ||
| 51 | |||
| 52 | #endif /* __XFS_SUPPORT_SEMA_H__ */ | ||
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c index fa47e43b8b41..f42f80a3b1fa 100644 --- a/fs/xfs/linux-2.6/xfs_aops.c +++ b/fs/xfs/linux-2.6/xfs_aops.c | |||
| @@ -73,7 +73,6 @@ xfs_page_trace( | |||
| 73 | unsigned long pgoff) | 73 | unsigned long pgoff) |
| 74 | { | 74 | { |
| 75 | xfs_inode_t *ip; | 75 | xfs_inode_t *ip; |
| 76 | bhv_vnode_t *vp = vn_from_inode(inode); | ||
| 77 | loff_t isize = i_size_read(inode); | 76 | loff_t isize = i_size_read(inode); |
| 78 | loff_t offset = page_offset(page); | 77 | loff_t offset = page_offset(page); |
| 79 | int delalloc = -1, unmapped = -1, unwritten = -1; | 78 | int delalloc = -1, unmapped = -1, unwritten = -1; |
| @@ -81,7 +80,7 @@ xfs_page_trace( | |||
| 81 | if (page_has_buffers(page)) | 80 | if (page_has_buffers(page)) |
| 82 | xfs_count_page_state(page, &delalloc, &unmapped, &unwritten); | 81 | xfs_count_page_state(page, &delalloc, &unmapped, &unwritten); |
| 83 | 82 | ||
| 84 | ip = xfs_vtoi(vp); | 83 | ip = XFS_I(inode); |
| 85 | if (!ip->i_rwtrace) | 84 | if (!ip->i_rwtrace) |
| 86 | return; | 85 | return; |
| 87 | 86 | ||
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c index 9cc8f0213095..986061ae1b9b 100644 --- a/fs/xfs/linux-2.6/xfs_buf.c +++ b/fs/xfs/linux-2.6/xfs_buf.c | |||
| @@ -58,7 +58,7 @@ xfs_buf_trace( | |||
| 58 | bp, id, | 58 | bp, id, |
| 59 | (void *)(unsigned long)bp->b_flags, | 59 | (void *)(unsigned long)bp->b_flags, |
| 60 | (void *)(unsigned long)bp->b_hold.counter, | 60 | (void *)(unsigned long)bp->b_hold.counter, |
| 61 | (void *)(unsigned long)bp->b_sema.count.counter, | 61 | (void *)(unsigned long)bp->b_sema.count, |
| 62 | (void *)current, | 62 | (void *)current, |
| 63 | data, ra, | 63 | data, ra, |
| 64 | (void *)(unsigned long)((bp->b_file_offset>>32) & 0xffffffff), | 64 | (void *)(unsigned long)((bp->b_file_offset>>32) & 0xffffffff), |
| @@ -253,7 +253,7 @@ _xfs_buf_initialize( | |||
| 253 | 253 | ||
| 254 | memset(bp, 0, sizeof(xfs_buf_t)); | 254 | memset(bp, 0, sizeof(xfs_buf_t)); |
| 255 | atomic_set(&bp->b_hold, 1); | 255 | atomic_set(&bp->b_hold, 1); |
| 256 | init_MUTEX_LOCKED(&bp->b_iodonesema); | 256 | init_completion(&bp->b_iowait); |
| 257 | INIT_LIST_HEAD(&bp->b_list); | 257 | INIT_LIST_HEAD(&bp->b_list); |
| 258 | INIT_LIST_HEAD(&bp->b_hash_list); | 258 | INIT_LIST_HEAD(&bp->b_hash_list); |
| 259 | init_MUTEX_LOCKED(&bp->b_sema); /* held, no waiters */ | 259 | init_MUTEX_LOCKED(&bp->b_sema); /* held, no waiters */ |
| @@ -838,6 +838,7 @@ xfs_buf_rele( | |||
| 838 | return; | 838 | return; |
| 839 | } | 839 | } |
| 840 | 840 | ||
| 841 | ASSERT(atomic_read(&bp->b_hold) > 0); | ||
| 841 | if (atomic_dec_and_lock(&bp->b_hold, &hash->bh_lock)) { | 842 | if (atomic_dec_and_lock(&bp->b_hold, &hash->bh_lock)) { |
| 842 | if (bp->b_relse) { | 843 | if (bp->b_relse) { |
| 843 | atomic_inc(&bp->b_hold); | 844 | atomic_inc(&bp->b_hold); |
| @@ -851,11 +852,6 @@ xfs_buf_rele( | |||
| 851 | spin_unlock(&hash->bh_lock); | 852 | spin_unlock(&hash->bh_lock); |
| 852 | xfs_buf_free(bp); | 853 | xfs_buf_free(bp); |
| 853 | } | 854 | } |
| 854 | } else { | ||
| 855 | /* | ||
| 856 | * Catch reference count leaks | ||
| 857 | */ | ||
| 858 | ASSERT(atomic_read(&bp->b_hold) >= 0); | ||
| 859 | } | 855 | } |
| 860 | } | 856 | } |
| 861 | 857 | ||
| @@ -1037,7 +1033,7 @@ xfs_buf_ioend( | |||
| 1037 | xfs_buf_iodone_work(&bp->b_iodone_work); | 1033 | xfs_buf_iodone_work(&bp->b_iodone_work); |
| 1038 | } | 1034 | } |
| 1039 | } else { | 1035 | } else { |
| 1040 | up(&bp->b_iodonesema); | 1036 | complete(&bp->b_iowait); |
| 1041 | } | 1037 | } |
| 1042 | } | 1038 | } |
| 1043 | 1039 | ||
| @@ -1275,7 +1271,7 @@ xfs_buf_iowait( | |||
| 1275 | XB_TRACE(bp, "iowait", 0); | 1271 | XB_TRACE(bp, "iowait", 0); |
| 1276 | if (atomic_read(&bp->b_io_remaining)) | 1272 | if (atomic_read(&bp->b_io_remaining)) |
| 1277 | blk_run_address_space(bp->b_target->bt_mapping); | 1273 | blk_run_address_space(bp->b_target->bt_mapping); |
| 1278 | down(&bp->b_iodonesema); | 1274 | wait_for_completion(&bp->b_iowait); |
| 1279 | XB_TRACE(bp, "iowaited", (long)bp->b_error); | 1275 | XB_TRACE(bp, "iowaited", (long)bp->b_error); |
| 1280 | return bp->b_error; | 1276 | return bp->b_error; |
| 1281 | } | 1277 | } |
| @@ -1799,7 +1795,7 @@ int __init | |||
| 1799 | xfs_buf_init(void) | 1795 | xfs_buf_init(void) |
| 1800 | { | 1796 | { |
| 1801 | #ifdef XFS_BUF_TRACE | 1797 | #ifdef XFS_BUF_TRACE |
| 1802 | xfs_buf_trace_buf = ktrace_alloc(XFS_BUF_TRACE_SIZE, KM_SLEEP); | 1798 | xfs_buf_trace_buf = ktrace_alloc(XFS_BUF_TRACE_SIZE, KM_NOFS); |
| 1803 | #endif | 1799 | #endif |
| 1804 | 1800 | ||
| 1805 | xfs_buf_zone = kmem_zone_init_flags(sizeof(xfs_buf_t), "xfs_buf", | 1801 | xfs_buf_zone = kmem_zone_init_flags(sizeof(xfs_buf_t), "xfs_buf", |
diff --git a/fs/xfs/linux-2.6/xfs_buf.h b/fs/xfs/linux-2.6/xfs_buf.h index 29d1d4adc078..fe0109956656 100644 --- a/fs/xfs/linux-2.6/xfs_buf.h +++ b/fs/xfs/linux-2.6/xfs_buf.h | |||
| @@ -157,7 +157,7 @@ typedef struct xfs_buf { | |||
| 157 | xfs_buf_iodone_t b_iodone; /* I/O completion function */ | 157 | xfs_buf_iodone_t b_iodone; /* I/O completion function */ |
| 158 | xfs_buf_relse_t b_relse; /* releasing function */ | 158 | xfs_buf_relse_t b_relse; /* releasing function */ |
| 159 | xfs_buf_bdstrat_t b_strat; /* pre-write function */ | 159 | xfs_buf_bdstrat_t b_strat; /* pre-write function */ |
| 160 | struct semaphore b_iodonesema; /* Semaphore for I/O waiters */ | 160 | struct completion b_iowait; /* queue for I/O waiters */ |
| 161 | void *b_fspriv; | 161 | void *b_fspriv; |
| 162 | void *b_fspriv2; | 162 | void *b_fspriv2; |
| 163 | void *b_fspriv3; | 163 | void *b_fspriv3; |
| @@ -352,7 +352,7 @@ extern void xfs_buf_trace(xfs_buf_t *, char *, void *, void *); | |||
| 352 | #define XFS_BUF_CPSEMA(bp) (xfs_buf_cond_lock(bp) == 0) | 352 | #define XFS_BUF_CPSEMA(bp) (xfs_buf_cond_lock(bp) == 0) |
| 353 | #define XFS_BUF_VSEMA(bp) xfs_buf_unlock(bp) | 353 | #define XFS_BUF_VSEMA(bp) xfs_buf_unlock(bp) |
| 354 | #define XFS_BUF_PSEMA(bp,x) xfs_buf_lock(bp) | 354 | #define XFS_BUF_PSEMA(bp,x) xfs_buf_lock(bp) |
| 355 | #define XFS_BUF_V_IODONESEMA(bp) up(&bp->b_iodonesema); | 355 | #define XFS_BUF_FINISH_IOWAIT(bp) complete(&bp->b_iowait); |
| 356 | 356 | ||
| 357 | #define XFS_BUF_SET_TARGET(bp, target) ((bp)->b_target = (target)) | 357 | #define XFS_BUF_SET_TARGET(bp, target) ((bp)->b_target = (target)) |
| 358 | #define XFS_BUF_TARGET(bp) ((bp)->b_target) | 358 | #define XFS_BUF_TARGET(bp) ((bp)->b_target) |
diff --git a/fs/xfs/linux-2.6/xfs_export.c b/fs/xfs/linux-2.6/xfs_export.c index 987fe84f7b13..24fd598af846 100644 --- a/fs/xfs/linux-2.6/xfs_export.c +++ b/fs/xfs/linux-2.6/xfs_export.c | |||
| @@ -139,7 +139,7 @@ xfs_nfs_get_inode( | |||
| 139 | } | 139 | } |
| 140 | 140 | ||
| 141 | xfs_iunlock(ip, XFS_ILOCK_SHARED); | 141 | xfs_iunlock(ip, XFS_ILOCK_SHARED); |
| 142 | return ip->i_vnode; | 142 | return VFS_I(ip); |
| 143 | } | 143 | } |
| 144 | 144 | ||
| 145 | STATIC struct dentry * | 145 | STATIC struct dentry * |
| @@ -167,7 +167,7 @@ xfs_fs_fh_to_dentry(struct super_block *sb, struct fid *fid, | |||
| 167 | if (!inode) | 167 | if (!inode) |
| 168 | return NULL; | 168 | return NULL; |
| 169 | if (IS_ERR(inode)) | 169 | if (IS_ERR(inode)) |
| 170 | return ERR_PTR(PTR_ERR(inode)); | 170 | return ERR_CAST(inode); |
| 171 | result = d_alloc_anon(inode); | 171 | result = d_alloc_anon(inode); |
| 172 | if (!result) { | 172 | if (!result) { |
| 173 | iput(inode); | 173 | iput(inode); |
| @@ -198,7 +198,7 @@ xfs_fs_fh_to_parent(struct super_block *sb, struct fid *fid, | |||
| 198 | if (!inode) | 198 | if (!inode) |
| 199 | return NULL; | 199 | return NULL; |
| 200 | if (IS_ERR(inode)) | 200 | if (IS_ERR(inode)) |
| 201 | return ERR_PTR(PTR_ERR(inode)); | 201 | return ERR_CAST(inode); |
| 202 | result = d_alloc_anon(inode); | 202 | result = d_alloc_anon(inode); |
| 203 | if (!result) { | 203 | if (!result) { |
| 204 | iput(inode); | 204 | iput(inode); |
| @@ -219,9 +219,9 @@ xfs_fs_get_parent( | |||
| 219 | if (unlikely(error)) | 219 | if (unlikely(error)) |
| 220 | return ERR_PTR(-error); | 220 | return ERR_PTR(-error); |
| 221 | 221 | ||
| 222 | parent = d_alloc_anon(cip->i_vnode); | 222 | parent = d_alloc_anon(VFS_I(cip)); |
| 223 | if (unlikely(!parent)) { | 223 | if (unlikely(!parent)) { |
| 224 | iput(cip->i_vnode); | 224 | iput(VFS_I(cip)); |
| 225 | return ERR_PTR(-ENOMEM); | 225 | return ERR_PTR(-ENOMEM); |
| 226 | } | 226 | } |
| 227 | return parent; | 227 | return parent; |
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c index 5f60363b9343..5311c1acdd40 100644 --- a/fs/xfs/linux-2.6/xfs_file.c +++ b/fs/xfs/linux-2.6/xfs_file.c | |||
| @@ -475,6 +475,7 @@ const struct file_operations xfs_invis_file_operations = { | |||
| 475 | const struct file_operations xfs_dir_file_operations = { | 475 | const struct file_operations xfs_dir_file_operations = { |
| 476 | .read = generic_read_dir, | 476 | .read = generic_read_dir, |
| 477 | .readdir = xfs_file_readdir, | 477 | .readdir = xfs_file_readdir, |
| 478 | .llseek = generic_file_llseek, | ||
| 478 | .unlocked_ioctl = xfs_file_ioctl, | 479 | .unlocked_ioctl = xfs_file_ioctl, |
| 479 | #ifdef CONFIG_COMPAT | 480 | #ifdef CONFIG_COMPAT |
| 480 | .compat_ioctl = xfs_file_compat_ioctl, | 481 | .compat_ioctl = xfs_file_compat_ioctl, |
diff --git a/fs/xfs/linux-2.6/xfs_fs_subr.c b/fs/xfs/linux-2.6/xfs_fs_subr.c index 1eefe61f0e10..36caa6d957df 100644 --- a/fs/xfs/linux-2.6/xfs_fs_subr.c +++ b/fs/xfs/linux-2.6/xfs_fs_subr.c | |||
| @@ -31,7 +31,7 @@ xfs_tosspages( | |||
| 31 | xfs_off_t last, | 31 | xfs_off_t last, |
| 32 | int fiopt) | 32 | int fiopt) |
| 33 | { | 33 | { |
| 34 | struct address_space *mapping = ip->i_vnode->i_mapping; | 34 | struct address_space *mapping = VFS_I(ip)->i_mapping; |
| 35 | 35 | ||
| 36 | if (mapping->nrpages) | 36 | if (mapping->nrpages) |
| 37 | truncate_inode_pages(mapping, first); | 37 | truncate_inode_pages(mapping, first); |
| @@ -44,7 +44,7 @@ xfs_flushinval_pages( | |||
| 44 | xfs_off_t last, | 44 | xfs_off_t last, |
| 45 | int fiopt) | 45 | int fiopt) |
| 46 | { | 46 | { |
| 47 | struct address_space *mapping = ip->i_vnode->i_mapping; | 47 | struct address_space *mapping = VFS_I(ip)->i_mapping; |
| 48 | int ret = 0; | 48 | int ret = 0; |
| 49 | 49 | ||
| 50 | if (mapping->nrpages) { | 50 | if (mapping->nrpages) { |
| @@ -64,7 +64,7 @@ xfs_flush_pages( | |||
| 64 | uint64_t flags, | 64 | uint64_t flags, |
| 65 | int fiopt) | 65 | int fiopt) |
| 66 | { | 66 | { |
| 67 | struct address_space *mapping = ip->i_vnode->i_mapping; | 67 | struct address_space *mapping = VFS_I(ip)->i_mapping; |
| 68 | int ret = 0; | 68 | int ret = 0; |
| 69 | int ret2; | 69 | int ret2; |
| 70 | 70 | ||
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c index acb978d9d085..48799ba7e3e6 100644 --- a/fs/xfs/linux-2.6/xfs_ioctl.c +++ b/fs/xfs/linux-2.6/xfs_ioctl.c | |||
| @@ -245,7 +245,7 @@ xfs_vget_fsop_handlereq( | |||
| 245 | 245 | ||
| 246 | xfs_iunlock(ip, XFS_ILOCK_SHARED); | 246 | xfs_iunlock(ip, XFS_ILOCK_SHARED); |
| 247 | 247 | ||
| 248 | *inode = XFS_ITOV(ip); | 248 | *inode = VFS_I(ip); |
| 249 | return 0; | 249 | return 0; |
| 250 | } | 250 | } |
| 251 | 251 | ||
| @@ -927,7 +927,7 @@ STATIC void | |||
| 927 | xfs_diflags_to_linux( | 927 | xfs_diflags_to_linux( |
| 928 | struct xfs_inode *ip) | 928 | struct xfs_inode *ip) |
| 929 | { | 929 | { |
| 930 | struct inode *inode = XFS_ITOV(ip); | 930 | struct inode *inode = VFS_I(ip); |
| 931 | unsigned int xflags = xfs_ip2xflags(ip); | 931 | unsigned int xflags = xfs_ip2xflags(ip); |
| 932 | 932 | ||
| 933 | if (xflags & XFS_XFLAG_IMMUTABLE) | 933 | if (xflags & XFS_XFLAG_IMMUTABLE) |
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c index e88f51028086..095d271f3434 100644 --- a/fs/xfs/linux-2.6/xfs_iops.c +++ b/fs/xfs/linux-2.6/xfs_iops.c | |||
| @@ -62,7 +62,7 @@ void | |||
| 62 | xfs_synchronize_atime( | 62 | xfs_synchronize_atime( |
| 63 | xfs_inode_t *ip) | 63 | xfs_inode_t *ip) |
| 64 | { | 64 | { |
| 65 | struct inode *inode = ip->i_vnode; | 65 | struct inode *inode = VFS_I(ip); |
| 66 | 66 | ||
| 67 | if (inode) { | 67 | if (inode) { |
| 68 | ip->i_d.di_atime.t_sec = (__int32_t)inode->i_atime.tv_sec; | 68 | ip->i_d.di_atime.t_sec = (__int32_t)inode->i_atime.tv_sec; |
| @@ -79,7 +79,7 @@ void | |||
| 79 | xfs_mark_inode_dirty_sync( | 79 | xfs_mark_inode_dirty_sync( |
| 80 | xfs_inode_t *ip) | 80 | xfs_inode_t *ip) |
| 81 | { | 81 | { |
| 82 | struct inode *inode = ip->i_vnode; | 82 | struct inode *inode = VFS_I(ip); |
| 83 | 83 | ||
| 84 | if (inode) | 84 | if (inode) |
| 85 | mark_inode_dirty_sync(inode); | 85 | mark_inode_dirty_sync(inode); |
| @@ -89,36 +89,31 @@ xfs_mark_inode_dirty_sync( | |||
| 89 | * Change the requested timestamp in the given inode. | 89 | * Change the requested timestamp in the given inode. |
| 90 | * We don't lock across timestamp updates, and we don't log them but | 90 | * We don't lock across timestamp updates, and we don't log them but |
| 91 | * we do record the fact that there is dirty information in core. | 91 | * we do record the fact that there is dirty information in core. |
| 92 | * | ||
| 93 | * NOTE -- callers MUST combine XFS_ICHGTIME_MOD or XFS_ICHGTIME_CHG | ||
| 94 | * with XFS_ICHGTIME_ACC to be sure that access time | ||
| 95 | * update will take. Calling first with XFS_ICHGTIME_ACC | ||
| 96 | * and then XFS_ICHGTIME_MOD may fail to modify the access | ||
| 97 | * timestamp if the filesystem is mounted noacctm. | ||
| 98 | */ | 92 | */ |
| 99 | void | 93 | void |
| 100 | xfs_ichgtime( | 94 | xfs_ichgtime( |
| 101 | xfs_inode_t *ip, | 95 | xfs_inode_t *ip, |
| 102 | int flags) | 96 | int flags) |
| 103 | { | 97 | { |
| 104 | struct inode *inode = vn_to_inode(XFS_ITOV(ip)); | 98 | struct inode *inode = VFS_I(ip); |
| 105 | timespec_t tv; | 99 | timespec_t tv; |
| 100 | int sync_it = 0; | ||
| 101 | |||
| 102 | tv = current_fs_time(inode->i_sb); | ||
| 106 | 103 | ||
| 107 | nanotime(&tv); | 104 | if ((flags & XFS_ICHGTIME_MOD) && |
| 108 | if (flags & XFS_ICHGTIME_MOD) { | 105 | !timespec_equal(&inode->i_mtime, &tv)) { |
| 109 | inode->i_mtime = tv; | 106 | inode->i_mtime = tv; |
| 110 | ip->i_d.di_mtime.t_sec = (__int32_t)tv.tv_sec; | 107 | ip->i_d.di_mtime.t_sec = (__int32_t)tv.tv_sec; |
| 111 | ip->i_d.di_mtime.t_nsec = (__int32_t)tv.tv_nsec; | 108 | ip->i_d.di_mtime.t_nsec = (__int32_t)tv.tv_nsec; |
| 109 | sync_it = 1; | ||
| 112 | } | 110 | } |
| 113 | if (flags & XFS_ICHGTIME_ACC) { | 111 | if ((flags & XFS_ICHGTIME_CHG) && |
| 114 | inode->i_atime = tv; | 112 | !timespec_equal(&inode->i_ctime, &tv)) { |
| 115 | ip->i_d.di_atime.t_sec = (__int32_t)tv.tv_sec; | ||
| 116 | ip->i_d.di_atime.t_nsec = (__int32_t)tv.tv_nsec; | ||
| 117 | } | ||
| 118 | if (flags & XFS_ICHGTIME_CHG) { | ||
| 119 | inode->i_ctime = tv; | 113 | inode->i_ctime = tv; |
| 120 | ip->i_d.di_ctime.t_sec = (__int32_t)tv.tv_sec; | 114 | ip->i_d.di_ctime.t_sec = (__int32_t)tv.tv_sec; |
| 121 | ip->i_d.di_ctime.t_nsec = (__int32_t)tv.tv_nsec; | 115 | ip->i_d.di_ctime.t_nsec = (__int32_t)tv.tv_nsec; |
| 116 | sync_it = 1; | ||
| 122 | } | 117 | } |
| 123 | 118 | ||
| 124 | /* | 119 | /* |
| @@ -130,55 +125,11 @@ xfs_ichgtime( | |||
| 130 | * ensure that the compiler does not reorder the update | 125 | * ensure that the compiler does not reorder the update |
| 131 | * of i_update_core above the timestamp updates above. | 126 | * of i_update_core above the timestamp updates above. |
| 132 | */ | 127 | */ |
| 133 | SYNCHRONIZE(); | 128 | if (sync_it) { |
| 134 | ip->i_update_core = 1; | 129 | SYNCHRONIZE(); |
| 135 | if (!(inode->i_state & I_NEW)) | 130 | ip->i_update_core = 1; |
| 136 | mark_inode_dirty_sync(inode); | 131 | mark_inode_dirty_sync(inode); |
| 137 | } | ||
| 138 | |||
| 139 | /* | ||
| 140 | * Variant on the above which avoids querying the system clock | ||
| 141 | * in situations where we know the Linux inode timestamps have | ||
| 142 | * just been updated (and so we can update our inode cheaply). | ||
| 143 | */ | ||
| 144 | void | ||
| 145 | xfs_ichgtime_fast( | ||
| 146 | xfs_inode_t *ip, | ||
| 147 | struct inode *inode, | ||
| 148 | int flags) | ||
| 149 | { | ||
| 150 | timespec_t *tvp; | ||
| 151 | |||
| 152 | /* | ||
| 153 | * Atime updates for read() & friends are handled lazily now, and | ||
| 154 | * explicit updates must go through xfs_ichgtime() | ||
| 155 | */ | ||
| 156 | ASSERT((flags & XFS_ICHGTIME_ACC) == 0); | ||
| 157 | |||
| 158 | if (flags & XFS_ICHGTIME_MOD) { | ||
| 159 | tvp = &inode->i_mtime; | ||
| 160 | ip->i_d.di_mtime.t_sec = (__int32_t)tvp->tv_sec; | ||
| 161 | ip->i_d.di_mtime.t_nsec = (__int32_t)tvp->tv_nsec; | ||
| 162 | } | 132 | } |
| 163 | if (flags & XFS_ICHGTIME_CHG) { | ||
| 164 | tvp = &inode->i_ctime; | ||
| 165 | ip->i_d.di_ctime.t_sec = (__int32_t)tvp->tv_sec; | ||
| 166 | ip->i_d.di_ctime.t_nsec = (__int32_t)tvp->tv_nsec; | ||
| 167 | } | ||
| 168 | |||
| 169 | /* | ||
| 170 | * We update the i_update_core field _after_ changing | ||
| 171 | * the timestamps in order to coordinate properly with | ||
| 172 | * xfs_iflush() so that we don't lose timestamp updates. | ||
| 173 | * This keeps us from having to hold the inode lock | ||
| 174 | * while doing this. We use the SYNCHRONIZE macro to | ||
| 175 | * ensure that the compiler does not reorder the update | ||
| 176 | * of i_update_core above the timestamp updates above. | ||
| 177 | */ | ||
| 178 | SYNCHRONIZE(); | ||
| 179 | ip->i_update_core = 1; | ||
| 180 | if (!(inode->i_state & I_NEW)) | ||
| 181 | mark_inode_dirty_sync(inode); | ||
| 182 | } | 133 | } |
| 183 | 134 | ||
| 184 | /* | 135 | /* |
| @@ -299,7 +250,7 @@ xfs_vn_mknod( | |||
| 299 | if (unlikely(error)) | 250 | if (unlikely(error)) |
| 300 | goto out_free_acl; | 251 | goto out_free_acl; |
| 301 | 252 | ||
| 302 | inode = ip->i_vnode; | 253 | inode = VFS_I(ip); |
| 303 | 254 | ||
| 304 | error = xfs_init_security(inode, dir); | 255 | error = xfs_init_security(inode, dir); |
| 305 | if (unlikely(error)) | 256 | if (unlikely(error)) |
| @@ -366,7 +317,7 @@ xfs_vn_lookup( | |||
| 366 | return NULL; | 317 | return NULL; |
| 367 | } | 318 | } |
| 368 | 319 | ||
| 369 | return d_splice_alias(cip->i_vnode, dentry); | 320 | return d_splice_alias(VFS_I(cip), dentry); |
| 370 | } | 321 | } |
| 371 | 322 | ||
| 372 | STATIC struct dentry * | 323 | STATIC struct dentry * |
| @@ -399,12 +350,12 @@ xfs_vn_ci_lookup( | |||
| 399 | 350 | ||
| 400 | /* if exact match, just splice and exit */ | 351 | /* if exact match, just splice and exit */ |
| 401 | if (!ci_name.name) | 352 | if (!ci_name.name) |
| 402 | return d_splice_alias(ip->i_vnode, dentry); | 353 | return d_splice_alias(VFS_I(ip), dentry); |
| 403 | 354 | ||
| 404 | /* else case-insensitive match... */ | 355 | /* else case-insensitive match... */ |
| 405 | dname.name = ci_name.name; | 356 | dname.name = ci_name.name; |
| 406 | dname.len = ci_name.len; | 357 | dname.len = ci_name.len; |
| 407 | dentry = d_add_ci(ip->i_vnode, dentry, &dname); | 358 | dentry = d_add_ci(dentry, VFS_I(ip), &dname); |
| 408 | kmem_free(ci_name.name); | 359 | kmem_free(ci_name.name); |
| 409 | return dentry; | 360 | return dentry; |
| 410 | } | 361 | } |
| @@ -478,7 +429,7 @@ xfs_vn_symlink( | |||
| 478 | if (unlikely(error)) | 429 | if (unlikely(error)) |
| 479 | goto out; | 430 | goto out; |
| 480 | 431 | ||
| 481 | inode = cip->i_vnode; | 432 | inode = VFS_I(cip); |
| 482 | 433 | ||
| 483 | error = xfs_init_security(inode, dir); | 434 | error = xfs_init_security(inode, dir); |
| 484 | if (unlikely(error)) | 435 | if (unlikely(error)) |
| @@ -710,7 +661,7 @@ out_error: | |||
| 710 | return error; | 661 | return error; |
| 711 | } | 662 | } |
| 712 | 663 | ||
| 713 | const struct inode_operations xfs_inode_operations = { | 664 | static const struct inode_operations xfs_inode_operations = { |
| 714 | .permission = xfs_vn_permission, | 665 | .permission = xfs_vn_permission, |
| 715 | .truncate = xfs_vn_truncate, | 666 | .truncate = xfs_vn_truncate, |
| 716 | .getattr = xfs_vn_getattr, | 667 | .getattr = xfs_vn_getattr, |
| @@ -722,7 +673,7 @@ const struct inode_operations xfs_inode_operations = { | |||
| 722 | .fallocate = xfs_vn_fallocate, | 673 | .fallocate = xfs_vn_fallocate, |
| 723 | }; | 674 | }; |
| 724 | 675 | ||
| 725 | const struct inode_operations xfs_dir_inode_operations = { | 676 | static const struct inode_operations xfs_dir_inode_operations = { |
| 726 | .create = xfs_vn_create, | 677 | .create = xfs_vn_create, |
| 727 | .lookup = xfs_vn_lookup, | 678 | .lookup = xfs_vn_lookup, |
| 728 | .link = xfs_vn_link, | 679 | .link = xfs_vn_link, |
| @@ -747,7 +698,7 @@ const struct inode_operations xfs_dir_inode_operations = { | |||
| 747 | .listxattr = xfs_vn_listxattr, | 698 | .listxattr = xfs_vn_listxattr, |
| 748 | }; | 699 | }; |
| 749 | 700 | ||
| 750 | const struct inode_operations xfs_dir_ci_inode_operations = { | 701 | static const struct inode_operations xfs_dir_ci_inode_operations = { |
| 751 | .create = xfs_vn_create, | 702 | .create = xfs_vn_create, |
| 752 | .lookup = xfs_vn_ci_lookup, | 703 | .lookup = xfs_vn_ci_lookup, |
| 753 | .link = xfs_vn_link, | 704 | .link = xfs_vn_link, |
| @@ -772,7 +723,7 @@ const struct inode_operations xfs_dir_ci_inode_operations = { | |||
| 772 | .listxattr = xfs_vn_listxattr, | 723 | .listxattr = xfs_vn_listxattr, |
| 773 | }; | 724 | }; |
| 774 | 725 | ||
| 775 | const struct inode_operations xfs_symlink_inode_operations = { | 726 | static const struct inode_operations xfs_symlink_inode_operations = { |
| 776 | .readlink = generic_readlink, | 727 | .readlink = generic_readlink, |
| 777 | .follow_link = xfs_vn_follow_link, | 728 | .follow_link = xfs_vn_follow_link, |
| 778 | .put_link = xfs_vn_put_link, | 729 | .put_link = xfs_vn_put_link, |
| @@ -784,3 +735,98 @@ const struct inode_operations xfs_symlink_inode_operations = { | |||
| 784 | .removexattr = generic_removexattr, | 735 | .removexattr = generic_removexattr, |
| 785 | .listxattr = xfs_vn_listxattr, | 736 | .listxattr = xfs_vn_listxattr, |
| 786 | }; | 737 | }; |
| 738 | |||
| 739 | STATIC void | ||
| 740 | xfs_diflags_to_iflags( | ||
| 741 | struct inode *inode, | ||
| 742 | struct xfs_inode *ip) | ||
| 743 | { | ||
| 744 | if (ip->i_d.di_flags & XFS_DIFLAG_IMMUTABLE) | ||
| 745 | inode->i_flags |= S_IMMUTABLE; | ||
| 746 | else | ||
| 747 | inode->i_flags &= ~S_IMMUTABLE; | ||
| 748 | if (ip->i_d.di_flags & XFS_DIFLAG_APPEND) | ||
| 749 | inode->i_flags |= S_APPEND; | ||
| 750 | else | ||
| 751 | inode->i_flags &= ~S_APPEND; | ||
| 752 | if (ip->i_d.di_flags & XFS_DIFLAG_SYNC) | ||
| 753 | inode->i_flags |= S_SYNC; | ||
| 754 | else | ||
| 755 | inode->i_flags &= ~S_SYNC; | ||
| 756 | if (ip->i_d.di_flags & XFS_DIFLAG_NOATIME) | ||
| 757 | inode->i_flags |= S_NOATIME; | ||
| 758 | else | ||
| 759 | inode->i_flags &= ~S_NOATIME; | ||
| 760 | } | ||
| 761 | |||
| 762 | /* | ||
| 763 | * Initialize the Linux inode, set up the operation vectors and | ||
| 764 | * unlock the inode. | ||
| 765 | * | ||
| 766 | * When reading existing inodes from disk this is called directly | ||
| 767 | * from xfs_iget, when creating a new inode it is called from | ||
| 768 | * xfs_ialloc after setting up the inode. | ||
| 769 | */ | ||
| 770 | void | ||
| 771 | xfs_setup_inode( | ||
| 772 | struct xfs_inode *ip) | ||
| 773 | { | ||
| 774 | struct inode *inode = ip->i_vnode; | ||
| 775 | |||
| 776 | inode->i_mode = ip->i_d.di_mode; | ||
| 777 | inode->i_nlink = ip->i_d.di_nlink; | ||
| 778 | inode->i_uid = ip->i_d.di_uid; | ||
| 779 | inode->i_gid = ip->i_d.di_gid; | ||
| 780 | |||
| 781 | switch (inode->i_mode & S_IFMT) { | ||
| 782 | case S_IFBLK: | ||
| 783 | case S_IFCHR: | ||
| 784 | inode->i_rdev = | ||
| 785 | MKDEV(sysv_major(ip->i_df.if_u2.if_rdev) & 0x1ff, | ||
| 786 | sysv_minor(ip->i_df.if_u2.if_rdev)); | ||
| 787 | break; | ||
| 788 | default: | ||
| 789 | inode->i_rdev = 0; | ||
| 790 | break; | ||
| 791 | } | ||
| 792 | |||
| 793 | inode->i_generation = ip->i_d.di_gen; | ||
| 794 | i_size_write(inode, ip->i_d.di_size); | ||
| 795 | inode->i_atime.tv_sec = ip->i_d.di_atime.t_sec; | ||
| 796 | inode->i_atime.tv_nsec = ip->i_d.di_atime.t_nsec; | ||
| 797 | inode->i_mtime.tv_sec = ip->i_d.di_mtime.t_sec; | ||
| 798 | inode->i_mtime.tv_nsec = ip->i_d.di_mtime.t_nsec; | ||
| 799 | inode->i_ctime.tv_sec = ip->i_d.di_ctime.t_sec; | ||
| 800 | inode->i_ctime.tv_nsec = ip->i_d.di_ctime.t_nsec; | ||
| 801 | xfs_diflags_to_iflags(inode, ip); | ||
| 802 | xfs_iflags_clear(ip, XFS_IMODIFIED); | ||
| 803 | |||
| 804 | switch (inode->i_mode & S_IFMT) { | ||
| 805 | case S_IFREG: | ||
| 806 | inode->i_op = &xfs_inode_operations; | ||
| 807 | inode->i_fop = &xfs_file_operations; | ||
| 808 | inode->i_mapping->a_ops = &xfs_address_space_operations; | ||
| 809 | break; | ||
| 810 | case S_IFDIR: | ||
| 811 | if (xfs_sb_version_hasasciici(&XFS_M(inode->i_sb)->m_sb)) | ||
| 812 | inode->i_op = &xfs_dir_ci_inode_operations; | ||
| 813 | else | ||
| 814 | inode->i_op = &xfs_dir_inode_operations; | ||
| 815 | inode->i_fop = &xfs_dir_file_operations; | ||
| 816 | break; | ||
| 817 | case S_IFLNK: | ||
| 818 | inode->i_op = &xfs_symlink_inode_operations; | ||
| 819 | if (!(ip->i_df.if_flags & XFS_IFINLINE)) | ||
| 820 | inode->i_mapping->a_ops = &xfs_address_space_operations; | ||
| 821 | break; | ||
| 822 | default: | ||
| 823 | inode->i_op = &xfs_inode_operations; | ||
| 824 | init_special_inode(inode, inode->i_mode, inode->i_rdev); | ||
| 825 | break; | ||
| 826 | } | ||
| 827 | |||
| 828 | xfs_iflags_clear(ip, XFS_INEW); | ||
| 829 | barrier(); | ||
| 830 | |||
| 831 | unlock_new_inode(inode); | ||
| 832 | } | ||
diff --git a/fs/xfs/linux-2.6/xfs_iops.h b/fs/xfs/linux-2.6/xfs_iops.h index d97ba934a2ac..8b1a1e31dc21 100644 --- a/fs/xfs/linux-2.6/xfs_iops.h +++ b/fs/xfs/linux-2.6/xfs_iops.h | |||
| @@ -18,10 +18,7 @@ | |||
| 18 | #ifndef __XFS_IOPS_H__ | 18 | #ifndef __XFS_IOPS_H__ |
| 19 | #define __XFS_IOPS_H__ | 19 | #define __XFS_IOPS_H__ |
| 20 | 20 | ||
| 21 | extern const struct inode_operations xfs_inode_operations; | 21 | struct xfs_inode; |
| 22 | extern const struct inode_operations xfs_dir_inode_operations; | ||
| 23 | extern const struct inode_operations xfs_dir_ci_inode_operations; | ||
| 24 | extern const struct inode_operations xfs_symlink_inode_operations; | ||
| 25 | 22 | ||
| 26 | extern const struct file_operations xfs_file_operations; | 23 | extern const struct file_operations xfs_file_operations; |
| 27 | extern const struct file_operations xfs_dir_file_operations; | 24 | extern const struct file_operations xfs_dir_file_operations; |
| @@ -29,14 +26,6 @@ extern const struct file_operations xfs_invis_file_operations; | |||
| 29 | 26 | ||
| 30 | extern ssize_t xfs_vn_listxattr(struct dentry *, char *data, size_t size); | 27 | extern ssize_t xfs_vn_listxattr(struct dentry *, char *data, size_t size); |
| 31 | 28 | ||
| 32 | struct xfs_inode; | 29 | extern void xfs_setup_inode(struct xfs_inode *); |
| 33 | extern void xfs_ichgtime(struct xfs_inode *, int); | ||
| 34 | extern void xfs_ichgtime_fast(struct xfs_inode *, struct inode *, int); | ||
| 35 | |||
| 36 | #define xfs_vtoi(vp) \ | ||
| 37 | ((struct xfs_inode *)vn_to_inode(vp)->i_private) | ||
| 38 | |||
| 39 | #define XFS_I(inode) \ | ||
| 40 | ((struct xfs_inode *)(inode)->i_private) | ||
| 41 | 30 | ||
| 42 | #endif /* __XFS_IOPS_H__ */ | 31 | #endif /* __XFS_IOPS_H__ */ |
diff --git a/fs/xfs/linux-2.6/xfs_linux.h b/fs/xfs/linux-2.6/xfs_linux.h index 4d45d9351a6c..cc0f7b3a9795 100644 --- a/fs/xfs/linux-2.6/xfs_linux.h +++ b/fs/xfs/linux-2.6/xfs_linux.h | |||
| @@ -45,13 +45,13 @@ | |||
| 45 | #include <mrlock.h> | 45 | #include <mrlock.h> |
| 46 | #include <sv.h> | 46 | #include <sv.h> |
| 47 | #include <mutex.h> | 47 | #include <mutex.h> |
| 48 | #include <sema.h> | ||
| 49 | #include <time.h> | 48 | #include <time.h> |
| 50 | 49 | ||
| 51 | #include <support/ktrace.h> | 50 | #include <support/ktrace.h> |
| 52 | #include <support/debug.h> | 51 | #include <support/debug.h> |
| 53 | #include <support/uuid.h> | 52 | #include <support/uuid.h> |
| 54 | 53 | ||
| 54 | #include <linux/semaphore.h> | ||
| 55 | #include <linux/mm.h> | 55 | #include <linux/mm.h> |
| 56 | #include <linux/kernel.h> | 56 | #include <linux/kernel.h> |
| 57 | #include <linux/blkdev.h> | 57 | #include <linux/blkdev.h> |
| @@ -126,8 +126,6 @@ | |||
| 126 | 126 | ||
| 127 | #define current_cpu() (raw_smp_processor_id()) | 127 | #define current_cpu() (raw_smp_processor_id()) |
| 128 | #define current_pid() (current->pid) | 128 | #define current_pid() (current->pid) |
| 129 | #define current_fsuid(cred) (current->fsuid) | ||
| 130 | #define current_fsgid(cred) (current->fsgid) | ||
| 131 | #define current_test_flags(f) (current->flags & (f)) | 129 | #define current_test_flags(f) (current->flags & (f)) |
| 132 | #define current_set_flags_nested(sp, f) \ | 130 | #define current_set_flags_nested(sp, f) \ |
| 133 | (*(sp) = current->flags, current->flags |= (f)) | 131 | (*(sp) = current->flags, current->flags |= (f)) |
| @@ -180,7 +178,7 @@ | |||
| 180 | #define xfs_sort(a,n,s,fn) sort(a,n,s,fn,NULL) | 178 | #define xfs_sort(a,n,s,fn) sort(a,n,s,fn,NULL) |
| 181 | #define xfs_stack_trace() dump_stack() | 179 | #define xfs_stack_trace() dump_stack() |
| 182 | #define xfs_itruncate_data(ip, off) \ | 180 | #define xfs_itruncate_data(ip, off) \ |
| 183 | (-vmtruncate(vn_to_inode(XFS_ITOV(ip)), (off))) | 181 | (-vmtruncate(VFS_I(ip), (off))) |
| 184 | 182 | ||
| 185 | 183 | ||
| 186 | /* Move the kernel do_div definition off to one side */ | 184 | /* Move the kernel do_div definition off to one side */ |
diff --git a/fs/xfs/linux-2.6/xfs_lrw.c b/fs/xfs/linux-2.6/xfs_lrw.c index 82333b3e118e..1957e5357d04 100644 --- a/fs/xfs/linux-2.6/xfs_lrw.c +++ b/fs/xfs/linux-2.6/xfs_lrw.c | |||
| @@ -137,7 +137,7 @@ xfs_iozero( | |||
| 137 | struct address_space *mapping; | 137 | struct address_space *mapping; |
| 138 | int status; | 138 | int status; |
| 139 | 139 | ||
| 140 | mapping = ip->i_vnode->i_mapping; | 140 | mapping = VFS_I(ip)->i_mapping; |
| 141 | do { | 141 | do { |
| 142 | unsigned offset, bytes; | 142 | unsigned offset, bytes; |
| 143 | void *fsdata; | 143 | void *fsdata; |
| @@ -674,9 +674,7 @@ start: | |||
| 674 | */ | 674 | */ |
| 675 | if (likely(!(ioflags & IO_INVIS) && | 675 | if (likely(!(ioflags & IO_INVIS) && |
| 676 | !mnt_want_write(file->f_path.mnt))) { | 676 | !mnt_want_write(file->f_path.mnt))) { |
| 677 | file_update_time(file); | 677 | xfs_ichgtime(xip, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); |
| 678 | xfs_ichgtime_fast(xip, inode, | ||
| 679 | XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); | ||
| 680 | mnt_drop_write(file->f_path.mnt); | 678 | mnt_drop_write(file->f_path.mnt); |
| 681 | } | 679 | } |
| 682 | 680 | ||
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c index 30ae96397e31..73c65f19e549 100644 --- a/fs/xfs/linux-2.6/xfs_super.c +++ b/fs/xfs/linux-2.6/xfs_super.c | |||
| @@ -581,118 +581,6 @@ xfs_max_file_offset( | |||
| 581 | return (((__uint64_t)pagefactor) << bitshift) - 1; | 581 | return (((__uint64_t)pagefactor) << bitshift) - 1; |
| 582 | } | 582 | } |
| 583 | 583 | ||
| 584 | STATIC_INLINE void | ||
| 585 | xfs_set_inodeops( | ||
| 586 | struct inode *inode) | ||
| 587 | { | ||
| 588 | switch (inode->i_mode & S_IFMT) { | ||
| 589 | case S_IFREG: | ||
| 590 | inode->i_op = &xfs_inode_operations; | ||
| 591 | inode->i_fop = &xfs_file_operations; | ||
| 592 | inode->i_mapping->a_ops = &xfs_address_space_operations; | ||
| 593 | break; | ||
| 594 | case S_IFDIR: | ||
| 595 | if (xfs_sb_version_hasasciici(&XFS_M(inode->i_sb)->m_sb)) | ||
| 596 | inode->i_op = &xfs_dir_ci_inode_operations; | ||
| 597 | else | ||
| 598 | inode->i_op = &xfs_dir_inode_operations; | ||
| 599 | inode->i_fop = &xfs_dir_file_operations; | ||
| 600 | break; | ||
| 601 | case S_IFLNK: | ||
| 602 | inode->i_op = &xfs_symlink_inode_operations; | ||
| 603 | if (!(XFS_I(inode)->i_df.if_flags & XFS_IFINLINE)) | ||
| 604 | inode->i_mapping->a_ops = &xfs_address_space_operations; | ||
| 605 | break; | ||
| 606 | default: | ||
| 607 | inode->i_op = &xfs_inode_operations; | ||
| 608 | init_special_inode(inode, inode->i_mode, inode->i_rdev); | ||
| 609 | break; | ||
| 610 | } | ||
| 611 | } | ||
| 612 | |||
| 613 | STATIC_INLINE void | ||
| 614 | xfs_revalidate_inode( | ||
| 615 | xfs_mount_t *mp, | ||
| 616 | bhv_vnode_t *vp, | ||
| 617 | xfs_inode_t *ip) | ||
| 618 | { | ||
| 619 | struct inode *inode = vn_to_inode(vp); | ||
| 620 | |||
| 621 | inode->i_mode = ip->i_d.di_mode; | ||
| 622 | inode->i_nlink = ip->i_d.di_nlink; | ||
| 623 | inode->i_uid = ip->i_d.di_uid; | ||
| 624 | inode->i_gid = ip->i_d.di_gid; | ||
| 625 | |||
| 626 | switch (inode->i_mode & S_IFMT) { | ||
| 627 | case S_IFBLK: | ||
| 628 | case S_IFCHR: | ||
| 629 | inode->i_rdev = | ||
| 630 | MKDEV(sysv_major(ip->i_df.if_u2.if_rdev) & 0x1ff, | ||
| 631 | sysv_minor(ip->i_df.if_u2.if_rdev)); | ||
| 632 | break; | ||
| 633 | default: | ||
| 634 | inode->i_rdev = 0; | ||
| 635 | break; | ||
| 636 | } | ||
| 637 | |||
| 638 | inode->i_generation = ip->i_d.di_gen; | ||
| 639 | i_size_write(inode, ip->i_d.di_size); | ||
| 640 | inode->i_atime.tv_sec = ip->i_d.di_atime.t_sec; | ||
| 641 | inode->i_atime.tv_nsec = ip->i_d.di_atime.t_nsec; | ||
| 642 | inode->i_mtime.tv_sec = ip->i_d.di_mtime.t_sec; | ||
| 643 | inode->i_mtime.tv_nsec = ip->i_d.di_mtime.t_nsec; | ||
| 644 | inode->i_ctime.tv_sec = ip->i_d.di_ctime.t_sec; | ||
| 645 | inode->i_ctime.tv_nsec = ip->i_d.di_ctime.t_nsec; | ||
| 646 | if (ip->i_d.di_flags & XFS_DIFLAG_IMMUTABLE) | ||
| 647 | inode->i_flags |= S_IMMUTABLE; | ||
| 648 | else | ||
| 649 | inode->i_flags &= ~S_IMMUTABLE; | ||
| 650 | if (ip->i_d.di_flags & XFS_DIFLAG_APPEND) | ||
| 651 | inode->i_flags |= S_APPEND; | ||
| 652 | else | ||
| 653 | inode->i_flags &= ~S_APPEND; | ||
| 654 | if (ip->i_d.di_flags & XFS_DIFLAG_SYNC) | ||
| 655 | inode->i_flags |= S_SYNC; | ||
| 656 | else | ||
| 657 | inode->i_flags &= ~S_SYNC; | ||
| 658 | if (ip->i_d.di_flags & XFS_DIFLAG_NOATIME) | ||
| 659 | inode->i_flags |= S_NOATIME; | ||
| 660 | else | ||
| 661 | inode->i_flags &= ~S_NOATIME; | ||
| 662 | xfs_iflags_clear(ip, XFS_IMODIFIED); | ||
| 663 | } | ||
| 664 | |||
| 665 | void | ||
| 666 | xfs_initialize_vnode( | ||
| 667 | struct xfs_mount *mp, | ||
| 668 | bhv_vnode_t *vp, | ||
| 669 | struct xfs_inode *ip) | ||
| 670 | { | ||
| 671 | struct inode *inode = vn_to_inode(vp); | ||
| 672 | |||
| 673 | if (!ip->i_vnode) { | ||
| 674 | ip->i_vnode = vp; | ||
| 675 | inode->i_private = ip; | ||
| 676 | } | ||
| 677 | |||
| 678 | /* | ||
| 679 | * We need to set the ops vectors, and unlock the inode, but if | ||
| 680 | * we have been called during the new inode create process, it is | ||
| 681 | * too early to fill in the Linux inode. We will get called a | ||
| 682 | * second time once the inode is properly set up, and then we can | ||
| 683 | * finish our work. | ||
| 684 | */ | ||
| 685 | if (ip->i_d.di_mode != 0 && (inode->i_state & I_NEW)) { | ||
| 686 | xfs_revalidate_inode(mp, vp, ip); | ||
| 687 | xfs_set_inodeops(inode); | ||
| 688 | |||
| 689 | xfs_iflags_clear(ip, XFS_INEW); | ||
| 690 | barrier(); | ||
| 691 | |||
| 692 | unlock_new_inode(inode); | ||
| 693 | } | ||
| 694 | } | ||
| 695 | |||
| 696 | int | 584 | int |
| 697 | xfs_blkdev_get( | 585 | xfs_blkdev_get( |
| 698 | xfs_mount_t *mp, | 586 | xfs_mount_t *mp, |
| @@ -982,26 +870,21 @@ STATIC struct inode * | |||
| 982 | xfs_fs_alloc_inode( | 870 | xfs_fs_alloc_inode( |
| 983 | struct super_block *sb) | 871 | struct super_block *sb) |
| 984 | { | 872 | { |
| 985 | bhv_vnode_t *vp; | 873 | return kmem_zone_alloc(xfs_vnode_zone, KM_SLEEP); |
| 986 | |||
| 987 | vp = kmem_zone_alloc(xfs_vnode_zone, KM_SLEEP); | ||
| 988 | if (unlikely(!vp)) | ||
| 989 | return NULL; | ||
| 990 | return vn_to_inode(vp); | ||
| 991 | } | 874 | } |
| 992 | 875 | ||
| 993 | STATIC void | 876 | STATIC void |
| 994 | xfs_fs_destroy_inode( | 877 | xfs_fs_destroy_inode( |
| 995 | struct inode *inode) | 878 | struct inode *inode) |
| 996 | { | 879 | { |
| 997 | kmem_zone_free(xfs_vnode_zone, vn_from_inode(inode)); | 880 | kmem_zone_free(xfs_vnode_zone, inode); |
| 998 | } | 881 | } |
| 999 | 882 | ||
| 1000 | STATIC void | 883 | STATIC void |
| 1001 | xfs_fs_inode_init_once( | 884 | xfs_fs_inode_init_once( |
| 1002 | void *vnode) | 885 | void *vnode) |
| 1003 | { | 886 | { |
| 1004 | inode_init_once(vn_to_inode((bhv_vnode_t *)vnode)); | 887 | inode_init_once((struct inode *)vnode); |
| 1005 | } | 888 | } |
| 1006 | 889 | ||
| 1007 | /* | 890 | /* |
| @@ -1106,7 +989,7 @@ void | |||
| 1106 | xfs_flush_inode( | 989 | xfs_flush_inode( |
| 1107 | xfs_inode_t *ip) | 990 | xfs_inode_t *ip) |
| 1108 | { | 991 | { |
| 1109 | struct inode *inode = ip->i_vnode; | 992 | struct inode *inode = VFS_I(ip); |
| 1110 | 993 | ||
| 1111 | igrab(inode); | 994 | igrab(inode); |
| 1112 | xfs_syncd_queue_work(ip->i_mount, inode, xfs_flush_inode_work); | 995 | xfs_syncd_queue_work(ip->i_mount, inode, xfs_flush_inode_work); |
| @@ -1131,7 +1014,7 @@ void | |||
| 1131 | xfs_flush_device( | 1014 | xfs_flush_device( |
| 1132 | xfs_inode_t *ip) | 1015 | xfs_inode_t *ip) |
| 1133 | { | 1016 | { |
| 1134 | struct inode *inode = vn_to_inode(XFS_ITOV(ip)); | 1017 | struct inode *inode = VFS_I(ip); |
| 1135 | 1018 | ||
| 1136 | igrab(inode); | 1019 | igrab(inode); |
| 1137 | xfs_syncd_queue_work(ip->i_mount, inode, xfs_flush_device_work); | 1020 | xfs_syncd_queue_work(ip->i_mount, inode, xfs_flush_device_work); |
| @@ -1201,6 +1084,15 @@ xfssyncd( | |||
| 1201 | } | 1084 | } |
| 1202 | 1085 | ||
| 1203 | STATIC void | 1086 | STATIC void |
| 1087 | xfs_free_fsname( | ||
| 1088 | struct xfs_mount *mp) | ||
| 1089 | { | ||
| 1090 | kfree(mp->m_fsname); | ||
| 1091 | kfree(mp->m_rtname); | ||
| 1092 | kfree(mp->m_logname); | ||
| 1093 | } | ||
| 1094 | |||
| 1095 | STATIC void | ||
| 1204 | xfs_fs_put_super( | 1096 | xfs_fs_put_super( |
| 1205 | struct super_block *sb) | 1097 | struct super_block *sb) |
| 1206 | { | 1098 | { |
| @@ -1239,8 +1131,6 @@ xfs_fs_put_super( | |||
| 1239 | error = xfs_unmount_flush(mp, 0); | 1131 | error = xfs_unmount_flush(mp, 0); |
| 1240 | WARN_ON(error); | 1132 | WARN_ON(error); |
| 1241 | 1133 | ||
| 1242 | IRELE(rip); | ||
| 1243 | |||
| 1244 | /* | 1134 | /* |
| 1245 | * If we're forcing a shutdown, typically because of a media error, | 1135 | * If we're forcing a shutdown, typically because of a media error, |
| 1246 | * we want to make sure we invalidate dirty pages that belong to | 1136 | * we want to make sure we invalidate dirty pages that belong to |
| @@ -1257,10 +1147,12 @@ xfs_fs_put_super( | |||
| 1257 | } | 1147 | } |
| 1258 | 1148 | ||
| 1259 | xfs_unmountfs(mp); | 1149 | xfs_unmountfs(mp); |
| 1150 | xfs_freesb(mp); | ||
| 1260 | xfs_icsb_destroy_counters(mp); | 1151 | xfs_icsb_destroy_counters(mp); |
| 1261 | xfs_close_devices(mp); | 1152 | xfs_close_devices(mp); |
| 1262 | xfs_qmops_put(mp); | 1153 | xfs_qmops_put(mp); |
| 1263 | xfs_dmops_put(mp); | 1154 | xfs_dmops_put(mp); |
| 1155 | xfs_free_fsname(mp); | ||
| 1264 | kfree(mp); | 1156 | kfree(mp); |
| 1265 | } | 1157 | } |
| 1266 | 1158 | ||
| @@ -1517,6 +1409,8 @@ xfs_start_flags( | |||
| 1517 | struct xfs_mount_args *ap, | 1409 | struct xfs_mount_args *ap, |
| 1518 | struct xfs_mount *mp) | 1410 | struct xfs_mount *mp) |
| 1519 | { | 1411 | { |
| 1412 | int error; | ||
| 1413 | |||
| 1520 | /* Values are in BBs */ | 1414 | /* Values are in BBs */ |
| 1521 | if ((ap->flags & XFSMNT_NOALIGN) != XFSMNT_NOALIGN) { | 1415 | if ((ap->flags & XFSMNT_NOALIGN) != XFSMNT_NOALIGN) { |
| 1522 | /* | 1416 | /* |
| @@ -1549,17 +1443,27 @@ xfs_start_flags( | |||
| 1549 | ap->logbufsize); | 1443 | ap->logbufsize); |
| 1550 | return XFS_ERROR(EINVAL); | 1444 | return XFS_ERROR(EINVAL); |
| 1551 | } | 1445 | } |
| 1446 | |||
| 1447 | error = ENOMEM; | ||
| 1448 | |||
| 1552 | mp->m_logbsize = ap->logbufsize; | 1449 | mp->m_logbsize = ap->logbufsize; |
| 1553 | mp->m_fsname_len = strlen(ap->fsname) + 1; | 1450 | mp->m_fsname_len = strlen(ap->fsname) + 1; |
| 1554 | mp->m_fsname = kmem_alloc(mp->m_fsname_len, KM_SLEEP); | 1451 | |
| 1555 | strcpy(mp->m_fsname, ap->fsname); | 1452 | mp->m_fsname = kstrdup(ap->fsname, GFP_KERNEL); |
| 1453 | if (!mp->m_fsname) | ||
| 1454 | goto out; | ||
| 1455 | |||
| 1556 | if (ap->rtname[0]) { | 1456 | if (ap->rtname[0]) { |
| 1557 | mp->m_rtname = kmem_alloc(strlen(ap->rtname) + 1, KM_SLEEP); | 1457 | mp->m_rtname = kstrdup(ap->rtname, GFP_KERNEL); |
| 1558 | strcpy(mp->m_rtname, ap->rtname); | 1458 | if (!mp->m_rtname) |
| 1459 | goto out_free_fsname; | ||
| 1460 | |||
| 1559 | } | 1461 | } |
| 1462 | |||
| 1560 | if (ap->logname[0]) { | 1463 | if (ap->logname[0]) { |
| 1561 | mp->m_logname = kmem_alloc(strlen(ap->logname) + 1, KM_SLEEP); | 1464 | mp->m_logname = kstrdup(ap->logname, GFP_KERNEL); |
| 1562 | strcpy(mp->m_logname, ap->logname); | 1465 | if (!mp->m_logname) |
| 1466 | goto out_free_rtname; | ||
| 1563 | } | 1467 | } |
| 1564 | 1468 | ||
| 1565 | if (ap->flags & XFSMNT_WSYNC) | 1469 | if (ap->flags & XFSMNT_WSYNC) |
| @@ -1632,6 +1536,14 @@ xfs_start_flags( | |||
| 1632 | if (ap->flags & XFSMNT_DMAPI) | 1536 | if (ap->flags & XFSMNT_DMAPI) |
| 1633 | mp->m_flags |= XFS_MOUNT_DMAPI; | 1537 | mp->m_flags |= XFS_MOUNT_DMAPI; |
| 1634 | return 0; | 1538 | return 0; |
| 1539 | |||
| 1540 | |||
| 1541 | out_free_rtname: | ||
| 1542 | kfree(mp->m_rtname); | ||
| 1543 | out_free_fsname: | ||
| 1544 | kfree(mp->m_fsname); | ||
| 1545 | out: | ||
| 1546 | return error; | ||
| 1635 | } | 1547 | } |
| 1636 | 1548 | ||
| 1637 | /* | 1549 | /* |
| @@ -1792,10 +1704,10 @@ xfs_fs_fill_super( | |||
| 1792 | */ | 1704 | */ |
| 1793 | error = xfs_start_flags(args, mp); | 1705 | error = xfs_start_flags(args, mp); |
| 1794 | if (error) | 1706 | if (error) |
| 1795 | goto out_destroy_counters; | 1707 | goto out_free_fsname; |
| 1796 | error = xfs_readsb(mp, flags); | 1708 | error = xfs_readsb(mp, flags); |
| 1797 | if (error) | 1709 | if (error) |
| 1798 | goto out_destroy_counters; | 1710 | goto out_free_fsname; |
| 1799 | error = xfs_finish_flags(args, mp); | 1711 | error = xfs_finish_flags(args, mp); |
| 1800 | if (error) | 1712 | if (error) |
| 1801 | goto out_free_sb; | 1713 | goto out_free_sb; |
| @@ -1811,7 +1723,7 @@ xfs_fs_fill_super( | |||
| 1811 | if (error) | 1723 | if (error) |
| 1812 | goto out_free_sb; | 1724 | goto out_free_sb; |
| 1813 | 1725 | ||
| 1814 | error = xfs_mountfs(mp, flags); | 1726 | error = xfs_mountfs(mp); |
| 1815 | if (error) | 1727 | if (error) |
| 1816 | goto out_filestream_unmount; | 1728 | goto out_filestream_unmount; |
| 1817 | 1729 | ||
| @@ -1825,7 +1737,7 @@ xfs_fs_fill_super( | |||
| 1825 | sb->s_time_gran = 1; | 1737 | sb->s_time_gran = 1; |
| 1826 | set_posix_acl_flag(sb); | 1738 | set_posix_acl_flag(sb); |
| 1827 | 1739 | ||
| 1828 | root = igrab(mp->m_rootip->i_vnode); | 1740 | root = igrab(VFS_I(mp->m_rootip)); |
| 1829 | if (!root) { | 1741 | if (!root) { |
| 1830 | error = ENOENT; | 1742 | error = ENOENT; |
| 1831 | goto fail_unmount; | 1743 | goto fail_unmount; |
| @@ -1857,7 +1769,8 @@ xfs_fs_fill_super( | |||
| 1857 | xfs_filestream_unmount(mp); | 1769 | xfs_filestream_unmount(mp); |
| 1858 | out_free_sb: | 1770 | out_free_sb: |
| 1859 | xfs_freesb(mp); | 1771 | xfs_freesb(mp); |
| 1860 | out_destroy_counters: | 1772 | out_free_fsname: |
| 1773 | xfs_free_fsname(mp); | ||
| 1861 | xfs_icsb_destroy_counters(mp); | 1774 | xfs_icsb_destroy_counters(mp); |
| 1862 | xfs_close_devices(mp); | 1775 | xfs_close_devices(mp); |
| 1863 | out_put_qmops: | 1776 | out_put_qmops: |
| @@ -1890,10 +1803,8 @@ xfs_fs_fill_super( | |||
| 1890 | error = xfs_unmount_flush(mp, 0); | 1803 | error = xfs_unmount_flush(mp, 0); |
| 1891 | WARN_ON(error); | 1804 | WARN_ON(error); |
| 1892 | 1805 | ||
| 1893 | IRELE(mp->m_rootip); | ||
| 1894 | |||
| 1895 | xfs_unmountfs(mp); | 1806 | xfs_unmountfs(mp); |
| 1896 | goto out_destroy_counters; | 1807 | goto out_free_sb; |
| 1897 | } | 1808 | } |
| 1898 | 1809 | ||
| 1899 | STATIC int | 1810 | STATIC int |
| @@ -2014,7 +1925,7 @@ xfs_free_trace_bufs(void) | |||
| 2014 | STATIC int __init | 1925 | STATIC int __init |
| 2015 | xfs_init_zones(void) | 1926 | xfs_init_zones(void) |
| 2016 | { | 1927 | { |
| 2017 | xfs_vnode_zone = kmem_zone_init_flags(sizeof(bhv_vnode_t), "xfs_vnode", | 1928 | xfs_vnode_zone = kmem_zone_init_flags(sizeof(struct inode), "xfs_vnode", |
| 2018 | KM_ZONE_HWALIGN | KM_ZONE_RECLAIM | | 1929 | KM_ZONE_HWALIGN | KM_ZONE_RECLAIM | |
| 2019 | KM_ZONE_SPREAD, | 1930 | KM_ZONE_SPREAD, |
| 2020 | xfs_fs_inode_init_once); | 1931 | xfs_fs_inode_init_once); |
diff --git a/fs/xfs/linux-2.6/xfs_super.h b/fs/xfs/linux-2.6/xfs_super.h index b7d13da01bd6..fe2ef4e6a0f9 100644 --- a/fs/xfs/linux-2.6/xfs_super.h +++ b/fs/xfs/linux-2.6/xfs_super.h | |||
| @@ -101,9 +101,6 @@ struct block_device; | |||
| 101 | 101 | ||
| 102 | extern __uint64_t xfs_max_file_offset(unsigned int); | 102 | extern __uint64_t xfs_max_file_offset(unsigned int); |
| 103 | 103 | ||
| 104 | extern void xfs_initialize_vnode(struct xfs_mount *mp, bhv_vnode_t *vp, | ||
| 105 | struct xfs_inode *ip); | ||
| 106 | |||
| 107 | extern void xfs_flush_inode(struct xfs_inode *); | 104 | extern void xfs_flush_inode(struct xfs_inode *); |
| 108 | extern void xfs_flush_device(struct xfs_inode *); | 105 | extern void xfs_flush_device(struct xfs_inode *); |
| 109 | 106 | ||
diff --git a/fs/xfs/linux-2.6/xfs_vnode.c b/fs/xfs/linux-2.6/xfs_vnode.c index 25488b6d9881..b52528bbbfff 100644 --- a/fs/xfs/linux-2.6/xfs_vnode.c +++ b/fs/xfs/linux-2.6/xfs_vnode.c | |||
| @@ -33,7 +33,7 @@ | |||
| 33 | 33 | ||
| 34 | 34 | ||
| 35 | /* | 35 | /* |
| 36 | * Dedicated vnode inactive/reclaim sync semaphores. | 36 | * Dedicated vnode inactive/reclaim sync wait queues. |
| 37 | * Prime number of hash buckets since address is used as the key. | 37 | * Prime number of hash buckets since address is used as the key. |
| 38 | */ | 38 | */ |
| 39 | #define NVSYNC 37 | 39 | #define NVSYNC 37 |
| @@ -82,24 +82,6 @@ vn_ioerror( | |||
| 82 | xfs_do_force_shutdown(ip->i_mount, SHUTDOWN_DEVICE_REQ, f, l); | 82 | xfs_do_force_shutdown(ip->i_mount, SHUTDOWN_DEVICE_REQ, f, l); |
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | |||
| 86 | /* | ||
| 87 | * Add a reference to a referenced vnode. | ||
| 88 | */ | ||
| 89 | bhv_vnode_t * | ||
| 90 | vn_hold( | ||
| 91 | bhv_vnode_t *vp) | ||
| 92 | { | ||
| 93 | struct inode *inode; | ||
| 94 | |||
| 95 | XFS_STATS_INC(vn_hold); | ||
| 96 | |||
| 97 | inode = igrab(vn_to_inode(vp)); | ||
| 98 | ASSERT(inode); | ||
| 99 | |||
| 100 | return vp; | ||
| 101 | } | ||
| 102 | |||
| 103 | #ifdef XFS_INODE_TRACE | 85 | #ifdef XFS_INODE_TRACE |
| 104 | 86 | ||
| 105 | /* | 87 | /* |
| @@ -108,7 +90,7 @@ vn_hold( | |||
| 108 | */ | 90 | */ |
| 109 | static inline int xfs_icount(struct xfs_inode *ip) | 91 | static inline int xfs_icount(struct xfs_inode *ip) |
| 110 | { | 92 | { |
| 111 | bhv_vnode_t *vp = XFS_ITOV_NULL(ip); | 93 | struct inode *vp = VFS_I(ip); |
| 112 | 94 | ||
| 113 | if (vp) | 95 | if (vp) |
| 114 | return vn_count(vp); | 96 | return vn_count(vp); |
diff --git a/fs/xfs/linux-2.6/xfs_vnode.h b/fs/xfs/linux-2.6/xfs_vnode.h index 41ca2cec5d31..683ce16210ff 100644 --- a/fs/xfs/linux-2.6/xfs_vnode.h +++ b/fs/xfs/linux-2.6/xfs_vnode.h | |||
| @@ -22,20 +22,6 @@ struct file; | |||
| 22 | struct xfs_iomap; | 22 | struct xfs_iomap; |
| 23 | struct attrlist_cursor_kern; | 23 | struct attrlist_cursor_kern; |
| 24 | 24 | ||
| 25 | typedef struct inode bhv_vnode_t; | ||
| 26 | |||
| 27 | /* | ||
| 28 | * Vnode to Linux inode mapping. | ||
| 29 | */ | ||
| 30 | static inline bhv_vnode_t *vn_from_inode(struct inode *inode) | ||
| 31 | { | ||
| 32 | return inode; | ||
| 33 | } | ||
| 34 | static inline struct inode *vn_to_inode(bhv_vnode_t *vnode) | ||
| 35 | { | ||
| 36 | return vnode; | ||
| 37 | } | ||
| 38 | |||
| 39 | /* | 25 | /* |
| 40 | * Return values for xfs_inactive. A return value of | 26 | * Return values for xfs_inactive. A return value of |
| 41 | * VN_INACTIVE_NOCACHE implies that the file system behavior | 27 | * VN_INACTIVE_NOCACHE implies that the file system behavior |
| @@ -76,57 +62,52 @@ extern void vn_iowait(struct xfs_inode *ip); | |||
| 76 | extern void vn_iowake(struct xfs_inode *ip); | 62 | extern void vn_iowake(struct xfs_inode *ip); |
| 77 | extern void vn_ioerror(struct xfs_inode *ip, int error, char *f, int l); | 63 | extern void vn_ioerror(struct xfs_inode *ip, int error, char *f, int l); |
| 78 | 64 | ||
| 79 | static inline int vn_count(bhv_vnode_t *vp) | 65 | static inline int vn_count(struct inode *vp) |
| 80 | { | 66 | { |
| 81 | return atomic_read(&vn_to_inode(vp)->i_count); | 67 | return atomic_read(&vp->i_count); |
| 82 | } | 68 | } |
| 83 | 69 | ||
| 84 | /* | 70 | #define IHOLD(ip) \ |
| 85 | * Vnode reference counting functions (and macros for compatibility). | 71 | do { \ |
| 86 | */ | 72 | ASSERT(atomic_read(&VFS_I(ip)->i_count) > 0) ; \ |
| 87 | extern bhv_vnode_t *vn_hold(bhv_vnode_t *); | 73 | atomic_inc(&(VFS_I(ip)->i_count)); \ |
| 74 | xfs_itrace_hold((ip), __FILE__, __LINE__, (inst_t *)__return_address); \ | ||
| 75 | } while (0) | ||
| 88 | 76 | ||
| 89 | #if defined(XFS_INODE_TRACE) | 77 | #define IRELE(ip) \ |
| 90 | #define VN_HOLD(vp) \ | 78 | do { \ |
| 91 | ((void)vn_hold(vp), \ | 79 | xfs_itrace_rele((ip), __FILE__, __LINE__, (inst_t *)__return_address); \ |
| 92 | xfs_itrace_hold(xfs_vtoi(vp), __FILE__, __LINE__, (inst_t *)__return_address)) | 80 | iput(VFS_I(ip)); \ |
| 93 | #define VN_RELE(vp) \ | 81 | } while (0) |
| 94 | (xfs_itrace_rele(xfs_vtoi(vp), __FILE__, __LINE__, (inst_t *)__return_address), \ | ||
| 95 | iput(vn_to_inode(vp))) | ||
| 96 | #else | ||
| 97 | #define VN_HOLD(vp) ((void)vn_hold(vp)) | ||
| 98 | #define VN_RELE(vp) (iput(vn_to_inode(vp))) | ||
| 99 | #endif | ||
| 100 | 82 | ||
| 101 | static inline bhv_vnode_t *vn_grab(bhv_vnode_t *vp) | 83 | static inline struct inode *vn_grab(struct inode *vp) |
| 102 | { | 84 | { |
| 103 | struct inode *inode = igrab(vn_to_inode(vp)); | 85 | return igrab(vp); |
| 104 | return inode ? vn_from_inode(inode) : NULL; | ||
| 105 | } | 86 | } |
| 106 | 87 | ||
| 107 | /* | 88 | /* |
| 108 | * Dealing with bad inodes | 89 | * Dealing with bad inodes |
| 109 | */ | 90 | */ |
| 110 | static inline int VN_BAD(bhv_vnode_t *vp) | 91 | static inline int VN_BAD(struct inode *vp) |
| 111 | { | 92 | { |
| 112 | return is_bad_inode(vn_to_inode(vp)); | 93 | return is_bad_inode(vp); |
| 113 | } | 94 | } |
| 114 | 95 | ||
| 115 | /* | 96 | /* |
| 116 | * Extracting atime values in various formats | 97 | * Extracting atime values in various formats |
| 117 | */ | 98 | */ |
| 118 | static inline void vn_atime_to_bstime(bhv_vnode_t *vp, xfs_bstime_t *bs_atime) | 99 | static inline void vn_atime_to_bstime(struct inode *vp, xfs_bstime_t *bs_atime) |
| 119 | { | 100 | { |
| 120 | bs_atime->tv_sec = vp->i_atime.tv_sec; | 101 | bs_atime->tv_sec = vp->i_atime.tv_sec; |
| 121 | bs_atime->tv_nsec = vp->i_atime.tv_nsec; | 102 | bs_atime->tv_nsec = vp->i_atime.tv_nsec; |
| 122 | } | 103 | } |
| 123 | 104 | ||
| 124 | static inline void vn_atime_to_timespec(bhv_vnode_t *vp, struct timespec *ts) | 105 | static inline void vn_atime_to_timespec(struct inode *vp, struct timespec *ts) |
| 125 | { | 106 | { |
| 126 | *ts = vp->i_atime; | 107 | *ts = vp->i_atime; |
| 127 | } | 108 | } |
| 128 | 109 | ||
| 129 | static inline void vn_atime_to_time_t(bhv_vnode_t *vp, time_t *tt) | 110 | static inline void vn_atime_to_time_t(struct inode *vp, time_t *tt) |
| 130 | { | 111 | { |
| 131 | *tt = vp->i_atime.tv_sec; | 112 | *tt = vp->i_atime.tv_sec; |
| 132 | } | 113 | } |
| @@ -134,9 +115,9 @@ static inline void vn_atime_to_time_t(bhv_vnode_t *vp, time_t *tt) | |||
| 134 | /* | 115 | /* |
| 135 | * Some useful predicates. | 116 | * Some useful predicates. |
| 136 | */ | 117 | */ |
| 137 | #define VN_MAPPED(vp) mapping_mapped(vn_to_inode(vp)->i_mapping) | 118 | #define VN_MAPPED(vp) mapping_mapped(vp->i_mapping) |
| 138 | #define VN_CACHED(vp) (vn_to_inode(vp)->i_mapping->nrpages) | 119 | #define VN_CACHED(vp) (vp->i_mapping->nrpages) |
| 139 | #define VN_DIRTY(vp) mapping_tagged(vn_to_inode(vp)->i_mapping, \ | 120 | #define VN_DIRTY(vp) mapping_tagged(vp->i_mapping, \ |
| 140 | PAGECACHE_TAG_DIRTY) | 121 | PAGECACHE_TAG_DIRTY) |
| 141 | 122 | ||
| 142 | 123 | ||
