Skip to content
Merged
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
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
ltsm (0.9.2) unstable; urgency=low

* Increased buffersize to 16 MiB

-- Samuel Hasert <[email protected]> Mon, 15 Sep 2025 11:33:05 +0200

ltsm (0.9.1) unstable; urgency=low

* Finalize remove of FSQ project.
Expand Down
3 changes: 3 additions & 0 deletions rpm/ltsm.spec
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ rm -rf %{buildroot}

%changelog

* Mon Sep 15 2025 Samuel Hasert <[email protected]> 0.9.2
- Increased buffersize to 16 MiB

* Thu Jul 28 2022 Thomas Stibor <[email protected]> 0.9.0-1
- Remove FSQ to keep LTSM as a Lustre TSM copytool project.

Expand Down
19 changes: 15 additions & 4 deletions src/lib/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,20 @@ int crc32file(const char *filename, uint32_t *crc32result)
FILE *file;
size_t cur_read;
uint32_t crc32sum = 0;
unsigned char buf[TSM_BUF_LENGTH] = {0};
unsigned char* buf = malloc(TSM_BUF_LENGTH); // reserve memory on heap because stack too small
if (!buf) {
rc = errno;
CT_ERROR(rc, "malloc");

return rc;
}

file = fopen(filename, "r");
if (file == NULL) {
rc = -errno;
CT_ERROR(rc, "fopen failed on '%s'", filename);
if (buf) free(buf);
buf = NULL;

return rc;
}
Expand All @@ -174,17 +182,20 @@ int crc32file(const char *filename, uint32_t *crc32result)

} while (!feof(file));

int rc_minor;
if (buf) free(buf);
buf = NULL;

rc_minor = fclose(file);
int rc_minor = fclose(file);
if (rc_minor) {
rc_minor = -errno;
CT_ERROR(rc_minor, "fclose failed on '%s'", filename);

return rc_minor;
}

*crc32result = crc32sum;
if (!rc) {
*crc32result = crc32sum;
}

return rc;
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
#endif

#ifndef TSM_BUF_LENGTH
#define TSM_BUF_LENGTH 262144 /* 256 KiB. */
#define TSM_BUF_LENGTH 16777216 /* 16 MiB */
#endif

#ifndef MAX_OPTIONS_LENGTH
Expand Down
9 changes: 8 additions & 1 deletion src/ltsmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,11 @@ int main(int argc, char *argv[])
goto cleanup_tsm;
}

char buf[TSM_BUF_LENGTH] = {0};
char* buf = malloc(TSM_BUF_LENGTH);
if (!buf) {
goto cleanup_tsm;
}

size_t size;
do {
size = fread(buf, 1, TSM_BUF_LENGTH, stdin);
Expand All @@ -511,6 +515,9 @@ int main(int argc, char *argv[])
}
} while (!feof(stdin));

if (buf) free(buf);
buf = NULL;

rc = tsm_fclose(&session);
if (rc)
CT_ERROR(errno, "tsm_fclose failed");
Expand Down