Re: [PATCH 1/2] common/rc: Enable _format_swapfile to return the swap size

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



Hi Eryu.

> > @@ -2595,8 +2596,11 @@ _format_swapfile() {
> >  	$CHATTR_PROG +C "$fname" > /dev/null 2>&1
> >  	_pwrite_byte 0x61 0 "$sz" "$fname" >> $seqres.full
> >  	# Ignore permission complaints on filesystems that don't support perms
> > -	$MKSWAP_PROG "$fname" 2>&1 >> $seqres.full | \
> > -		grep -v "insecure permission"
> > +	swap_log=$($MKSWAP_PROG "$fname" 2>&1 | grep -v "insecure permission")
> > +	echo $swap_log >> $seqres.full
> > +
> > +	# return created swap size
> > +	echo $swap_log | grep -oP '(?<=size = )\w+'
> 
> It's now returning the size of the swap space, it'd be better to add
> some comments before the helper to describe/explain the behavior.

Thanks for the review. You mean another comment on the top of function
definition, despite the one I added inlined? I think it would just make it
redundant, but I'm not against moving my comment from above the echo call, to
the top of the function definition.

Cheers.

> 
> Thanks,
> Eryu
> 
> >  }
> >  
> >  _swapon_file() {
> > @@ -2628,7 +2632,7 @@ _require_scratch_swapfile()
> >  	_scratch_mount
> >  
> >  	# Minimum size for mkswap is 10 pages
> > -	_format_swapfile "$SCRATCH_MNT/swap" $(($(get_page_size) * 10))
> > +	_format_swapfile "$SCRATCH_MNT/swap" $(($(get_page_size) * 10)) > /dev/null
> >  
> >  	# ext* has supported all variants of swap files since their
> >  	# introduction, so swapon should not fail.
> > -- 
> > 2.31.1
> 

-- 
Carlos




[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux