New command -data_cache_size

This commit is contained in:
Thomas Schmitt 2012-03-11 16:41:10 +00:00
parent c4ae3a99d2
commit 6f82a11e6f
15 changed files with 187 additions and 46 deletions

View File

@ -161,6 +161,7 @@ Xorriso_option_cp_clone;
Xorriso_option_cpri;
Xorriso_option_cpx;
Xorriso_option_cut_out;
Xorriso_option_data_cache_size;
Xorriso_option_dev;
Xorriso_option_devices;
Xorriso_option_dialog;

View File

@ -192,6 +192,9 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
m->displacement_sign= 0;
m->drives_exclusive= 1;
m->early_stdio_test= 0;
m->cache_num_tiles= 0;
m->cache_tile_blocks= 0;
m->cache_default= 1 | 2;
m->do_calm_drive= 1;
m->indev[0]= 0;
m->in_drive_handle= NULL;

View File

@ -429,6 +429,12 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, char *show_adr,
if(ret<=0)
goto ex;
ret= Xorriso_set_data_cache(xorriso, ropts, xorriso->cache_num_tiles,
xorriso->cache_tile_blocks,
xorriso->cache_default);
if(ret<=0)
goto ex;
ext= isoburn_ropt_noiso1999;
if((xorriso->ino_behavior & (1 | 2)) && !(xorriso->do_aaip & (1 | 4 | 32))
&& !(xorriso->do_md5 & 1))

View File

@ -95,6 +95,7 @@ int Xorriso_create_empty_iso(struct XorrisO *xorriso, int flag)
/* Note: no return before isoburn_ropt_destroy() */
isoburn_ropt_set_extensions(ropts, isoburn_ropt_pretend_blank);
isoburn_ropt_set_input_charset(ropts, xorriso->in_charset);
isoburn_ropt_set_data_cache(ropts, 1, 1, 0);
isoburn_set_read_pacifier(drive, NULL, NULL);
ret= isoburn_read_image(drive, ropts, &volset);
Xorriso_process_msg_queues(xorriso,0);

View File

@ -863,3 +863,26 @@ int Xorriso_list_extras(struct XorrisO *xorriso, char *mode, int flag)
return(1);
}
/* @param flag bit0= set num_tiles to default value
bit1= set tile_blocks to default value
*/
int Xorriso_set_data_cache(struct XorrisO *xorriso, void *o,
int num_tiles, int tile_blocks, int flag)
{
int ret, tiles, blocks, set_flag;
struct isoburn_read_opts *ropts;
ropts= (struct isoburn_read_opts *) o;
if(flag & (1 | 2)) {
isoburn_ropt_get_data_cache(ropts, &tiles, &blocks, &set_flag, 1);
if(flag & 1)
num_tiles= tiles;
if(flag & 2)
tile_blocks= blocks;
}
ret= isoburn_ropt_set_data_cache(ropts, num_tiles, tile_blocks, 0);
return(ret);
}

View File

@ -30,6 +30,28 @@
#include "xorrisoburn.h"
/* Command -data_cache_size */
int Xorriso_option_data_cache_size(struct XorrisO *xorriso, char *num_tiles,
char *tile_blocks, int flag)
{
int ret, blocks= -1, tiles= -1, to_default= 0;
sscanf(num_tiles, "%d", &tiles);
sscanf(tile_blocks, "%d", &blocks);
if(strcmp(num_tiles, "default") == 0 || num_tiles[0] == 0)
to_default|= 1;
if(strcmp(tile_blocks, "default") == 0 || tile_blocks[0] == 0)
to_default|= 2;
ret= Xorriso_set_data_cache(xorriso, NULL, tiles, blocks, to_default);
if(ret > 0) {
xorriso->cache_num_tiles= tiles;
xorriso->cache_tile_blocks= blocks;
xorriso->cache_default= to_default;
}
return(ret);
}
/* Options -dev , -indev, -outdev */
/** @param flag bit0= use as indev
bit1= use as outdev
@ -1493,6 +1515,8 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" Allow for writing only the usage of optical drives.",
" -early_stdio_test \"on\"|\"appendable_wo\"|\"off\"",
" Classify stdio drives by effective access permissions.",
" -data_cache_size number_of_tiles blocks_per_tile",
" Adjust size and granularity of the data read cache.",
" -blank \"fast\"|\"all\"|\"deformat\"|\"deformat_quickest\"",
" Blank medium resp. invalidate ISO image on medium.",
" -close_damaged \"as_needed\"|\"force\"",

View File

@ -483,6 +483,7 @@ int Xorriso_count_args(struct XorrisO *xorriso, int argc, char **argv,
};
static char arg2_commands[][40]= {
"assert_volid","boot_image","clone","compare","compare_r","drive_class",
"data_cache_size",
"errfile_log","error_behavior","extract","extract_single",
"jigdo","load","logfile",
"map","map_single","page","return_with",
@ -606,7 +607,7 @@ int Xorriso_cmd_sorting_rank(struct XorrisO *xorriso,
"load", "displacement", "drive_class", "assert_volid", "in_charset",
"auto_charset", "hardlinks", "acl", "xattr", "md5", "for_backup",
"disk_dev_ino", "rom_toc_scan", "calm_drive", "ban_stdio_write",
"early_stdio_test",
"early_stdio_test", "data_cache_size",
"* Character sets:",
"charset", "local_charset",
@ -1119,6 +1120,10 @@ next_command:;
ret= Xorriso_option_cut_out(xorriso, arg1, arg2,
argv[(*idx)-2], argv[(*idx)-1], 0);
} else if(strcmp(cmd,"data_cache_size")==0) {
(*idx)+= 2;
ret= Xorriso_option_data_cache_size(xorriso, arg1, arg2, 0);
} else if(strcmp(cmd,"dev")==0) {
(*idx)++;
ret= Xorriso_option_dev(xorriso, arg1, 3);

View File

@ -1289,6 +1289,19 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2);
is_default= ((xorriso->cache_default & 3) == 3);
sprintf(line, "-data_cache_size ");
if(xorriso->cache_default & 1)
sprintf(line + strlen(line), "default ");
else
sprintf(line + strlen(line), "%d ", xorriso->cache_num_tiles);
if(xorriso->cache_default & 2)
sprintf(line + strlen(line), "default\n");
else
sprintf(line + strlen(line), "%d\n", xorriso->cache_tile_blocks);
if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2);
is_default= (xorriso->allow_restore==0 && xorriso->do_concat_split==1 &&
xorriso->do_auto_chmod==0 && xorriso->drives_exclusive == 1);
mode_pt= "off";

View File

@ -9,7 +9,7 @@
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.TH XORRISO 1 "Version 1.2.1, Mar 10, 2012"
.TH XORRISO 1 "Version 1.2.1, Mar 11, 2012"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
@ -945,6 +945,23 @@ of severe problems, and may avoid some less severe error events.
Mode "appendable_wo" is like "on" with the additional property that
non\-empty write\-only files are regarded as appendable rather than blank.
.TP
\fB\-data_cache_size\fR number_of_tiles blocks_per_tile
Set the size and granularity of the data cache which is used when ISO images
are loaded and when file content is read from ISO images. The cache consists
of several tiles, which each consists of several blocks. A larger cache
reduces the need for tiles being read multiple times. Larger tiles might
additionally improve the data throughput from the drive, but can be
wasteful if the data are scattered over the medium.
.br
Larger cache sizes help best with image loading from MMC drives. They are an
inferior alternative to \-osirrox option "sort_lba_on".
.br
blocks_per_tile must be a power of 2. E.g. 16, 32, or 64. The overall cache
size must not exceed 1 GiB.
The default values can be restored by parameter "default" instead of one or
both of the numbers.
Currently the default is 32 tiles of 32 blocks = 2 MiB.
.TP
.B Inserting files into ISO image:
.PP
The following commands expect file addresses of two kinds:

View File

@ -818,6 +818,11 @@ int Xorriso_option_cut_out(struct XorrisO *xorriso, char *disk_path,
*/
int Xorriso_option_dev(struct XorrisO *xorriso, char *adr, int flag);
/* Command -data_cache_size */
/* @since 1.2.2 */
int Xorriso_option_data_cache_size(struct XorrisO *xorriso, char *num_tiles,
char *tile_blocks, int flag);
/* Command -devices */
/* @param flag bit0= perform -device_links rather than -devices
@return <=0 error , 1 success, 2 revoked by -reassure

View File

@ -884,6 +884,21 @@ activate them only after image loading.
non-empty write-only files are regarded as appendable rather than
blank.
-data_cache_size number_of_tiles blocks_per_tile
Set the size and granularity of the data cache which is used when
ISO images are loaded and when file content is read from ISO
images. The cache consists of several tiles, which each consists
of several blocks. A larger cache reduces the need for tiles being
read multiple times. Larger tiles might additionally improve the
data throughput from the drive, but can be wasteful if the data
are scattered over the medium.
Larger cache sizes help best with image loading from MMC drives.
They are an inferior alternative to -osirrox option "sort_lba_on".
blocks_per_tile must be a power of 2. E.g. 16, 32, or 64. The
overall cache size must not exceed 1 GiB. The default values can
be restored by parameter "default" instead of one or both of the
numbers. Currently the default is 32 tiles of 32 blocks = 2 MiB.

File: xorriso.info, Node: Insert, Next: SetInsert, Prev: Loading, Up: Options
@ -4388,6 +4403,7 @@ File: xorriso.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top
* -cpr inserts like with cp -r: Insert. (line 152)
* -cpx copies files to disk: Restore. (line 92)
* -cut_out inserts piece of data file: Insert. (line 126)
* -data_cache_size adjusts read cache size: Loading. (line 265)
* -dev acquires one drive for input and output: AqDrive. (line 12)
* -device_links gets list of drives: Inquiry. (line 18)
* -devices gets list of drives: Inquiry. (line 7)
@ -4641,6 +4657,7 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top
* Growing, _definition: Methods. (line 19)
* Hard links, control handling, -hardlinks: Loading. (line 110)
* hidden, set in ISO image, -hide: Manip. (line 171)
* Image reading, cache size, -data_cache_size: Loading. (line 265)
* Image, _definition: Model. (line 9)
* Image, demand volume id, -assert_volid: Loading. (line 84)
* Image, discard pending changes, -rollback: Writing. (line 9)
@ -4832,47 +4849,47 @@ Node: Options23730
Node: ArgSort25404
Node: AqDrive26894
Node: Loading29938
Node: Insert44222
Node: SetInsert53937
Node: Manip62513
Node: CmdFind71249
Node: Filter83358
Node: Writing87913
Node: SetWrite96877
Node: Bootable112152
Node: Jigdo125374
Node: Charset129620
Node: Exception132381
Node: DialogCtl138500
Node: Inquiry141097
Node: Navigate145963
Node: Verify154224
Node: Restore162913
Node: Emulation169822
Node: Scripting179633
Node: Frontend186793
Node: Examples188093
Node: ExDevices189270
Node: ExCreate189929
Node: ExDialog191214
Node: ExGrowing192479
Node: ExModifying193284
Node: ExBootable193788
Node: ExCharset194340
Node: ExPseudo195161
Node: ExCdrecord196059
Node: ExMkisofs196376
Node: ExGrowisofs197716
Node: ExException198851
Node: ExTime199305
Node: ExIncBackup199764
Node: ExRestore203755
Node: ExRecovery204715
Node: Files205285
Node: Seealso206584
Node: Bugreport207307
Node: Legal207888
Node: CommandIdx208818
Node: ConceptIdx224333
Node: Insert45147
Node: SetInsert54862
Node: Manip63438
Node: CmdFind72174
Node: Filter84283
Node: Writing88838
Node: SetWrite97802
Node: Bootable113077
Node: Jigdo126299
Node: Charset130545
Node: Exception133306
Node: DialogCtl139425
Node: Inquiry142022
Node: Navigate146888
Node: Verify155149
Node: Restore163838
Node: Emulation170747
Node: Scripting180558
Node: Frontend187718
Node: Examples189018
Node: ExDevices190195
Node: ExCreate190854
Node: ExDialog192139
Node: ExGrowing193404
Node: ExModifying194209
Node: ExBootable194713
Node: ExCharset195265
Node: ExPseudo196086
Node: ExCdrecord196984
Node: ExMkisofs197301
Node: ExGrowisofs198641
Node: ExException199776
Node: ExTime200230
Node: ExIncBackup200689
Node: ExRestore204680
Node: ExRecovery205640
Node: Files206210
Node: Seealso207509
Node: Bugreport208232
Node: Legal208813
Node: CommandIdx209743
Node: ConceptIdx225331

End Tag Table

View File

@ -50,7 +50,7 @@
@c man .\" First parameter, NAME, should be all caps
@c man .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
@c man .\" other parameters are allowed: see man(7), man(1)
@c man .TH XORRISO 1 "Version 1.2.1, Mar 10, 2012"
@c man .TH XORRISO 1 "Version 1.2.1, Mar 11, 2012"
@c man .\" Please adjust this date whenever revising the manpage.
@c man .\"
@c man .\" Some roff macros, for reference:
@ -1189,6 +1189,25 @@ of severe problems, and may avoid some less severe error events.
@*
Mode "appendable_wo" is like "on" with the additional property that
non-empty write-only files are regarded as appendable rather than blank.
@c man .TP
@item -data_cache_size number_of_tiles blocks_per_tile
@kindex -data_cache_size adjusts read cache size
@cindex Image reading, cache size, -data_cache_size
Set the size and granularity of the data cache which is used when ISO images
are loaded and when file content is read from ISO images. The cache consists
of several tiles, which each consists of several blocks. A larger cache
reduces the need for tiles being read multiple times. Larger tiles might
additionally improve the data throughput from the drive, but can be
wasteful if the data are scattered over the medium.
@*
Larger cache sizes help best with image loading from MMC drives. They are an
inferior alternative to -osirrox option "sort_lba_on".
@*
blocks_per_tile must be a power of 2. E.g. 16, 32, or 64. The overall cache
size must not exceed 1 GiB.
The default values can be restored by parameter "default" instead of one or
both of the numbers.
Currently the default is 32 tiles of 32 blocks = 2 MiB.
@end table
@c man .TP
@c man .B Inserting files into ISO image:

View File

@ -267,6 +267,10 @@ struct XorrisO { /* the global context of xorriso */
burn_write_opts_set_start_byte().
*/
int cache_num_tiles; /* -data_cache_size */
int cache_tile_blocks;
int cache_default; /* bit0= cache_num_tiles, bit1= cache_tile_blocks */
int do_calm_drive; /* bit0= calm down drive after aquiring it */
char indev[SfileadrL];

View File

@ -1 +1 @@
#define Xorriso_timestamP "2012.03.11.162050"
#define Xorriso_timestamP "2012.03.11.164130"

View File

@ -595,5 +595,8 @@ int Xorriso_close_damaged(struct XorrisO *xorriso, int flag);
int Xorriso_list_extras(struct XorrisO *xorriso, char *mode, int flag);
int Xorriso_set_data_cache(struct XorrisO *xorriso, void *ropts,
int num_tiles, int tile_blocks, int flag);
#endif /* Xorrisoburn_includeD */