linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Zdenek Kabelac <zkabelac@redhat.com>
To: Lukas Czerner <lczerner@redhat.com>
Cc: linux-lvm@redhat.com
Subject: Re: [linux-lvm] [PATCH 11/35] fsadm: Add "remove" command
Date: Thu, 22 Sep 2011 13:41:42 +0200	[thread overview]
Message-ID: <4E7B1EF6.3060400@redhat.com> (raw)
In-Reply-To: <alpine.LFD.2.00.1109221247570.4968@dhcp-27-109.brq.redhat.com>

Dne 22.9.2011 12:52, Lukas Czerner napsal(a):
> On Thu, 22 Sep 2011, Zdenek Kabelac wrote:
> 
>> Dne 22.9.2011 12:36, Lukas Czerner napsal(a):
>>> On Thu, 22 Sep 2011, Zdenek Kabelac wrote:
>>>
>>>> Dne 21.9.2011 18:45, Lukas Czerner napsal(a):
>>>>> Remove command allows to remove unused devices from the pool (volume
>>>>> group).
>>>>>
>>>>> Signed-off-by: Lukas Czerner <lczerner@redhat.com>
>>>>> ---
>>>>>  scripts/fsadm.sh |   82 ++++++++++++++++++++++++++++++++++++++++-------------
>>>>>  1 files changed, 62 insertions(+), 20 deletions(-)
>>>>>
>>>>> diff --git a/scripts/fsadm.sh b/scripts/fsadm.sh
>>>>> index 6617de0..4a4f625 100755
>>>>> --- a/scripts/fsadm.sh
>>>>> +++ b/scripts/fsadm.sh
>>>>> @@ -823,11 +823,12 @@ list_filesystems() {
>>>>>  	IFS=$NL
>>>>>  	local c=0
>>>>>  	for line in $(LANG=C $LVM lvs -o lv_path,lv_size,segtype --noheadings --separator ' ' --nosuffix --units k 2> /dev/null); do
>>>>> -		c=$((c+1))
>>>>>  		line=$(echo $line | sed -e 's/^ *\//\//')
>>>>>  		volume=$(echo $line | cut -d' ' -f1)
>>>>> -		volumes[$c]=$volume
>>>>> -		segtype[$c]=$(echo $line | cut -d' ' -f3)
>>>>> +		[ "$volume" == "$last_volume" ] && continue
>>>>> +		c=$((c+1))
>>>>> +		local volumes[$c]=$volume
>>>>> +		local segtype[$c]=$(echo $line | cut -d' ' -f3)
>>>>>  		detect_fs $volume
>>>>>  		detect_mounted
>>>>>  		detect_fs_size
>>>>
>>>> Could you please update/cleanup the patch set - so it doesn't rework same code
>>>> multiple times over and over ?
>>>> (It's a waste of time to review new code, which gets replaced several times
>>>> during the whole patch set)
>>>
>>> Unfortunately that is what I have mentioned in the patch 0. The main
>>> problem is that the fsadm is one file script and while adding other
>>> functionality I was building helpers and yes also changing other parts
>>> of the code.
>>>
>>> It was not possible for me make one feature, be done with it and move to
>>> the another feature. Some of them actually supports each other and not
>>> having to rebase with every change made my work significantly easier. So
>>> at this point I am not going to rework the patches, since it would take
>>> more time that actually write that code :).
>>>
>>> But, since it is a single file script, and I changed the whole thing
>>> significantly (there is not much left from the original code) I can
>>> create one big patch covering all the new features, so it will be easier
>>> for you to review it. Will that be acceptable for you ?
>>
>>
>> Yes - I could imagine in certain cases it might be useful to squash several
>> patches together to improve readability here.
>>
>> But before you change some code - please look at how it has looked and do not
>> put problem which were already resolved.
> 
> I am sorry, but I am not sure what you have in mind. Cold you be more
> specific ?

i.e. those  "$var" changes which were already fixed upstream.


> 
>>
>> Few notes for script writing:  use  "$VAR"  (since path may contain spaces)
>> Preferred way for using shell test is  'test '  instead of []
> 
> Yes, as Stephane already said, using "$var" is really what we need to
> use. I'll change it. But I am really not sure why would using 'test' be
> preferred over [] ? doing things like [ -b "$dev" ] or similar seems
> just better readable for me. But maybe I am missing something.

Well it's the preferred shell coding style used in lvm for lines like:

test 1 -eq 0 &&

instead of

[ 1 -eq 0 ] &&

And while it's not the case of bash - in some older non bash shells it's been
more often 'test' was shell builtin, and '[' is externally executed program.
(Yet, that's why bashism should be eliminated - some distros even
intentionally replace bash with something faster & lighter).
AFAIK in all cases we could probably avoid usage of bash specific extensions.
Have you tested your script on some older distros? (i.e. upstream fsadm.sh has
couple hacks around commands where its syntax changed over the time)

Zdenek

  reply	other threads:[~2011-09-22 11:41 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-21 16:45 [linux-lvm] [RFC][PATCH 00/35] fsadm update Lukas Czerner
2011-09-21 16:45 ` [linux-lvm] [PATCH 01/35] fsadm: Add "create" command Lukas Czerner
2011-09-21 19:00   ` Stephane Chazelas
2011-09-22  9:28     ` Lukas Czerner
2011-09-22 10:01       ` Zdenek Kabelac
2011-09-22 10:27         ` Lukas Czerner
2011-09-22 10:56       ` Stephane Chazelas
2011-09-21 16:45 ` [linux-lvm] [PATCH 02/35] fsadm: Add "destroy" command Lukas Czerner
2011-09-21 16:45 ` [linux-lvm] [PATCH 03/35] fsadm: Add "list" command Lukas Czerner
2011-09-21 16:45 ` [linux-lvm] [PATCH 04/35] fsadm: Make "create" command more vg aware Lukas Czerner
2011-09-21 16:45 ` [linux-lvm] [PATCH 05/35] fsadm: Teach "destroy" command to take more arguments Lukas Czerner
2011-09-21 16:45 ` [linux-lvm] [PATCH 06/35] fsadm: Simple cleanup and comment update Lukas Czerner
2011-09-21 16:45 ` [linux-lvm] [PATCH 07/35] fsadm: Create "add" command Lukas Czerner
2011-09-21 16:45 ` [linux-lvm] [PATCH 08/35] fsadm: Update "list" command for better alignment Lukas Czerner
2011-09-21 16:45 ` [linux-lvm] [PATCH 09/35] fsadm: Specify number of stripes when no device is given Lukas Czerner
2011-09-21 16:45 ` [linux-lvm] [PATCH 10/35] fsadm: Print type of the volume in filesystem listing Lukas Czerner
2011-09-21 16:45 ` [linux-lvm] [PATCH 11/35] fsadm: Add "remove" command Lukas Czerner
2011-09-22 10:06   ` Zdenek Kabelac
2011-09-22 10:36     ` Lukas Czerner
2011-09-22 10:43       ` Zdenek Kabelac
2011-09-22 10:52         ` Lukas Czerner
2011-09-22 11:41           ` Zdenek Kabelac [this message]
2011-09-21 16:45 ` [linux-lvm] [PATCH 12/35] fsadm: Try to avoid calling LVM in the loops Lukas Czerner
2011-09-21 16:45 ` [linux-lvm] [PATCH 13/35] fsadm: Merge "destroy" and "remove" into one command Lukas Czerner
2011-09-21 16:45 ` [linux-lvm] [PATCH 14/35] fsadm: Allow to remove all volume groups Lukas Czerner
2011-09-21 16:45 ` [linux-lvm] [PATCH 15/35] fsadm: Make all internal math in kilobytes Lukas Czerner
2011-09-21 16:45 ` [linux-lvm] [PATCH 16/35] fsadm: Use warn for warnings in list command Lukas Czerner
2011-09-21 16:45 ` [linux-lvm] [PATCH 17/35] fsadm: Handle resize if there is no file system Lukas Czerner
2011-09-21 16:45 ` [linux-lvm] [PATCH 18/35] fsadm: Fsck extN before resize only if it is not mounted Lukas Czerner
2011-09-21 16:45 ` [linux-lvm] [PATCH 19/35] fsadm: Align numbers to the decimal point Lukas Czerner
2011-09-21 16:45 ` [linux-lvm] [PATCH 20/35] fsadm: Add simple configuration file Lukas Czerner
2011-09-21 16:45 ` [linux-lvm] [PATCH 21/35] fsadm: Use DEFAULT_POOL when creating volume group Lukas Czerner
2011-09-22 10:09   ` Zdenek Kabelac
2011-09-21 16:45 ` [linux-lvm] [PATCH 22/35] fsadm: Add LVOL_PREFIX configuration option Lukas Czerner
2011-09-21 16:45 ` [linux-lvm] [PATCH 23/35] fsadm: Only use readlink if link is provided Lukas Czerner
2011-09-21 16:45 ` [linux-lvm] [PATCH 24/35] fsadm: Remove unnecessary modification of PATH variable Lukas Czerner
2011-09-21 16:45 ` [linux-lvm] [PATCH 25/35] fsadm: Allow to specify size without "size=" prefix in "resize" Lukas Czerner
2011-09-21 16:45 ` [linux-lvm] [PATCH 26/35] fsadm: Allow to specify lv in vg/lv format Lukas Czerner
2011-09-21 16:45 ` [linux-lvm] [PATCH 27/35] fsadm: error out when no size is provided in resize Lukas Czerner
2011-09-21 16:45 ` [linux-lvm] [PATCH 28/35] fsadm: Umount ext2 file system prior resize Lukas Czerner
2011-09-22 10:28   ` Zdenek Kabelac
2011-09-21 16:45 ` [linux-lvm] [PATCH 29/35] lvresize: Specify --resize-fs-only when going to use fsadm resize Lukas Czerner
2011-09-21 16:45 ` [linux-lvm] [PATCH 30/35] test: add helper to compute aligned lv size Lukas Czerner
2011-09-21 16:45 ` [linux-lvm] [PATCH 31/35] fsadm: Add help for new commands and update man page Lukas Czerner
2011-09-21 16:45 ` [linux-lvm] [PATCH 32/35] fsadm: Update authorship of the fsadm Lukas Czerner
2011-09-21 16:45 ` [linux-lvm] [PATCH 33/35] test: Add test for fsadm add command Lukas Czerner
2011-09-21 16:45 ` [linux-lvm] [PATCH 34/35] test: Add test for fsadm create command Lukas Czerner
2011-09-21 16:45 ` [linux-lvm] [PATCH 35/35] test: Add test for fsadm resize command Lukas Czerner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E7B1EF6.3060400@redhat.com \
    --to=zkabelac@redhat.com \
    --cc=lczerner@redhat.com \
    --cc=linux-lvm@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).