Message ID | 20201008122430.93433-2-nborisov@suse.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Small QOI fixes for transaction_kthread | expand |
On 10/8/20 8:24 AM, Nikolay Borisov wrote: > The kernel provides easy to understand helpers to convert from human > understandable units to the kernel-friendly 'jiffies'. So let's use > those to make the code easier to understand. No functional changes. > > Signed-off-by: Nikolay Borisov <nborisov@suse.com> > --- > fs/btrfs/disk-io.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c > index 764001609a15..77b52b724733 100644 > --- a/fs/btrfs/disk-io.c > +++ b/fs/btrfs/disk-io.c > @@ -1721,7 +1721,7 @@ static int transaction_kthread(void *arg) > > do { > cannot_commit = false; > - delay = HZ * fs_info->commit_interval; > + delay = msecs_to_jiffies(fs_info->commit_interval * 1000); Since we're now doing everything in msecs, why don't we just make sure ->commit_interval is set to msecs, that way we don't have to carry around the * 1000? If we still need the multiplication we should be using MSEC_PER_SEC. Thanks, Josef
On 21.10.20 г. 17:51 ч., Josef Bacik wrote: > On 10/8/20 8:24 AM, Nikolay Borisov wrote: >> The kernel provides easy to understand helpers to convert from human >> understandable units to the kernel-friendly 'jiffies'. So let's use >> those to make the code easier to understand. No functional changes. >> >> Signed-off-by: Nikolay Borisov <nborisov@suse.com> >> --- >> fs/btrfs/disk-io.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c >> index 764001609a15..77b52b724733 100644 >> --- a/fs/btrfs/disk-io.c >> +++ b/fs/btrfs/disk-io.c >> @@ -1721,7 +1721,7 @@ static int transaction_kthread(void *arg) >> do { >> cannot_commit = false; >> - delay = HZ * fs_info->commit_interval; >> + delay = msecs_to_jiffies(fs_info->commit_interval * 1000); > > Since we're now doing everything in msecs, why don't we just make sure > ->commit_interval is set to msecs, that way we don't have to carry > around the * 1000? If we still need the multiplication we should be > using MSEC_PER_SEC. Thanks, Yes, as a matter of fact I intend on making commit_interval into jiffies, to completely eliminate the msecs_to_jiffies helpers here. But that will be a follow on work once David merges the v2 of "Be smarter" patch. > > Josef >
On Wed, Oct 21, 2020 at 06:03:00PM +0300, Nikolay Borisov wrote: > > > On 21.10.20 г. 17:51 ч., Josef Bacik wrote: > > On 10/8/20 8:24 AM, Nikolay Borisov wrote: > >> The kernel provides easy to understand helpers to convert from human > >> understandable units to the kernel-friendly 'jiffies'. So let's use > >> those to make the code easier to understand. No functional changes. > >> > >> Signed-off-by: Nikolay Borisov <nborisov@suse.com> > >> --- > >> fs/btrfs/disk-io.c | 4 ++-- > >> 1 file changed, 2 insertions(+), 2 deletions(-) > >> > >> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c > >> index 764001609a15..77b52b724733 100644 > >> --- a/fs/btrfs/disk-io.c > >> +++ b/fs/btrfs/disk-io.c > >> @@ -1721,7 +1721,7 @@ static int transaction_kthread(void *arg) > >> do { > >> cannot_commit = false; > >> - delay = HZ * fs_info->commit_interval; > >> + delay = msecs_to_jiffies(fs_info->commit_interval * 1000); > > > > Since we're now doing everything in msecs, why don't we just make sure > > ->commit_interval is set to msecs, that way we don't have to carry > > around the * 1000? If we still need the multiplication we should be > > using MSEC_PER_SEC. Thanks, > > Yes, as a matter of fact I intend on making commit_interval into > jiffies, to completely eliminate the msecs_to_jiffies helpers here. > > But that will be a follow on work once David merges the v2 of "Be > smarter" patch. As the commit_interval is an internal value, jiffies is ok, the conversions happen happen for mount option set and print only. So ok from me.
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 764001609a15..77b52b724733 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -1721,7 +1721,7 @@ static int transaction_kthread(void *arg) do { cannot_commit = false; - delay = HZ * fs_info->commit_interval; + delay = msecs_to_jiffies(fs_info->commit_interval * 1000); mutex_lock(&fs_info->transaction_kthread_mutex); spin_lock(&fs_info->trans_lock); @@ -1736,7 +1736,7 @@ static int transaction_kthread(void *arg) (now < cur->start_time || now - cur->start_time < fs_info->commit_interval)) { spin_unlock(&fs_info->trans_lock); - delay = HZ * 5; + delay = msecs_to_jiffies(5000); goto sleep; } transid = cur->transid;
The kernel provides easy to understand helpers to convert from human understandable units to the kernel-friendly 'jiffies'. So let's use those to make the code easier to understand. No functional changes. Signed-off-by: Nikolay Borisov <nborisov@suse.com> --- fs/btrfs/disk-io.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)