Lines Matching defs:inode

35 #include "inode.h"
298 static inline struct inode *ocfs2_lock_res_inode(struct ocfs2_lock_res *lockres)
302 return (struct inode *) lockres->l_priv;
369 static int ocfs2_inode_lock_update(struct inode *inode,
554 struct inode *inode)
574 ocfs2_build_lock_name(type, OCFS2_I(inode)->ip_blkno,
576 ocfs2_lock_res_init_common(OCFS2_SB(inode->i_sb), res, type, ops, inode);
581 struct inode *inode = ocfs2_lock_res_inode(lockres);
583 return OCFS2_SB(inode->i_sb);
618 u64 parent, struct inode *inode)
621 u64 inode_blkno = OCFS2_I(inode)->ip_blkno;
630 * we'll stuff the inode number as a binary value. We still
632 * display, so drop a null byte in there before the inode
652 ocfs2_lock_res_init_common(OCFS2_SB(inode->i_sb), lockres,
732 struct inode *inode = fp->fp_file->f_mapping->host;
733 struct ocfs2_inode_info *oi = OCFS2_I(inode);
737 inode->i_generation, lockres->l_name);
738 ocfs2_lock_res_init_common(OCFS2_SB(inode->i_sb), lockres,
1719 * hashed in the inode hash yet. This can give us a good performance
1722 int ocfs2_create_new_inode_locks(struct inode *inode)
1725 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
1727 BUG_ON(!ocfs2_inode_is_new(inode));
1729 mlog(0, "Inode %llu\n", (unsigned long long)OCFS2_I(inode)->ip_blkno);
1733 * supposed to be a new inode which the cluster doesn't know
1739 ret = ocfs2_create_new_lock(osb, &OCFS2_I(inode)->ip_rw_lockres, 1, 1);
1749 ret = ocfs2_create_new_lock(osb, &OCFS2_I(inode)->ip_inode_lockres, 1, 0);
1755 ret = ocfs2_create_new_lock(osb, &OCFS2_I(inode)->ip_open_lockres, 0, 0);
1763 int ocfs2_rw_lock(struct inode *inode, int write)
1767 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
1769 mlog(0, "inode %llu take %s RW lock\n",
1770 (unsigned long long)OCFS2_I(inode)->ip_blkno,
1776 lockres = &OCFS2_I(inode)->ip_rw_lockres;
1787 int ocfs2_try_rw_lock(struct inode *inode, int write)
1791 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
1793 mlog(0, "inode %llu try to take %s RW lock\n",
1794 (unsigned long long)OCFS2_I(inode)->ip_blkno,
1800 lockres = &OCFS2_I(inode)->ip_rw_lockres;
1808 void ocfs2_rw_unlock(struct inode *inode, int write)
1811 struct ocfs2_lock_res *lockres = &OCFS2_I(inode)->ip_rw_lockres;
1812 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
1814 mlog(0, "inode %llu drop %s RW lock\n",
1815 (unsigned long long)OCFS2_I(inode)->ip_blkno,
1825 int ocfs2_open_lock(struct inode *inode)
1829 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
1831 mlog(0, "inode %llu take PRMODE open lock\n",
1832 (unsigned long long)OCFS2_I(inode)->ip_blkno);
1837 lockres = &OCFS2_I(inode)->ip_open_lockres;
1847 int ocfs2_try_open_lock(struct inode *inode, int write)
1851 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
1853 mlog(0, "inode %llu try to take %s open lock\n",
1854 (unsigned long long)OCFS2_I(inode)->ip_blkno,
1866 lockres = &OCFS2_I(inode)->ip_open_lockres;
1874 * this inode is still in use.
1885 void ocfs2_open_unlock(struct inode *inode)
1887 struct ocfs2_lock_res *lockres = &OCFS2_I(inode)->ip_open_lockres;
1888 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
1890 mlog(0, "inode %llu drop open lock\n",
1891 (unsigned long long)OCFS2_I(inode)->ip_blkno);
2160 static void __ocfs2_stuff_meta_lvb(struct inode *inode)
2162 struct ocfs2_inode_info *oi = OCFS2_I(inode);
2165 struct timespec64 ctime = inode_get_ctime(inode);
2170 * Invalidate the LVB of a deleted inode - this way other
2171 * nodes are forced to go to disk and discover the new inode
2180 lvb->lvb_isize = cpu_to_be64(i_size_read(inode));
2182 lvb->lvb_iuid = cpu_to_be32(i_uid_read(inode));
2183 lvb->lvb_igid = cpu_to_be32(i_gid_read(inode));
2184 lvb->lvb_imode = cpu_to_be16(inode->i_mode);
2185 lvb->lvb_inlink = cpu_to_be16(inode->i_nlink);
2187 cpu_to_be64(ocfs2_pack_timespec(&inode->i_atime));
2191 cpu_to_be64(ocfs2_pack_timespec(&inode->i_mtime));
2194 lvb->lvb_igeneration = cpu_to_be32(inode->i_generation);
2207 static int ocfs2_refresh_inode_from_lvb(struct inode *inode)
2209 struct ocfs2_inode_info *oi = OCFS2_I(inode);
2217 if (inode_wrong_type(inode, be16_to_cpu(lvb->lvb_imode)))
2223 i_size_write(inode, be64_to_cpu(lvb->lvb_isize));
2227 ocfs2_set_inode_flags(inode);
2230 if (S_ISLNK(inode->i_mode) && !oi->ip_clusters)
2231 inode->i_blocks = 0;
2233 inode->i_blocks = ocfs2_inode_sector_count(inode);
2235 i_uid_write(inode, be32_to_cpu(lvb->lvb_iuid));
2236 i_gid_write(inode, be32_to_cpu(lvb->lvb_igid));
2237 inode->i_mode = be16_to_cpu(lvb->lvb_imode);
2238 set_nlink(inode, be16_to_cpu(lvb->lvb_inlink));
2239 ocfs2_unpack_timespec(&inode->i_atime,
2241 ocfs2_unpack_timespec(&inode->i_mtime,
2245 inode_set_ctime_to_ts(inode, ctime);
2250 static inline int ocfs2_meta_lvb_is_trustable(struct inode *inode,
2257 && be32_to_cpu(lvb->lvb_igeneration) == inode->i_generation)
2315 static int ocfs2_inode_lock_update(struct inode *inode,
2319 struct ocfs2_inode_info *oi = OCFS2_I(inode);
2322 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
2329 mlog(0, "Orphaned inode %llu was deleted while we "
2342 * for the inode metadata. */
2343 ocfs2_metadata_cache_purge(INODE_CACHE(inode));
2345 ocfs2_extent_map_trunc(inode, 0);
2347 if (ocfs2_meta_lvb_is_trustable(inode, lockres)) {
2348 mlog(0, "Trusting LVB on inode %llu\n",
2350 status = ocfs2_refresh_inode_from_lvb(inode);
2355 status = ocfs2_read_inode_block(inode, bh);
2361 if (inode_wrong_type(inode, le16_to_cpu(fe->i_mode))) {
2368 * already checked that the inode block is sane.
2370 * We bug on a stale inode here because we checked
2373 * message and can mark the inode before dropping any
2375 mlog_bug_on_msg(inode->i_generation !=
2378 "inode->i_generation: %u\n",
2381 inode->i_generation);
2389 ocfs2_refresh_inode(inode, fe);
2400 static int ocfs2_assign_bh(struct inode *inode,
2415 status = ocfs2_read_inode_block(inode, ret_bh);
2426 int ocfs2_inode_lock_full_nested(struct inode *inode,
2435 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
2438 mlog(0, "inode %llu, take %s META lock\n",
2439 (unsigned long long)OCFS2_I(inode)->ip_blkno,
2459 lockres = &OCFS2_I(inode)->ip_inode_lockres;
2486 * ocfs2_read_locked_inode(). It means we're locking an inode
2490 if (inode->i_state & I_NEW) {
2502 status = ocfs2_inode_lock_update(inode, &local_bh);
2510 status = ocfs2_assign_bh(inode, ret_bh, local_bh);
2524 ocfs2_inode_unlock(inode, ex);
2547 int ocfs2_inode_lock_with_page(struct inode *inode,
2554 ret = ocfs2_inode_lock_full(inode, ret_bh, ex, OCFS2_LOCK_NONBLOCK);
2558 * If we can't get inode lock immediately, we should not return
2564 if (ocfs2_inode_lock(inode, ret_bh, ex) == 0)
2565 ocfs2_inode_unlock(inode, ex);
2572 int ocfs2_inode_lock_atime(struct inode *inode,
2579 ret = ocfs2_inode_lock(inode, NULL, 0);
2581 ret = ocfs2_try_inode_lock(inode, NULL, 0);
2593 if (ocfs2_should_update_atime(inode, vfsmnt)) {
2596 ocfs2_inode_unlock(inode, 0);
2598 ret = ocfs2_inode_lock(inode, &bh, 1);
2600 ret = ocfs2_try_inode_lock(inode, &bh, 1);
2608 if (ocfs2_should_update_atime(inode, vfsmnt))
2609 ocfs2_update_inode_atime(inode, bh);
2617 void ocfs2_inode_unlock(struct inode *inode,
2621 struct ocfs2_lock_res *lockres = &OCFS2_I(inode)->ip_inode_lockres;
2622 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
2624 mlog(0, "inode %llu drop %s META lock\n",
2625 (unsigned long long)OCFS2_I(inode)->ip_blkno,
2647 * In this case, just lock the inode as requested and return 0
2674 int ocfs2_inode_lock_tracker(struct inode *inode,
2685 lockres = &OCFS2_I(inode)->ip_inode_lockres;
2693 status = ocfs2_inode_lock_full(inode, ret_bh, ex, 0);
2720 status = ocfs2_inode_lock_full(inode, ret_bh, ex,
2731 void ocfs2_inode_unlock_tracker(struct inode *inode,
2738 lockres = &OCFS2_I(inode)->ip_inode_lockres;
2745 ocfs2_inode_unlock(inode, oh->oh_ex);
3267 static int ocfs2_dlm_debug_release(struct inode *inode, struct file *file)
3275 return seq_release_private(inode, file);
3278 static int ocfs2_dlm_debug_open(struct inode *inode, struct file *file)
3289 osb = inode->i_private;
3587 int ocfs2_drop_inode_locks(struct inode *inode)
3594 err = ocfs2_drop_lock(OCFS2_SB(inode->i_sb),
3595 &OCFS2_I(inode)->ip_open_lockres);
3601 err = ocfs2_drop_lock(OCFS2_SB(inode->i_sb),
3602 &OCFS2_I(inode)->ip_inode_lockres);
3608 err = ocfs2_drop_lock(OCFS2_SB(inode->i_sb),
3609 &OCFS2_I(inode)->ip_rw_lockres);
3948 struct inode *inode;
3952 inode = ocfs2_lock_res_inode(lockres);
3953 mapping = inode->i_mapping;
3955 if (S_ISDIR(inode->i_mode)) {
3956 oi = OCFS2_I(inode);
3962 if (!S_ISREG(inode->i_mode))
3975 mlog(ML_ERROR, "Could not sync inode %llu for downconvert!",
3976 (unsigned long long)OCFS2_I(inode)->ip_blkno);
3991 forget_all_cached_acls(inode);
4016 struct inode *inode = ocfs2_lock_res_inode(lockres);
4018 return ocfs2_ci_checkpointed(INODE_CACHE(inode), lockres, new_level);
4023 struct inode *inode = ocfs2_lock_res_inode(lockres);
4025 __ocfs2_stuff_meta_lvb(inode);
4080 * Mark this inode as potentially orphaned. The code in
4132 * exclusive lock on the inode, so it can't be queued