This is an automated email from the git hooks/post-receive script.
teigland pushed a commit to branch master in repository sanlock.
commit 52d095a1c824bf3a591d431afee7a1aba32d5a31 Author: David Teigland teigland@redhat.com AuthorDate: Wed Aug 14 16:07:00 2024 -0500
sanlock: don't reduce max_sectors_kb
If the current value is larger than the desired value, then do nothing, leaving the current value. --- src/diskio.c | 6 +++--- src/lockspace.c | 18 +++++++++++++++--- src/sanlock.8 | 1 + 3 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/src/diskio.c b/src/diskio.c index 488427e..697bde7 100644 --- a/src/diskio.c +++ b/src/diskio.c @@ -139,16 +139,16 @@ static int write_sysfs_size(const char *disk_path, const char *name, unsigned in
int set_max_sectors_kb(struct sync_disk *disk, uint32_t set_kb) { - unsigned int max_kb = 0; + unsigned int cur_kb = 0; int rv;
- rv = read_sysfs_size(disk->path, "max_sectors_kb", &max_kb); + rv = read_sysfs_size(disk->path, "max_sectors_kb", &cur_kb); if (rv < 0) { log_debug("set_max_sectors_kb read error %d %s", rv, disk->path); return rv; }
- if (max_kb == set_kb) + if (cur_kb >= set_kb) return 0;
rv = write_sysfs_size(disk->path, "max_sectors_kb", set_kb); diff --git a/src/lockspace.c b/src/lockspace.c index 4cd8277..4d4240d 100644 --- a/src/lockspace.c +++ b/src/lockspace.c @@ -54,7 +54,7 @@ static int helper_set_max_sectors_kb(struct sync_disk *disk, uint32_t set_kb) struct helper_msg hm; struct stat st; int ma, mi; - unsigned int max_kb = 0; + unsigned int cur_kb = 0; int rv;
rv = stat(disk->path, &st); @@ -68,13 +68,13 @@ static int helper_set_max_sectors_kb(struct sync_disk *disk, uint32_t set_kb) snprintf(sysfs_path, sizeof(sysfs_path), "/sys/dev/block/%d:%d/queue/max_sectors_kb", ma, mi); sysfs_path[SANLK_HELPER_PATH_LEN-1] = '\0';
- rv = read_sysfs_uint(sysfs_path, &max_kb); + rv = read_sysfs_uint(sysfs_path, &cur_kb); if (rv < 0) { /* max_sectors_kb setting may not exist */ return -1; }
- if (max_kb == set_kb) + if (cur_kb >= set_kb) return 0;
if (helper_kill_fd == -1) @@ -760,6 +760,7 @@ static void set_lockspace_max_sectors_kb(struct space *sp, int sector_size, int struct stat st; int align_size_kb = align_size / 1024; /* align_size is in bytes */ unsigned int hw_kb = 0; + unsigned int cur_kb = 0; unsigned int set_kb = 0; int rv;
@@ -787,6 +788,17 @@ static void set_lockspace_max_sectors_kb(struct space *sp, int sector_size, int return; }
+ rv = read_sysfs_size(sp->host_id_disk.path, "max_sectors_kb", &cur_kb); + if (rv < 0 || !cur_kb) { + log_space(sp, "set_lockspace_max_sectors_kb max_sectors_kb unknown %d %u", rv, cur_kb); + return; + } + + if (cur_kb >= set_kb) { + log_space(sp, "set_lockspace_max_sectors_kb keep current %u for set %u", cur_kb, set_kb); + return; + } + if (hw_kb < set_kb) { /* * If the hardware won't support requested size, try setting 1MB. diff --git a/src/sanlock.8 b/src/sanlock.8 index d94e6e5..75abcf5 100644 --- a/src/sanlock.8 +++ b/src/sanlock.8 @@ -1385,6 +1385,7 @@ changing max_sectors_kb for the lockspace disk when starting a lockspace. Set to "align" (no quotes) to set max_sectors_kb for the lockspace disk to the align size of the lockspace. Set to a number to set a specific number of KB for all lockspace disks. +A larger existing max_sectors_kb value will not be reduced by this setting.
.IP [bu] 2 debug_clients = 0
sanlock-devel@lists.fedorahosted.org