aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_attr.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_attr.c')
-rw-r--r--fs/xfs/xfs_attr.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c
index c6c2596e827a..a5cb0972bb8a 100644
--- a/fs/xfs/xfs_attr.c
+++ b/fs/xfs/xfs_attr.c
@@ -199,18 +199,14 @@ xfs_attr_set_int(xfs_inode_t *dp, const char *name, int namelen,
199 return (error); 199 return (error);
200 200
201 /* 201 /*
202 * Determine space new attribute will use, and if it would be
203 * "local" or "remote" (note: local != inline).
204 */
205 size = xfs_attr_leaf_newentsize(namelen, valuelen,
206 mp->m_sb.sb_blocksize, &local);
207
208 /*
209 * If the inode doesn't have an attribute fork, add one. 202 * If the inode doesn't have an attribute fork, add one.
210 * (inode must not be locked when we call this routine) 203 * (inode must not be locked when we call this routine)
211 */ 204 */
212 if (XFS_IFORK_Q(dp) == 0) { 205 if (XFS_IFORK_Q(dp) == 0) {
213 if ((error = xfs_bmap_add_attrfork(dp, size, rsvd))) 206 int sf_size = sizeof(xfs_attr_sf_hdr_t) +
207 XFS_ATTR_SF_ENTSIZE_BYNAME(namelen, valuelen);
208
209 if ((error = xfs_bmap_add_attrfork(dp, sf_size, rsvd)))
214 return(error); 210 return(error);
215 } 211 }
216 212
@@ -231,6 +227,13 @@ xfs_attr_set_int(xfs_inode_t *dp, const char *name, int namelen,
231 args.addname = 1; 227 args.addname = 1;
232 args.oknoent = 1; 228 args.oknoent = 1;
233 229
230 /*
231 * Determine space new attribute will use, and if it would be
232 * "local" or "remote" (note: local != inline).
233 */
234 size = xfs_attr_leaf_newentsize(namelen, valuelen,
235 mp->m_sb.sb_blocksize, &local);
236
234 nblks = XFS_DAENTER_SPACE_RES(mp, XFS_ATTR_FORK); 237 nblks = XFS_DAENTER_SPACE_RES(mp, XFS_ATTR_FORK);
235 if (local) { 238 if (local) {
236 if (size > (mp->m_sb.sb_blocksize >> 1)) { 239 if (size > (mp->m_sb.sb_blocksize >> 1)) {