Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 207518
b: refs/heads/master
c: eef2380
h: refs/heads/master
v: v3
  • Loading branch information
Christoph Hellwig authored and Al Viro committed Aug 9, 2010
1 parent 783d05d commit 2a5f0bf
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6a1a90ad1b0edb556a7550a6ef8a8756f0304dd5
refs/heads/master: eef2380c187890816b73b1a4cb89a09203759469
9 changes: 3 additions & 6 deletions trunk/fs/attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,10 @@ int notify_change(struct dentry * dentry, struct iattr * attr)
if (ia_valid & ATTR_SIZE)
down_write(&dentry->d_inode->i_alloc_sem);

if (inode->i_op && inode->i_op->setattr) {
if (inode->i_op->setattr)
error = inode->i_op->setattr(dentry, attr);
} else {
error = inode_change_ok(inode, attr);
if (!error)
error = inode_setattr(inode, attr);
}
else
error = simple_setattr(dentry, attr);

if (ia_valid & ATTR_SIZE)
up_write(&dentry->d_inode->i_alloc_sem);
Expand Down
16 changes: 11 additions & 5 deletions trunk/fs/libfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,21 +370,26 @@ int simple_setsize(struct inode *inode, loff_t newsize)
EXPORT_SYMBOL(simple_setsize);

/**
* simple_setattr - setattr for simple in-memory filesystem
* simple_setattr - setattr for simple filesystem
* @dentry: dentry
* @iattr: iattr structure
*
* Returns 0 on success, -error on failure.
*
* simple_setattr implements setattr for an in-memory filesystem which
* does not store its own file data or metadata (eg. uses the page cache
* and inode cache as its data store).
* simple_setattr is a simple ->setattr implementation without a proper
* implementation of size changes.
*
* It can either be used for in-memory filesystems or special files
* on simple regular filesystems. Anything that needs to change on-disk
* or wire state on size changes needs its own setattr method.
*/
int simple_setattr(struct dentry *dentry, struct iattr *iattr)
{
struct inode *inode = dentry->d_inode;
int error;

WARN_ON_ONCE(inode->i_op->truncate);

error = inode_change_ok(inode, iattr);
if (error)
return error;
Expand All @@ -396,7 +401,8 @@ int simple_setattr(struct dentry *dentry, struct iattr *iattr)
}

setattr_copy(inode, iattr);
return error;
mark_inode_dirty(inode);
return 0;
}
EXPORT_SYMBOL(simple_setattr);

Expand Down

0 comments on commit 2a5f0bf

Please sign in to comment.