linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>, Tim Waugh <tim@cyberelk.net>,
	Borislav Petkov <bp@alien8.de>, Jan Kara <jack@suse.com>,
	linux-block@vger.kernel.org, linux-ide@vger.kernel.org,
	linux-scsi@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Damien Le Moal <damien.lemoal@wdc.com>
Subject: Re: [PATCH 6/7] isofs: stop using ioctl_by_bdev
Date: Mon, 27 Apr 2020 11:50:45 +0200	[thread overview]
Message-ID: <20200427095045.GA15107@quack2.suse.cz> (raw)
In-Reply-To: <20200425075706.721917-7-hch@lst.de>

On Sat 25-04-20 09:57:05, Christoph Hellwig wrote:
> Instead just call the CDROM layer functionality directly, and turn the
> hot mess in isofs_get_last_session into remotely readable code.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>

Looks good to me. You can add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/isofs/inode.c | 54 +++++++++++++++++++++++-------------------------
>  1 file changed, 26 insertions(+), 28 deletions(-)
> 
> diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
> index 62c0462dc89f3..276107cdaaf13 100644
> --- a/fs/isofs/inode.c
> +++ b/fs/isofs/inode.c
> @@ -544,43 +544,41 @@ static int isofs_show_options(struct seq_file *m, struct dentry *root)
>  
>  static unsigned int isofs_get_last_session(struct super_block *sb, s32 session)
>  {
> -	struct cdrom_multisession ms_info;
> -	unsigned int vol_desc_start;
> -	struct block_device *bdev = sb->s_bdev;
> -	int i;
> +	struct cdrom_device_info *cdi = disk_to_cdi(sb->s_bdev->bd_disk);
> +	unsigned int vol_desc_start = 0;
>  
> -	vol_desc_start=0;
> -	ms_info.addr_format=CDROM_LBA;
>  	if (session > 0) {
> -		struct cdrom_tocentry Te;
> -		Te.cdte_track=session;
> -		Te.cdte_format=CDROM_LBA;
> -		i = ioctl_by_bdev(bdev, CDROMREADTOCENTRY, (unsigned long) &Te);
> -		if (!i) {
> +		struct cdrom_tocentry te;
> +
> +		if (!cdi)
> +			return 0;
> +
> +		te.cdte_track = session;
> +		te.cdte_format = CDROM_LBA;
> +		if (cdrom_read_tocentry(cdi, &te) == 0) {
>  			printk(KERN_DEBUG "ISOFS: Session %d start %d type %d\n",
> -				session, Te.cdte_addr.lba,
> -				Te.cdte_ctrl&CDROM_DATA_TRACK);
> -			if ((Te.cdte_ctrl&CDROM_DATA_TRACK) == 4)
> -				return Te.cdte_addr.lba;
> +				session, te.cdte_addr.lba,
> +				te.cdte_ctrl & CDROM_DATA_TRACK);
> +			if ((te.cdte_ctrl & CDROM_DATA_TRACK) == 4)
> +				return te.cdte_addr.lba;
>  		}
>  
>  		printk(KERN_ERR "ISOFS: Invalid session number or type of track\n");
>  	}
> -	i = ioctl_by_bdev(bdev, CDROMMULTISESSION, (unsigned long) &ms_info);
> -	if (session > 0)
> -		printk(KERN_ERR "ISOFS: Invalid session number\n");
> -#if 0
> -	printk(KERN_DEBUG "isofs.inode: CDROMMULTISESSION: rc=%d\n",i);
> -	if (i==0) {
> -		printk(KERN_DEBUG "isofs.inode: XA disk: %s\n",ms_info.xa_flag?"yes":"no");
> -		printk(KERN_DEBUG "isofs.inode: vol_desc_start = %d\n", ms_info.addr.lba);
> -	}
> -#endif
> -	if (i==0)
> +
> +	if (cdi) {
> +		struct cdrom_multisession ms_info;
> +
> +		ms_info.addr_format = CDROM_LBA;
> +		if (cdrom_multisession(cdi, &ms_info) == 0) {
>  #if WE_OBEY_THE_WRITTEN_STANDARDS
> -		if (ms_info.xa_flag) /* necessary for a valid ms_info.addr */
> +			/* necessary for a valid ms_info.addr */
> +			if (ms_info.xa_flag)
>  #endif
> -			vol_desc_start=ms_info.addr.lba;
> +				vol_desc_start = ms_info.addr.lba;
> +		}
> +	}
> +
>  	return vol_desc_start;
>  }
>  
> -- 
> 2.26.1
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

  parent reply	other threads:[~2020-04-27  9:50 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-25  7:56 stop using ioctl_by_bdev for file system access to CDROMs v2 Christoph Hellwig
2020-04-25  7:57 ` [PATCH 1/7] block: add a cdrom_device_info pointer to struct gendisk Christoph Hellwig
2020-04-27  6:15   ` Hannes Reinecke
2020-04-25  7:57 ` [PATCH 2/7] ide-cd: rename cdrom_read_tocentry Christoph Hellwig
2020-04-27  6:16   ` Hannes Reinecke
2020-04-25  7:57 ` [PATCH 3/7] cdrom: factor out a cdrom_read_tocentry helper Christoph Hellwig
2020-04-27  6:17   ` Hannes Reinecke
2020-04-25  7:57 ` [PATCH 4/7] cdrom: factor out a cdrom_multisession helper Christoph Hellwig
2020-04-27  6:17   ` Hannes Reinecke
2020-04-25  7:57 ` [PATCH 5/7] hfsplus: stop using ioctl_by_bdev Christoph Hellwig
2020-04-27  6:18   ` Hannes Reinecke
2020-05-04 16:16   ` Jens Axboe
2020-05-04 16:21     ` Christoph Hellwig
2020-05-04 16:41       ` Jens Axboe
2020-04-25  7:57 ` [PATCH 6/7] isofs: " Christoph Hellwig
2020-04-27  6:18   ` Hannes Reinecke
2020-04-27  9:50   ` Jan Kara [this message]
2020-04-25  7:57 ` [PATCH 7/7] udf: " Christoph Hellwig
2020-04-27  6:18   ` Hannes Reinecke
2020-04-28  6:53 ` stop using ioctl_by_bdev for file system access to CDROMs v2 Christoph Hellwig
2020-05-04 16:42 ` Jens Axboe
  -- strict thread matches above, loose matches on Subject: below --
2020-04-23  7:12 stop using ioctl_by_bdev for file system access to CDROMs Christoph Hellwig
2020-04-23  7:12 ` [PATCH 6/7] isofs: stop using ioctl_by_bdev Christoph Hellwig
2020-04-23  7:42   ` Damien Le Moal
2020-04-23 11:03   ` Jan Kara
2020-04-24  6:52     ` Christoph Hellwig
2020-04-24  9:21       ` Jan Kara

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=20200427095045.GA15107@quack2.suse.cz \
    --to=jack@suse.cz \
    --cc=axboe@kernel.dk \
    --cc=bp@alien8.de \
    --cc=damien.lemoal@wdc.com \
    --cc=hch@lst.de \
    --cc=jack@suse.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=tim@cyberelk.net \
    /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).