From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Martin K. Petersen" Subject: Re: block: Fix a WRITE SAME BUG_ON Date: Tue, 19 Feb 2019 18:10:39 -0500 Message-ID: References: <20190125021107.4595-1-zhangxiaoxu5@huawei.com> <20190128221441.GA24102@redhat.com> <20190131103924.GA22503@infradead.org> <20190201073527.GA14758@infradead.org> <20190201161803.GA21124@infradead.org> <6a00e005-656e-7b3c-6b86-1430f3e7e623@huawei.com> <22afb417-1bc6-d638-def7-aa3dcc9bcd31@huawei.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <22afb417-1bc6-d638-def7-aa3dcc9bcd31@huawei.com> (zhangxiaoxu's message of "Mon, 18 Feb 2019 22:10:51 +0800") List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com To: "zhangxiaoxu (A)" Cc: axboe@kernel.dk, linux-block@vger.kernel.org, John Dorminy , Mike Snitzer , Heinz Mauelshagen , Christoph Hellwig , dm-devel@redhat.com, "Martin K. Petersen" , Alasdair G Kergon List-Id: dm-devel.ids Hi Zhang, > ping. > > Anyone can help merge this patch? or any other solutions? + /* If the logical block size is different, forbid write same */ + if (t->logical_block_size != b->logical_block_size && + t->max_write_same_sectors != UINT_MAX) + t->max_write_same_sectors = 0; + else + t->max_write_same_sectors = min(t->max_write_same_sectors, + b->max_write_same_sectors); + I am not particularly keen on this UINT_MAX magic. I would prefer to have the stacking driver default for lbs be set to 0 so the stacking function could avoid special-casing the first iteration. But I am not sure whether that would break any assumptions in DM/MD wrt. the logical block size being non-zero prior to calling the stacking function. Mike? Any comments? If we stick with the UINT_MAX check, the comment should at least point out why it's there. -- Martin K. Petersen Oracle Linux Engineering