aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2015-01-29 00:20:49 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2015-02-17 22:16:35 -0500
commit1cf97d0d3a1b0232a3fde25deac3b3fd288627e2 (patch)
treea3b2951252bff5cb3832cf3d6490a236d1a83cce /fs
parentc88b1e70aeaa38aa20e67e436f28c4d36c0b9f4b (diff)
configfs: fold create_dir() into its only caller
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/configfs/dir.c63
1 files changed, 29 insertions, 34 deletions
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
index 6371ba19ee43..cf0db005d2f5 100644
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -260,37 +260,6 @@ static void init_symlink(struct inode * inode)
260 inode->i_op = &configfs_symlink_inode_operations; 260 inode->i_op = &configfs_symlink_inode_operations;
261} 261}
262 262
263static int create_dir(struct config_item *k, struct dentry *d)
264{
265 int error;
266 umode_t mode = S_IFDIR| S_IRWXU | S_IRUGO | S_IXUGO;
267 struct dentry *p = d->d_parent;
268
269 BUG_ON(!k);
270
271 error = configfs_dirent_exists(p->d_fsdata, d->d_name.name);
272 if (!error)
273 error = configfs_make_dirent(p->d_fsdata, d, k, mode,
274 CONFIGFS_DIR | CONFIGFS_USET_CREATING);
275 if (!error) {
276 configfs_set_dir_dirent_depth(p->d_fsdata, d->d_fsdata);
277 error = configfs_create(d, mode, init_dir);
278 if (!error) {
279 inc_nlink(p->d_inode);
280 } else {
281 struct configfs_dirent *sd = d->d_fsdata;
282 if (sd) {
283 spin_lock(&configfs_dirent_lock);
284 list_del_init(&sd->s_sibling);
285 spin_unlock(&configfs_dirent_lock);
286 configfs_put(sd);
287 }
288 }
289 }
290 return error;
291}
292
293
294/** 263/**
295 * configfs_create_dir - create a directory for an config_item. 264 * configfs_create_dir - create a directory for an config_item.
296 * @item: config_itemwe're creating directory for. 265 * @item: config_itemwe're creating directory for.
@@ -300,11 +269,37 @@ static int create_dir(struct config_item *k, struct dentry *d)
300 * until it is validated by configfs_dir_set_ready() 269 * until it is validated by configfs_dir_set_ready()
301 */ 270 */
302 271
303static int configfs_create_dir(struct config_item * item, struct dentry *dentry) 272static int configfs_create_dir(struct config_item *item, struct dentry *dentry)
304{ 273{
305 int error = create_dir(item, dentry); 274 int error;
306 if (!error) 275 umode_t mode = S_IFDIR| S_IRWXU | S_IRUGO | S_IXUGO;
276 struct dentry *p = dentry->d_parent;
277
278 BUG_ON(!item);
279
280 error = configfs_dirent_exists(p->d_fsdata, dentry->d_name.name);
281 if (unlikely(error))
282 return error;
283
284 error = configfs_make_dirent(p->d_fsdata, dentry, item, mode,
285 CONFIGFS_DIR | CONFIGFS_USET_CREATING);
286 if (unlikely(error))
287 return error;
288
289 configfs_set_dir_dirent_depth(p->d_fsdata, dentry->d_fsdata);
290 error = configfs_create(dentry, mode, init_dir);
291 if (!error) {
292 inc_nlink(p->d_inode);
307 item->ci_dentry = dentry; 293 item->ci_dentry = dentry;
294 } else {
295 struct configfs_dirent *sd = dentry->d_fsdata;
296 if (sd) {
297 spin_lock(&configfs_dirent_lock);
298 list_del_init(&sd->s_sibling);
299 spin_unlock(&configfs_dirent_lock);
300 configfs_put(sd);
301 }
302 }
308 return error; 303 return error;
309} 304}
310 305