diff options
Diffstat (limited to 'fs/afs/inode.c')
| -rw-r--r-- | fs/afs/inode.c | 31 | 
1 files changed, 19 insertions, 12 deletions
| diff --git a/fs/afs/inode.c b/fs/afs/inode.c index b42d9d09669c..18a50d4febcf 100644 --- a/fs/afs/inode.c +++ b/fs/afs/inode.c @@ -56,6 +56,16 @@ static noinline void dump_vnode(struct afs_vnode *vnode, struct afs_vnode *paren  }  /* + * Set the file size and block count.  Estimate the number of 512 bytes blocks + * used, rounded up to nearest 1K for consistency with other AFS clients. + */ +static void afs_set_i_size(struct afs_vnode *vnode, u64 size) +{ +	i_size_write(&vnode->vfs_inode, size); +	vnode->vfs_inode.i_blocks = ((size + 1023) >> 10) << 1; +} + +/*   * Initialise an inode from the vnode status.   */  static int afs_inode_init_from_status(struct afs_vnode *vnode, struct key *key, @@ -124,12 +134,7 @@ static int afs_inode_init_from_status(struct afs_vnode *vnode, struct key *key,  		return afs_protocol_error(NULL, -EBADMSG, afs_eproto_file_type);  	} -	/* -	 * Estimate 512 bytes  blocks used, rounded up to nearest 1K -	 * for consistency with other AFS clients. -	 */ -	inode->i_blocks		= ((i_size_read(inode) + 1023) >> 10) << 1; -	i_size_write(&vnode->vfs_inode, status->size); +	afs_set_i_size(vnode, status->size);  	vnode->invalid_before	= status->data_version;  	inode_set_iversion_raw(&vnode->vfs_inode, status->data_version); @@ -207,11 +212,13 @@ static void afs_apply_status(struct afs_fs_cursor *fc,  	if (expected_version &&  	    *expected_version != status->data_version) { -		kdebug("vnode modified %llx on {%llx:%llu} [exp %llx] %s", -		       (unsigned long long) status->data_version, -		       vnode->fid.vid, vnode->fid.vnode, -		       (unsigned long long) *expected_version, -		       fc->type ? fc->type->name : "???"); +		if (test_bit(AFS_VNODE_CB_PROMISED, &vnode->flags)) +			pr_warn("kAFS: vnode modified {%llx:%llu} %llx->%llx %s\n", +				vnode->fid.vid, vnode->fid.vnode, +				(unsigned long long)*expected_version, +				(unsigned long long)status->data_version, +				fc->type ? fc->type->name : "???"); +  		vnode->invalid_before = status->data_version;  		if (vnode->status.type == AFS_FTYPE_DIR) {  			if (test_and_clear_bit(AFS_VNODE_DIR_VALID, &vnode->flags)) @@ -230,7 +237,7 @@ static void afs_apply_status(struct afs_fs_cursor *fc,  	if (data_changed) {  		inode_set_iversion_raw(&vnode->vfs_inode, status->data_version); -		i_size_write(&vnode->vfs_inode, status->size); +		afs_set_i_size(vnode, status->size);  	}  } | 
