Skip to content

Enhancement for creating pretty extent at flush #211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: pretty-extent
Choose a base branch
from
Open
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
12 changes: 12 additions & 0 deletions messages/iosched_unified/root.txt
Original file line number Diff line number Diff line change
@@ -64,5 +64,17 @@ root:table {
13024I:string { "Clean up extents and append index at index partition (%d)." }
13025I:string { "Get error position (%d, %d)." }
13026E:string { "Write perm handling error : %s (%d)." }
13027D:string { "Created DPR : %s." }
13028D:string { "Removed DPR : %s." }
13029D:string { "DPR (%s): %s (%u)." }
13030D:string { "No DPR on %s (req = 0x%llx)." }
13031D:string { "Created a request (0x%llx)." }
13032D:string { "Removed a request (0x%llx)." }
13033D:string { "Flushing all (%s, %s)." }
13034D:string { "Send a broadcast from %s." }
13035D:string { "Waiting a broadcast signal." }
13036D:string { "Received a broadcast signal." }
13037D:string { "Flush all operation is finished." }
13038E:string { "Cannot capture dentry private in %s (%d)"}
}
}
11 changes: 10 additions & 1 deletion src/iosched/fcfs.c
Original file line number Diff line number Diff line change
@@ -110,13 +110,18 @@ int fcfs_destroy(void *iosched_handle)
*/
int fcfs_open(const char *path, bool open_write, struct dentry **dentry, void *iosched_handle)
{
int ret;
struct fcfs_data *priv = (struct fcfs_data *) iosched_handle;

CHECK_ARG_NULL(path, -LTFS_NULL_ARG);
CHECK_ARG_NULL(dentry, -LTFS_NULL_ARG);
CHECK_ARG_NULL(iosched_handle, -LTFS_NULL_ARG);

return ltfs_fsraw_open(path, open_write, dentry, priv->vol);
ret = ltfs_fsraw_open(path, open_write, dentry, priv->vol);
if (ret == 0)
ltfs_fsraw_get_dentry(*dentry, priv->vol);

return ret;
}

/**
@@ -128,9 +133,13 @@ int fcfs_open(const char *path, bool open_write, struct dentry **dentry, void *i
*/
int fcfs_close(struct dentry *d, bool flush, void *iosched_handle)
{
struct fcfs_data *priv = (struct fcfs_data *) iosched_handle;

CHECK_ARG_NULL(d, -LTFS_NULL_ARG);
CHECK_ARG_NULL(iosched_handle, -LTFS_NULL_ARG);

ltfs_fsraw_put_dentry(d, priv->vol);

return ltfs_fsraw_close(d);
}

580 changes: 433 additions & 147 deletions src/iosched/unified.c

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions src/libltfs/iosched_ops.h
Original file line number Diff line number Diff line change
@@ -85,7 +85,6 @@ const char *iosched_get_message_bundle_name(void **message_data);
/**
* Request type definisions for LTFS request profile
*/

#define REQ_IOS_OPEN 0000 /**< open */
#define REQ_IOS_CLOSE 0001 /**< close */
#define REQ_IOS_READ 0002 /**< read */
@@ -95,9 +94,11 @@ const char *iosched_get_message_bundle_name(void **message_data);
#define REQ_IOS_GETFSIZE 0006 /**< get_filesize */
#define REQ_IOS_UPDPLACE 0007 /**< update_data_placement */
#define REQ_IOS_IOSCHED 0008 /**< (io_scheduler ... _unified_writer_thread) */
#define REQ_IOS_ENQUEUE_IP 0009 /**< Enqueue data block to IP */
#define REQ_IOS_DEQUEUE_IP 000A /**< Dequeue data block to IP */
#define REQ_IOS_ENQUEUE_DP 000B /**< Enqueue data block to DP */
#define REQ_IOS_DEQUEUE_DP 000C /**< Dequeue data block to DP */
#define REQ_IOS_ENQUEUE_IP 0009 /**< Enqueue data block to IP (unused at this time) */
#define REQ_IOS_DEQUEUE_IP 000A /**< Dequeue data block to IP (unused at this time) */
#define REQ_IOS_ENQUEUE_DP 000B /**< Enqueue data block to DP (unused at this time) */
#define REQ_IOS_DEQUEUE_DP 000C /**< Dequeue data block to DP (unused at this time) */
#define REQ_IOS_ADD_REQUEST 000D /**< Add a request */
#define REQ_IOS_DEL_REQUEST 000E /**< Remove a request */

#endif /* __iosched_ops_h */
28 changes: 20 additions & 8 deletions src/libltfs/ltfs_fsops.c
Original file line number Diff line number Diff line change
@@ -268,12 +268,10 @@ int ltfs_fsops_create(const char *path, bool isdir, bool readonly, bool overwrit

/* Look up parent directory */
fs_split_path(path_norm, &filename, strlen(path_norm) + 1);
if (dcache_initialized(vol)) {
ret = asprintf(&dentry_path, "%s/%s", path_norm, filename);
if (ret < 0) {
ltfsmsg(LTFS_ERR, 10001E, "ltfs_fsops_create: dentry_path");
goto out_dispose;
}
ret = asprintf(&dentry_path, "%s/%s", path_norm, filename);
if (ret < 0) {
ltfsmsg(LTFS_ERR, 10001E, "ltfs_fsops_create: dentry_path");
goto out_dispose;
}

/* Lookup the parent dentry. On success, parent->contents_lock will be held in write mode */
@@ -341,7 +339,14 @@ int ltfs_fsops_create(const char *path, bool isdir, bool readonly, bool overwrit
d->vol = vol;
d->parent = parent;
++d->link_count;
++d->numhandles;

if (isdir || !iosched_initialized(vol)) {
/*
* numhandles will be incremented in iosched_open() below when ioscheduler is
* enabled.
*/
++d->numhandles;
}

/* Block end */
if (isdir)
@@ -365,7 +370,7 @@ int ltfs_fsops_create(const char *path, bool isdir, bool readonly, bool overwrit
ltfs_set_index_dirty(false, false, vol->index);
d->dirty = true;
ltfs_mutex_unlock(&vol->index->dirty_lock);
vol->file_open_count ++;
vol->file_open_count++;

*dentry = d;
ret = 0;
@@ -381,6 +386,13 @@ int ltfs_fsops_create(const char *path, bool isdir, bool readonly, bool overwrit
}
}

if (!isdir && !ret && iosched_initialized(vol)) {
ret = iosched_open(dentry_path, overwrite, &d, vol);
if (ret < 0) {
fs_release_dentry(d);
}
}

if (ret == 0 && parent->is_appendonly) {
ltfs_file_id id;
ret = ltfs_fsops_setxattr(path, "user.ltfs.vendor.IBM.appendonly", "1", 1, 0, &id, vol);
2 changes: 1 addition & 1 deletion src/ltfs_fuse.c
Original file line number Diff line number Diff line change
@@ -162,7 +162,7 @@ static void _free_file_info(struct file_info *fi)
* @return File handle information, or NULL if memory allocation failed or if 'priv' is NULL.
*/
static struct file_info *_file_open(const char *path, void *d, struct file_info *spare,
struct ltfs_fuse_data *priv)
struct ltfs_fuse_data *priv)
{
struct file_info *fi = NULL;
CHECK_ARG_NULL(priv, NULL);
1 change: 1 addition & 0 deletions src/tape_drivers/linux/sg/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
vendor_compat.c
ibm_tape.c
hp_tape.c
quantum_tape.c
open_factor.c