aboutsummaryrefslogtreecommitdiffstats
path: root/fs/dcache.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/dcache.c')
-rw-r--r--fs/dcache.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/fs/dcache.c b/fs/dcache.c
index 6ee6bc40cb63..814e5f491e9c 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -1589,6 +1589,33 @@ void d_rehash(struct dentry * entry)
1589} 1589}
1590EXPORT_SYMBOL(d_rehash); 1590EXPORT_SYMBOL(d_rehash);
1591 1591
1592/**
1593 * dentry_update_name_case - update case insensitive dentry with a new name
1594 * @dentry: dentry to be updated
1595 * @name: new name
1596 *
1597 * Update a case insensitive dentry with new case of name.
1598 *
1599 * dentry must have been returned by d_lookup with name @name. Old and new
1600 * name lengths must match (ie. no d_compare which allows mismatched name
1601 * lengths).
1602 *
1603 * Parent inode i_mutex must be held over d_lookup and into this call (to
1604 * keep renames and concurrent inserts, and readdir(2) away).
1605 */
1606void dentry_update_name_case(struct dentry *dentry, struct qstr *name)
1607{
1608 BUG_ON(!mutex_is_locked(&dentry->d_inode->i_mutex));
1609 BUG_ON(dentry->d_name.len != name->len); /* d_lookup gives this */
1610
1611 spin_lock(&dcache_lock);
1612 spin_lock(&dentry->d_lock);
1613 memcpy((unsigned char *)dentry->d_name.name, name->name, name->len);
1614 spin_unlock(&dentry->d_lock);
1615 spin_unlock(&dcache_lock);
1616}
1617EXPORT_SYMBOL(dentry_update_name_case);
1618
1592/* 1619/*
1593 * When switching names, the actual string doesn't strictly have to 1620 * When switching names, the actual string doesn't strictly have to
1594 * be preserved in the target - because we're dropping the target 1621 * be preserved in the target - because we're dropping the target