Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions fs/hfsplus/catalog.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,6 @@ int hfsplus_delete_cat(u32 cnid, struct inode *dir, const struct qstr *str)
struct super_block *sb = dir->i_sb;
struct hfs_find_data fd;
struct hfsplus_fork_raw fork;
struct list_head *pos;
int err, off;
u16 type;

Expand Down Expand Up @@ -391,16 +390,6 @@ int hfsplus_delete_cat(u32 cnid, struct inode *dir, const struct qstr *str)
hfsplus_free_fork(sb, cnid, &fork, HFSPLUS_TYPE_RSRC);
}

/* we only need to take spinlock for exclusion with ->release() */
spin_lock(&HFSPLUS_I(dir)->open_dir_lock);
list_for_each(pos, &HFSPLUS_I(dir)->open_dir_list) {
struct hfsplus_readdir_data *rd =
list_entry(pos, struct hfsplus_readdir_data, list);
if (fd.tree->keycmp(fd.search_key, (void *)&rd->key) < 0)
rd->file->f_pos--;
}
spin_unlock(&HFSPLUS_I(dir)->open_dir_lock);

err = hfs_brec_remove(&fd);
if (err)
goto out;
Expand Down
28 changes: 11 additions & 17 deletions fs/hfsplus/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,15 @@ static int hfsplus_readdir(struct file *file, struct dir_context *ctx)
}
if (ctx->pos >= inode->i_size)
goto out;
err = hfs_brec_goto(&fd, ctx->pos - 1);
rd = file->private_data;
if (rd && rd->pos == ctx->pos) {
memcpy(fd.search_key, &rd->key, sizeof(struct hfsplus_cat_key));
err = hfs_brec_find(&fd, hfs_find_rec_by_key);
if (err == -ENOENT)
err = hfs_brec_goto(&fd, 1);
} else {
err = hfs_brec_goto(&fd, ctx->pos - 1);
}
if (err)
goto out;
for (;;) {
Expand Down Expand Up @@ -261,23 +269,15 @@ static int hfsplus_readdir(struct file *file, struct dir_context *ctx)
if (err)
goto out;
}
rd = file->private_data;
if (!rd) {
rd = kmalloc_obj(struct hfsplus_readdir_data);
if (!rd) {
err = -ENOMEM;
goto out;
}
file->private_data = rd;
rd->file = file;
spin_lock(&HFSPLUS_I(inode)->open_dir_lock);
list_add(&rd->list, &HFSPLUS_I(inode)->open_dir_list);
spin_unlock(&HFSPLUS_I(inode)->open_dir_lock);
}
/*
* Can be done after the list insertion; exclusion with
* hfsplus_delete_cat() is provided by directory lock.
*/
rd->pos = ctx->pos;
memcpy(&rd->key, fd.key, sizeof(struct hfsplus_cat_key));
out:
kfree(strbuf);
Expand All @@ -287,13 +287,7 @@ static int hfsplus_readdir(struct file *file, struct dir_context *ctx)

static int hfsplus_dir_release(struct inode *inode, struct file *file)
{
struct hfsplus_readdir_data *rd = file->private_data;
if (rd) {
spin_lock(&HFSPLUS_I(inode)->open_dir_lock);
list_del(&rd->list);
spin_unlock(&HFSPLUS_I(inode)->open_dir_lock);
kfree(rd);
}
kfree(file->private_data);
return 0;
}

Expand Down
5 changes: 1 addition & 4 deletions fs/hfsplus/hfsplus_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,6 @@ struct hfsplus_inode_info {
sector_t fs_blocks;
u8 userflags; /* BSD user file flags */
u32 subfolders; /* Subfolder count (HFSX only) */
struct list_head open_dir_list;
spinlock_t open_dir_lock;
loff_t phys_size;

struct inode vfs_inode;
Expand Down Expand Up @@ -265,8 +263,7 @@ struct hfs_find_data {
};

struct hfsplus_readdir_data {
struct list_head list;
struct file *file;
loff_t pos;
struct hfsplus_cat_key key;
};

Expand Down
2 changes: 0 additions & 2 deletions fs/hfsplus/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,8 +438,6 @@ struct inode *hfsplus_new_inode(struct super_block *sb, struct inode *dir,
simple_inode_init_ts(inode);

hip = HFSPLUS_I(inode);
INIT_LIST_HEAD(&hip->open_dir_list);
spin_lock_init(&hip->open_dir_lock);
mutex_init(&hip->extents_lock);
atomic_set(&hip->opencnt, 0);
hip->extent_state = 0;
Expand Down
2 changes: 0 additions & 2 deletions fs/hfsplus/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ struct inode *hfsplus_iget(struct super_block *sb, unsigned long ino)
HFSPLUS_I(inode)->fs_blocks = 0;
HFSPLUS_I(inode)->userflags = 0;
HFSPLUS_I(inode)->subfolders = 0;
INIT_LIST_HEAD(&HFSPLUS_I(inode)->open_dir_list);
spin_lock_init(&HFSPLUS_I(inode)->open_dir_lock);
HFSPLUS_I(inode)->phys_size = 0;

if (inode->i_ino >= HFSPLUS_FIRSTUSER_CNID ||
Expand Down
Loading