refcounttree.c (e4d35be584be88a3db3fa5635a97c62a2ec5aafe) refcounttree.c (c25a1e0671fbca7b2c0d0757d533bd2650d6dc0c)
1/* -*- mode: c; c-basic-offset: 8; -*-
2 * vim: noexpandtab sw=8 ts=8 sts=0:
3 *
4 * refcounttree.c
5 *
6 * Copyright (C) 2009 Oracle. All rights reserved.
7 *
8 * This program is free software; you can redistribute it and/or

--- 4234 unchanged lines hidden (view full) ---

4243
4244static int ocfs2_reflink(struct dentry *old_dentry, struct inode *dir,
4245 struct dentry *new_dentry, bool preserve)
4246{
4247 int error;
4248 struct inode *inode = d_inode(old_dentry);
4249 struct buffer_head *old_bh = NULL;
4250 struct inode *new_orphan_inode = NULL;
1/* -*- mode: c; c-basic-offset: 8; -*-
2 * vim: noexpandtab sw=8 ts=8 sts=0:
3 *
4 * refcounttree.c
5 *
6 * Copyright (C) 2009 Oracle. All rights reserved.
7 *
8 * This program is free software; you can redistribute it and/or

--- 4234 unchanged lines hidden (view full) ---

4243
4244static int ocfs2_reflink(struct dentry *old_dentry, struct inode *dir,
4245 struct dentry *new_dentry, bool preserve)
4246{
4247 int error;
4248 struct inode *inode = d_inode(old_dentry);
4249 struct buffer_head *old_bh = NULL;
4250 struct inode *new_orphan_inode = NULL;
4251 struct posix_acl *default_acl, *acl;
4252 umode_t mode;
4253
4254 if (!ocfs2_refcount_tree(OCFS2_SB(inode->i_sb)))
4255 return -EOPNOTSUPP;
4256
4251
4252 if (!ocfs2_refcount_tree(OCFS2_SB(inode->i_sb)))
4253 return -EOPNOTSUPP;
4254
4257 mode = inode->i_mode;
4258 error = posix_acl_create(dir, &mode, &default_acl, &acl);
4259 if (error) {
4260 mlog_errno(error);
4261 return error;
4262 }
4263
4255
4264 error = ocfs2_create_inode_in_orphan(dir, mode,
4256 error = ocfs2_create_inode_in_orphan(dir, inode->i_mode,
4265 &new_orphan_inode);
4266 if (error) {
4267 mlog_errno(error);
4268 goto out;
4269 }
4270
4271 error = ocfs2_rw_lock(inode, 1);
4272 if (error) {

--- 22 unchanged lines hidden (view full) ---

4295 if (error) {
4296 mlog_errno(error);
4297 goto out;
4298 }
4299
4300 /* If the security isn't preserved, we need to re-initialize them. */
4301 if (!preserve) {
4302 error = ocfs2_init_security_and_acl(dir, new_orphan_inode,
4257 &new_orphan_inode);
4258 if (error) {
4259 mlog_errno(error);
4260 goto out;
4261 }
4262
4263 error = ocfs2_rw_lock(inode, 1);
4264 if (error) {

--- 22 unchanged lines hidden (view full) ---

4287 if (error) {
4288 mlog_errno(error);
4289 goto out;
4290 }
4291
4292 /* If the security isn't preserved, we need to re-initialize them. */
4293 if (!preserve) {
4294 error = ocfs2_init_security_and_acl(dir, new_orphan_inode,
4303 &new_dentry->d_name,
4304 default_acl, acl);
4295 &new_dentry->d_name);
4305 if (error)
4306 mlog_errno(error);
4307 }
4308out:
4296 if (error)
4297 mlog_errno(error);
4298 }
4299out:
4309 if (default_acl)
4310 posix_acl_release(default_acl);
4311 if (acl)
4312 posix_acl_release(acl);
4313 if (!error) {
4314 error = ocfs2_mv_orphaned_inode_to_new(dir, new_orphan_inode,
4315 new_dentry);
4316 if (error)
4317 mlog_errno(error);
4318 }
4319
4320 if (new_orphan_inode) {

--- 137 unchanged lines hidden ---
4300 if (!error) {
4301 error = ocfs2_mv_orphaned_inode_to_new(dir, new_orphan_inode,
4302 new_dentry);
4303 if (error)
4304 mlog_errno(error);
4305 }
4306
4307 if (new_orphan_inode) {

--- 137 unchanged lines hidden ---