scoutfs: correctly set the last symlink item

The final symlink item insertion was taking the min of the entire path
and the max symlink item size, not the min of the remaining length of
the path after having created all the previous items.  For paths larger
than the max item size this could use too much space.

Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
Zach Brown
2016-09-21 10:04:07 -07:00
parent 10a42724a9
commit a9afa92482
+1 -1
View File
@@ -692,7 +692,7 @@ static int scoutfs_symlink(struct inode *dir, struct dentry *dentry,
for (k = 0, off = 0; off < name_len; off += bytes, k++) {
scoutfs_set_key(&key, scoutfs_ino(inode), SCOUTFS_SYMLINK_KEY,
k);
bytes = min(name_len, SCOUTFS_MAX_ITEM_LEN);
bytes = min(name_len - off, SCOUTFS_MAX_ITEM_LEN);
ret = scoutfs_btree_insert(sb, meta, &key, bytes, &curs);
if (ret)