]> err.no Git - linux-2.6/blobdiff - fs/ocfs2/namei.c
ocfs2: Sync ocfs2_fs.h with ocfs2-tools
[linux-2.6] / fs / ocfs2 / namei.c
index 395859edb51f5d1769bd46c83562ff22024f409e..701e6d04ed5d2a7ed45fa9bb6270fa6f7fa91c50 100644 (file)
@@ -285,7 +285,7 @@ static int ocfs2_fill_new_dir(struct ocfs2_super *osb,
 
        i_size_write(inode, inode->i_sb->s_blocksize);
        inode->i_nlink = 2;
-       inode->i_blocks = ocfs2_align_bytes_to_sectors(inode->i_sb->s_blocksize);
+       inode->i_blocks = ocfs2_inode_sector_count(inode);
        status = ocfs2_mark_inode_dirty(handle, inode, fe_bh);
        if (status < 0) {
                mlog_errno(status);
@@ -578,8 +578,9 @@ static int ocfs2_mknod_locked(struct ocfs2_super *osb,
        if (ocfs2_populate_inode(inode, fe, 1) < 0) {
                mlog(ML_ERROR, "populate inode failed! bh->b_blocknr=%llu, "
                     "i_blkno=%llu, i_ino=%lu\n",
-                    (unsigned long long) (*new_fe_bh)->b_blocknr,
-                    (unsigned long long)fe->i_blkno, inode->i_ino);
+                    (unsigned long long)(*new_fe_bh)->b_blocknr,
+                    (unsigned long long)le64_to_cpu(fe->i_blkno),
+                    inode->i_ino);
                BUG();
        }
 
@@ -1079,6 +1080,7 @@ static int ocfs2_rename(struct inode *old_dir,
        struct buffer_head *old_inode_de_bh = NULL; // if old_dentry is a dir,
                                                    // this is the 1st dirent bh
        nlink_t old_dir_nlink = old_dir->i_nlink;
+       struct ocfs2_dinode *old_di;
 
        /* At some point it might be nice to break this function up a
         * bit. */
@@ -1353,7 +1355,20 @@ static int ocfs2_rename(struct inode *old_dir,
 
        old_inode->i_ctime = CURRENT_TIME;
        mark_inode_dirty(old_inode);
-       ocfs2_mark_inode_dirty(handle, old_inode, old_inode_bh);
+
+       status = ocfs2_journal_access(handle, old_inode, old_inode_bh,
+                                     OCFS2_JOURNAL_ACCESS_WRITE);
+       if (status >= 0) {
+               old_di = (struct ocfs2_dinode *) old_inode_bh->b_data;
+
+               old_di->i_ctime = cpu_to_le64(old_inode->i_ctime.tv_sec);
+               old_di->i_ctime_nsec = cpu_to_le32(old_inode->i_ctime.tv_nsec);
+
+               status = ocfs2_journal_dirty(handle, old_inode_bh);
+               if (status < 0)
+                       mlog_errno(status);
+       } else
+               mlog_errno(status);
 
        /* now that the name has been added to new_dir, remove the old name */
        status = ocfs2_delete_entry(handle, old_dir, old_de, old_de_bh);
@@ -1483,8 +1498,7 @@ static int ocfs2_create_symlink_data(struct ocfs2_super *osb,
        struct buffer_head **bhs = NULL;
        const char *c;
        struct super_block *sb = osb->sb;
-       u64 p_blkno;
-       int p_blocks;
+       u64 p_blkno, p_blocks;
        int virtual, blocks, status, i, bytes_left;
 
        bytes_left = i_size_read(inode) + 1;
@@ -1674,7 +1688,7 @@ static int ocfs2_symlink(struct inode *dir,
                u32 offset = 0;
 
                inode->i_op = &ocfs2_symlink_inode_operations;
-               status = ocfs2_do_extend_allocation(osb, inode, &offset, 1,
+               status = ocfs2_do_extend_allocation(osb, inode, &offset, 1, 0,
                                                    new_fe_bh,
                                                    handle, data_ac, NULL,
                                                    NULL);
@@ -1689,7 +1703,7 @@ static int ocfs2_symlink(struct inode *dir,
                        goto bail;
                }
                i_size_write(inode, newsize);
-               inode->i_blocks = ocfs2_align_bytes_to_sectors(newsize);
+               inode->i_blocks = ocfs2_inode_sector_count(inode);
        } else {
                inode->i_op = &ocfs2_fast_symlink_inode_operations;
                memcpy((char *) fe->id2.i_symlink, symname, l);